Refunds
Using the paymentId
and authorization
values returned from a previous payment, refund requests are submitted as POST requests to the /payments/paymentId/refund
path.
For example, let's assume we've created a payment for $14.00 and received a paymentId
of 64acad09c79c5e590217a1a5
and an authorization
of EP273834
in the response.
Then, to refund $10.50 of the payment, we'd send the request to /payments/64acad09c79c5e590217a1a5/refund
, as follows:
POST /payments/64acad09c79c5e590217a1a5/refund
{
"amount": 1050,
"authorization": "EP273834"
}
{
"paymentId": "64aca4e5c79c5e590217a16a",
"type": "refund",
"status": "completed",
"approved": true,
"captured": false,
"authorization": "EP273834",
"amount": 1050,
...
}
Now, if you look up the original transaction, you will see that its status
has changed to 'refunded'
and that there is a refundDetails
attribute which is an array of paymentId
s of the refund transactions. There is also a remaining
value, which is the amount of un-refunded funds — 350 cents in this case.
GET /payments/64acad09c79c5e590217a1a5
{
"paymentId": "64af9580c79c5e590217a1d5",
"type": "payment",
"status": "refunded",
"approved": true,
"captured": true,
"refunded": true,
...
"refundDetails": {
"refunds": [
"64aca4e5c79c5e590217a16a"
],
"remaining": 350
}
}
Usage Notes
You can refund any captured payment, so either a 1-pass payment, or any captures of an authorization.
If required, you can refund a portion of the payment - you do not need to refund the whole amount.