Refunds
Refunds allow you to return funds to customers for completed transactions. This guide covers creating and managing refunds.
Overview
A refund represents a return of funds for a transaction. Refunds can be:
- Full refund: Return the entire transaction amount
- Partial refund: Return a portion of the transaction amount
Create a Refund
POST /api/refund/create
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
transactionId | String | Yes | Transaction ID to refund |
amount | Long | No | Refund amount in cents (omit for full refund) |
reason | String | No | Reason for refund |
refundType | String | Yes | FULL or PARTIAL |
Example
curl -X POST http://localhost:8080/api/refund/create \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-d '{
"transactionId": "TXN2026081800001",
"amount": 50000,
"reason": "Customer request",
"refundType": "PARTIAL"
}'
Refund Status
| Status | Description |
|---|---|
PENDING | Refund initiated, awaiting processing |
PROCESSING | Refund is being processed |
SUCCEEDED | Refund completed successfully |
FAILED | Refund failed |
CANCELLED | Refund cancelled |
Refund Limits
- Full refunds must be within 180 days of the original transaction
- Partial refunds cannot exceed the remaining refundable amount
- Multiple partial refunds are allowed until total reaches transaction amount
List Refunds
GET /api/refund/list?transactionId={transactionId}
Code Examples
Node.js
const refund = await client.refunds.create({
transactionId: 'TXN2026081800001',
amount: 50000,
reason: 'Customer request',
});
// Full refund
const fullRefund = await client.refunds.create({
transactionId: 'TXN2026081800001',
refundType: 'FULL',
});