Refunding a payment

Using the Yoco Checkout API, you can refund any successfully processed payment.

In order to process a refund, the Checkout must have been created using live keys. For more information on the difference between live and test keys, see the authentication guide.

1

Initiate a refund

Make an authenticated POST request from your server to https://payments.yoco.com/api/checkouts/{checkout-id}/refund with the required details.

Example initiate refund request
$curl --location --request POST 'https://payments.yoco.com/api/checkouts/{checkout-id}/refund' \
>--header 'Content-Type: application/json' \
>--header 'Authorization: Bearer <secret-key>'

Include an Idempotency-Key header to safely retry refund requests. Learn more.

For more information on the request body, see the API reference.

2

Check the refund request response

After making the refund request, the API will respond with a 202 Accepted status code if the request was received and is being processed.

This means the refund process has started, but is not yet complete. The actual outcome of the refund (success or failure) will be communicated via a webhook event.

3

Verify that the refund is successful

Listen for the webhook event on your server to confirm the refund was successful before continuing.

The status of the refund can be verified by referring to the type field of the webhook event. A refund is considered successful if its type is marked as refund.succeeded.

For more information on receiving refund webhook events, see the webhooks API reference.

For more information on errors, see the errors documentation.