Refund API

Use a refund to return a payment to a customer.

Note: We do not currently support partial refunds. The original charge will therefore be fully refunded.

Request

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

Headers

ParameterTypeDescription
X-Auth-Secret-Key
string
The secret key for your account

Body

ParameterTypeDescription
chargeId
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

import json
import requests
# Anonymous test key. Replace with your key.
SECRET_KEY = 'sk_test_960bfde0VBrLlpK098e4ffeb53e1'
response = requests.post(
'https://online.yoco.com/v1/refunds/',
headers={
'X-Auth-Secret-Key': SECRET_KEY,
},
json={
'chargeId': 'ch_xpnGtOMMObOw',
},
)
# response.status_code will contain the HTTP status code
# response.json() will contain the response body

Response

HTTP: 200 OK
{
"id": "rfd_kaA15fAoB0JEwQHLXPUWBXhYwr",
"status": "successful",
"message": "Your refund has been processed",
"metadata": {}
}