Refunds
Process refunds for completed payments. The payment gateway supports refunds via cryptocurrency (blockchain address) or bank transfer.
Refund Flow
sequenceDiagram
participant M as Merchant
participant API as Payment Gateway API
participant A as Admin
participant C as Customer
M->>API: Create Refund Request
API->>API: Validate (payment must have refund=true)
API->>A: Refund Request (PENDING)
A->>API: Approve Refund
API->>C: Process Refund
API->>M: Webhook: payment.refund
Creating a Refund Request
POST /api/refund-request
Authorization: Bearer YOUR_OAUTH_TOKEN
Content-Type: application/json
Crypto Refund
Refund to a blockchain address:
{
"paymentId": "550e8400-e29b-41d4-a716-446655440000",
"blockchainAddress": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh"
}
Bank Refund
Refund to a bank account:
{
"paymentId": "550e8400-e29b-41d4-a716-446655440000",
"bankName": "Deutsche Bank",
"bankCode": "DEUTDEFF",
"bankAccountNumber": "DE89370400440532013000",
"bankAccountHolder": "John Doe"
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
paymentId | string | Yes | UUID of the payment to refund |
blockchainAddress | string | Conditional | Refund destination blockchain address |
bankName | string | Conditional | Bank name for bank refund |
bankCode | string | Conditional | Bank code / SWIFT / BIC |
bankAccountNumber | string | Conditional | Bank account number / IBAN |
bankAccountHolder | string | Conditional | Account holder name |
Provide either blockchainAddress for crypto refund or all bank fields for bank refund.
Prerequisites
- The payment must exist and have
refund = true - No other refund request must exist for this payment
Response
{
"data": {
"id": "660e8400-e29b-41d4-a716-446655440000",
"paymentId": "550e8400-e29b-41d4-a716-446655440000",
"status": "PENDING",
"refundAmount": {
"value": 100.00,
"amount": 10000,
"formatted": "$100.00"
},
"blockchainAddress": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"refundedAt": null,
"createdAt": "2026-01-15T12:00:00Z",
"updatedAt": "2026-01-15T12:00:00Z"
}
}
Refund Status
| Status | Description |
|---|---|
PENDING | Refund request created, awaiting approval |
APPROVED | Refund approved and being processed |
CANCELLED | Refund request rejected |
Get Refund Request
GET /api/refund-request/{id}
Authorization: Bearer YOUR_OAUTH_TOKEN
Refund Webhook
When a refund is completed, a payment.refund webhook event is sent:
{
"payment": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "REFUND",
"refund": true,
"refundedAmount": {
"value": 100.00,
"amount": 10000,
"formatted": "$100.00"
}
}
}
Best Practices
- Verify payment status before requesting a refund
- Store refund references for reconciliation
- Handle webhook events for refund status updates
- Log all refund attempts for audit trails