Skip to content

Refund a transaction

Refunds a transaction through the gateway, records a REFUNDED transaction with a negative amount and sends a REFUND webhook.

Authorization: Bearer <API token>, required.

Name In Type Required Description
id path integer Yes Internal transaction ID.
amountToRefund query number No Amount to refund. Omit for a full refund.
Terminal window
# Full refund
curl "https://api.creditcore.io/api/refund/99101" \
-H "Authorization: Bearer $CREDITCORE_API_TOKEN"
# Partial refund
curl "https://api.creditcore.io/api/refund/99101?amountToRefund=4.50" \
-H "Authorization: Bearer $CREDITCORE_API_TOKEN"

Always 200 OK. Check success:

Success
{ "success": true, "message": "Refund success with amount 9.99" }
Failure
{ "success": false, "message": "This transaction is not refundable 99101" }
Failure message Cause
This transaction is not refundable <id> refundStatus isn’t REFUNDABLE or ALERT (already refunded or partially refunded, declined, voided…).
Refund amount is higher than amount in transaction amountToRefund exceeds the original amount.
Transaction not found with ID: <id> Unknown transaction.
Request error The gateway didn’t return a valid answer.
Other message Unexpected error while processing the refund.

A transaction can only be refunded once: a partial refund sets its refundStatus to PARTIALLY_REFUNDED, and the remaining amount can’t be refunded afterwards.