Refund API

Use a refund to return a payment to a customer.

There are two types of refunds you might need to process:

  • Full refund A full refund returns the total amount of the payment to the customer — it can only be performed once.
  • Partial refund A partial refund returns a sum less than the captured amount. A payment can be refunded multiple times, but cannot exceed the original payment amount.

Request

https://online.yoco.com/v1/refunds/

Headers

ParameterTypeDescription
secretKey
string
The secret key for your account

Body

ParameterTypeDescription
charge_id
string
The charge id returned when you originally did the charge.
eg: ch_xpnGTFDSnlvksdnvkbkfvd
metadata
json
A set of key-value pairs that you can attach to a Refund object.

Example

curl https://online.yoco.com/v1/refunds/ \
-u sk_test_960bfde0VBrLlpK098e4ffeb53e1 \
-d charge=ch_xpnGtOMMObOw

Response

HTTP: 201 Created
{
"source": {
"id": "card_Aj9RzUkGWYKDaMt0M1s5XbC2zA",
"brand": "visa",
"maskedCard": "**** **** **** 4242",
"expiryMonth": 4,
"expiryYear": 2024,
"fingerprint": "09634a43594b4af0eae0a74be89df8545b29af0d",
"object": "card",
"country": "GB"
},
"object": "charge",
"id": "ch_awLYujNDMwzorIBO1iQkrikLq",
"status": "successful",
"currency": "ZAR",
"amountInCents": 1,
"liveMode": false,
"metadata": {"your metadata object":"metadata from original charge"}
}