Refunds an existing payment. Requires an idempotency key to prevent duplicate refunds on retry.
Refunds are critical financial operations where duplicates can cause serious issues. Using idempotency keys ensures:
curl -X POST \
https://api.example.com/rest-api/v0/test-payment/pay_abc123xyz456/refund \
-H 'Content-Type: application/json' \
-H 'Client-Key: your-api-key' \
-H 'Client-Secret: your-api-secret' \
-H 'Idempotency-Key: refund_123456_unique_key'
{
"id": "ref_xyz789",
"paymentId": "pay_abc123xyz456",
"amount": 100.00,
"status": "succeeded",
"timestamp": "2023-07-01T14:30:00.000Z"
}
The exact same response will be returned for any duplicate request with the same idempotency key, without creating a new refund.
Your secret API key. Keep this secure and never expose it in client-side code.
Unique key to ensure the refund request is idempotent. If a request with the same key is sent multiple times, only the first will be processed, and subsequent requests will return the same response.
"refund_123456_unique_key"
Payment ID to refund
Payment refunded successfully
The response is of type object
.