On this page
No Headings
amount object in the JSON request body.OAuth 2.0 authentication
Client CredentialsToken URLhttps://api-m.sandbox.paypal.com/v1/oauth2/tokenInheaderScopes
https://uri.paypal.com/services/payments/refundThe PayPal-generated ID for the captured payment to refund.
^[\S\s]*$0 <= length <= 2147483647A unique ID identifying the request header for idempotency purposes.
^.*$1 <= length <= 10000The preferred server response upon successful completion of the request. Value is:return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.return=representation. The server returns a complete resource representation, including the current state of the resource.
"return=minimal"^[\S\s]*$0 <= length <= 2147483647Holds authorization information for external API calls.
^.*$1 <= length <= 16000Header for an API client-provided JWT assertion that identifies the merchant. Establishing the consent to act-on-behalf of a merchant is a prerequisite for using this header.
^.*$1 <= length <= 10000application/json
TypeScript Definitions
Use the request body type in TypeScript.
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
capture_refunded
curl -X POST "https://api-m.sandbox.paypal.com/v2/payments/captures/2GG279541U471931P/refund" \ -H "PayPal-Request-Id: 17e81d06-77ab-11e8-adc0-fa71639ebebc" \ -H "Prefer: return=representation" \ -H "Authorization: Bearer A21AAGHr9qtiRRXH4oYcQokQgV99rGqEIfgrr8xHCclP0OzmD9KVgg5ppIIg1jzJgQkV4wd02svIvBJyg6cLFJjFow_SjBhxQ" \ -H "PayPal-Auth-Assertion: eyJhbGciOiJub25lIn0.eyJlbWFpbCI6Im15QGVtYWlsLmNvbSJ9" \ -H "Content-Type: application/json" \ -d '{ "amount": { "value": "1.00", "currency_code": "USD" }, "invoice_id": "RefundInvoice-123", "custom_id": "RefundCustom-123" }'{
"id": "0K35355239430361V",
"amount": {
"currency_code": "USD",
"value": "1.00"
},
"seller_payable_breakdown": {
"gross_amount": {
"currency_code": "USD",
"value": "1.00"
},
"paypal_fee": {
"currency_code": "USD",
"value": "0.00"
},
"net_amount": {
"currency_code": "USD",
"value": "1.00"
},
"total_refunded_amount": {
"currency_code": "USD",
"value": "11.00"
}
},
"invoice_id": "RefundInvoice-14_10_2024_4_58_32_pm",
"custom_id": "RefundCustom-14_10_2024_4_58_32_pm",
"status": "COMPLETED",
"create_time": "2024-10-14T14:58:34-07:00",
"update_time": "2024-10-14T14:58:34-07:00",
"links": [
{
"href": "https://api.paypal.com/v2/payments/refunds/0K35355239430361V",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v2/payments/captures/7TK53561YB803214S",
"rel": "up",
"method": "GET"
}
]
}{
"id": "58K15806CS993444T",
"amount": {
"currency_code": "USD",
"value": "89.00"
},
"seller_payable_breakdown": {
"gross_amount": {
"currency_code": "USD",
"value": "89.00"
},
"paypal_fee": {
"currency_code": "USD",
"value": "0.00"
},
"net_amount": {
"currency_code": "USD",
"value": "89.00"
},
"total_refunded_amount": {
"currency_code": "USD",
"value": "100.00"
}
},
"invoice_id": "OrderInvoice-10_10_2024_12_58_20_pm",
"status": "COMPLETED",
"create_time": "2024-10-14T15:03:29-07:00",
"update_time": "2024-10-14T15:03:29-07:00",
"links": [
{
"href": "https://api.msmaster.qa.paypal.com/v2/payments/refunds/58K15806CS993444T",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.msmaster.qa.paypal.com/v2/payments/captures/7TK53561YB803214S",
"rel": "up",
"method": "GET"
}
]
}{
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema",
"debug_id": "78916e688cf7f",
"details": [
{
"issue": "INVALID_STRING_LENGTH",
"field": "/invoice_id",
"value": "Fm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinqFm67fYiinq",
"description": "The value of a field is either too short or too long.",
"location": "body"
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/payments/v2/#error-INVALID_STRING_LENGTH",
"rel": "information_link"
}
]
}{
"name": "AUTHENTICATION_FAILURE",
"debug_id": "b1d1f06c7246c",
"message": "Authentication failed due to missing Authorization header, or invalid authentication credentials."
}{
"name": "NOT_AUTHORIZED",
"debug_id": "b1d1f06c7246c",
"message": "Authorization failed due to insufficient permissions."
}{
"name": "RESOURCE_NOT_FOUND",
"debug_id": "b1d1f06c7246c",
"message": "The specified resource does not exist."
}{
"name": "RESOURCE_CONFLICT",
"debug_id": "b1d1f06c7246c",
"message": "The server has detected a conflict while processing this request.",
"details": [
{
"issue": "PREVIOUS_REQUEST_IN_PROGRESS",
"description": "A previous request on this resource is currently in progress. Please wait for some time and try again. It is best to space out the initial and the subsequent request(s) to avoid receiving this error."
}
]
}{
"name": "UNPROCCESSABLE_ENTITY",
"message": "The requested action could not be completed, is semantically incorrect, or failed business validation.",
"debug_id": "90bff07028f7f",
"details": [
{
"issue": "REFUND_AMOUNT_EXCEEDED",
"description": "The refund amount must be less than or equal to the capture amount that has not yet been refunded."
}
]
}{
"name": "INTERNAL_SERVER_ERROR",
"debug_id": "b1d1f06c7246c",
"message": "An internal server error has occurred."
}{
"name": "INTERNAL_SERVER_ERROR",
"debug_id": "b1d1f06c7246c",
"message": "An internal server error has occurred."
}The API caller-provided external ID. Used to reconcile API caller-initiated transactions with PayPal transactions. Appears in transaction and settlement reports. The pattern is defined by an external party and supports Unicode.
^.*$1 <= length <= 127The API caller-provided external invoice ID for this order. The pattern is defined by an external party and supports Unicode.
^.*$1 <= length <= 127The reason for the refund. Appears in both the payer's transaction history and the emails that the payer receives. The pattern is defined by an external party and supports Unicode.
^.*$1 <= length <= 255