Refund payments

A sale is a completed PayPal payment.

A captured payment is an authorized and captured PayPal payment.

You can refund sales and captured payments.

Integration steps

Important: You cannot run the following sample requests as-is. Replace all call-specific parameter values, such as tokens and IDs, with your own values.

Step Required Description
1. Required Set up your development environment.
2. Optional Either fully refund a sale or partially refund a sale.
3. Optional Fully or partially refund a captured payment.

Set up your development environment

Before you can integrate Payments, you must set up your development environment. After you get a token that lets you access protected REST API resources, you create sandbox accounts to test your web and mobile apps. For details, see Get Started.

Then, return to this page to integrate Payments.

Fully refund a sale

For a full refund, include the sale ID of the completed payment in the URI and include an empty JSON request body.

This example requests a full refund:

curl -v https://api.sandbox.paypal.com/v1/payments/sale/67D22837NN7279935/refund \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer Access-Token" \
  -d '{}'

The response shows the refund details, indicates that the refund is complete, and includes request-related HATEOAS links:

{
  "id": "1JU08902781691411",
  "status": "COMPLETED",
  "links": [
    {
      "rel": "self",
      "method": "GET",
      "href": "https://api.paypal.com/v1/payments/refunds/1JU08902781691411"
    },
    {
      "rel": "up",
      "method": "GET",
      "href": "https://api.paypal.com/v1/payments/captures/2GG279541U471931P"
    }
  ]
}

Partially refund a sale

For a partial refund, include an amount object in the JSON request body.

This example partially refunds a sale:

curl -v -X POST https://api.sandbox.paypal.com/v1/payments/sale/2MU78835H4515710F/refund \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer Access-Token" \
  -d '{
  "amount": {
    "total": "10.99",
    "currency": "USD"
  },
  "invoice_number": "INVOICE-123",
  "description": "Defective product"
}'

The response shows the refund details:

{
  "id": "2MU78835H4515710F",
  "status": "COMPLETED",
  "links": [
    {
      "rel": "self",
      "method": "GET",
      "href": "https://api.paypal.com/v1/payments/refunds/2MU78835H4515710F"
    },
    {
      "rel": "up",
      "method": "GET",
      "href": "https://api.paypal.com/v1/payments/captures/2GG279541U471931P"
    }
  ]
}

Refund a captured payment

To refund a captured payment, include the ID of the captured payment in the URI and an amount object in the JSON request body. You must include the amount object for both full and partial refunds:

curl -v -X POST https://api.sandbox.paypal.com/v1/payments/capture/2MU78835H4515710F/refund \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer Access-Token" \
  -d '{
  "amount": {
    "currency": "USD",
    "total": "110.54"
  }
}'

The response shows the refund details:

{
  "id": "0P209507D6694645N",
  "create_time": "2017-05-06T22:11:51Z",
  "update_time": "2017-05-06T22:11:51Z",
  "state": "completed",
  "amount": {
    "total": "110.54",
    "currency": "USD"
  },
  "capture_id": "8F148933LY9388354",
  "parent_payment": "PAY-8PT597110X687430LKGECATA",
  "invoice_number": "INV-1234567",
  "links": [{
    "href": "https://api.sandbox.paypal.com/v1/payments/refund/0P209507D6694645N",
    "rel": "self",
    "method": "GET"
  }, {
    "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-8PT597110X687430LKGECATA",
    "rel": "parent_payment",
    "method": "GET"
  }, {
    "href": "https://api.sandbox.paypal.com/v1/payments/capture/8F148933LY9388354",
    "rel": "capture",
    "method": "GET"
  }]
}

Next

You can show refund details.

Also, learn how to use the Payment Experience API to create web experience profiles to customize payment flow experiences.

Additional information