Create a refund
Initiate a refund for a payment. The refund will be processed through the original payment gateway.
Related endpoints
GET /refunds— List refundsGET /refunds/{id}— Get refund by ID
Common errors
400 invalid_request— malformed payload or failed validation.401 unauthenticated— missing, malformed, or revoked API key.
Idempotency
Pass an Idempotency-Key header (UUID v4 recommended) to make retries safe. Keys are valid for 24 hours; see the idempotency guide.
x-api-key<token>
Your RevKeen API key (powered by Unkey). Get it from Dashboard > Settings > API Keys. Use rk_sandbox_* for test mode and rk_live_* for production.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
Stuck on an error response? Ask the RevKeen assistant to explain it.
curl -X POST "https://api.revkeen.com/v2/refunds" \
-H "x-api-key: $REVKEEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"payment_id": "660e8400-e29b-41d4-a716-446655440000",
"amount_minor": 5000,
"reason": "customer_request",
"reason_details": "Customer requested refund via support ticket #12345"
}'{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"public_id": "ref_abc123xyz",
"payment_id": "660e8400-e29b-41d4-a716-446655440000",
"parent_transaction_id": "660e8400-e29b-41d4-a716-446655440000",
"order_id": null,
"gateway": "string",
"gateway_refund_id": "txn_refund_12345",
"amount_minor": 5000,
"currency": "USD",
"reason": "customer_request",
"reason_details": "Customer changed their mind",
"status": "succeeded",
"failure_reason": null,
"failure_code": null,
"processed_at": "2024-01-15T10:30:00Z",
"created_at": "2024-01-14T08:00:00Z"
}
}{
"error": "Bad request"
}{
"error": "Unauthorized"
}{
"error": "Internal server error"
}