On this page
No Headings
Last updated: June 26, 2026
Refund a captured payment from a seller back to a buyer.
To use this integration you must:
Pass the PayPal-Auth-Assertion and the PayPal-Partner-Attribution-Id headers with the standard Content-Type, Authorization, and PayPal-Request-ID headers. On the client side, you can generate the value of the PayPal-Auth-Assertion header as follows:
function encodeObjectToBase64(object) {
const objectString = JSON.stringify(object);
return window.btoa(objectString);
}
const clientId = "CLIENT-ID";
const sellerPayerId = "SELLER-PAYER-ID"; // preferred
// const sellerEmail = "SELLER-ACCOUNT-EMAIL"; // use instead of payer-id if required
const header = {
alg: "none"
};
const encodedHeader = encodeObjectToBase64(header);
const payload = {
iss: clientId,
payer_id: sellerPayerId
// email: sellerEmail
};
const encodedPayload = encodeObjectToBase64(payload);
const jwt = `${encodedHeader}.${encodedPayload}.`; // json web token
console.log(`Paypal-Auth-Assertion=${jwt}`);Note: The token contains two period (.) characters, which are required according to the JSON web token structure.
Copy the code and modify the following:
clientId.sellerPayerId is the payer ID of the receiving seller's PayPal account. You can also use email instead of payer_id and supply the email address of the seller's PayPal account.To refund an order, use the /v2/payments/captures/{CAPTURE-ID}/refund endpoint. The CAPTURE-ID can be read from the purchase_units/payments/captures/id field of the order you want to refund.
curl -v -X POST https://api-m.sandbox.paypal.com/v2/payments/captures/2GG279541U471931P/refund \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ACCESS-TOKEN' \
-H 'PayPal-Partner-Attribution-Id: BN-CODE' \
-H 'PayPal-Auth-Assertion: AUTH-ASSERTION-JWT' \
-H 'PayPal-Request-Id: REQUEST-ID' \
-d '{}'For a full refund, include an empty payload in the JSON request body.
For a partial refund, include the amount object in the JSON request body. You can also issue multiple partial refunds up to the total captured amount. If you are unsure how much captured amount is remaining to be refunded after one or more partial refunds, make the API call with the total captured amount or leave the amount field blank. The API will automatically calculate and issue the refund for the remaining value.
Copy the code and modify the following:
ACCESS-TOKEN to your access token.BN-CODE to your PayPal Attribution ID to receive revenue attribution. To find your BN code, see Code and Credential Reference.AUTH-ASSERTION-JWT to your PayPal-Auth-Assertion token.REQUEST-ID to a set of unique alphanumeric characters such as a timestamp to prevent duplicate transactions.A successful request returns the HTTP 201 Created status code. If you didn't receive a response, making the same API call without changing the request should result in an HTTP 200 OK with a confirmation of the refund.
For more information about the refunds API, see the Payment API.
Go through the integration checklist before you go live.