Refund a Transaction
SDKLegacyLast updated: June 20th 2023, @ 6:44:12 pm
There are two ways to refund transactions: on the PayPal website and with the Payments API /refund
resource.
Refunds with the PayPal website
- Log in to paypal.com to search transactions.
- Go to Activities and view transaction details.
- Process the refund by clicking Issue a refund. You can return a partial amount or leave the amount unchanged to issue full refund.
- Click Continue to review the refund, then click Issue Refund.
Refunds with the Payments API
Process refunds by calling the Payments API /refund
resource with the capture ID. The capture ID is returned from any client-side actions.order.capture()
call or server-side captures
call.
The following request processes a partial refund for $20. Issue a full refund by leaving the request body empty.
- Set up your server to make calls to PayPal.
- Get the capture ID from your database.
- Call PayPal to refund the transaction.
- Handle any errors from the call.
The response creates a refund resource with amount and fee break-up details.
{
"id": "28R62814C3999453N",
"amount":
{
"currency_code": "USD",
"value": "20.00"
},
"seller_payable_breakdown":
{
"gross_amount":
{
"currency_code": "USD",
"value": "20.00"
},
"paypal_fee":
{
"currency_code": "USD",
"value": "0.58"
},
"net_amount":
{
"currency_code": "USD",
"value": "19.42"
},
"total_refunded_amount":
{
"currency_code": "USD",
"value": "20.00"
}
},
"invoice_id": "INV-HighFashions",
"status": "COMPLETED",
"create_time": "2018-05-31T20:08:19-07:00",
"update_time": "2018-05-31T20:08:19-07:00",
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v2/payments/refunds/28R62814C3999453N",
"rel": "self",
"method": "GET"
},
{
"href": "https://api-m.sandbox.paypal.com/v2/payments/captures/1HW32023TU4585620",
"rel": "up",
"method": "GET"
}]
}
Read about Refunding a captured payment, including sample responses, in the Payments API reference.
Note: Remember to swap the credentials and API URL from sandbox to production when going live with your integration.