Skip to main content
POST
/
api
/
refunds
curl -X POST https://api.swiftpay.cx/api/refunds \
  -H "Authorization: Bearer mp_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "checkoutSessionId": "sess_abc123",
    "reason": "Customer requested refund"
  }'
{
  "success": true,
  "data": {
    "id": "ref_xyz789",
    "checkoutSessionId": "sess_abc123",
    "amountInCents": 2999,
    "reason": "Customer requested refund",
    "status": "pending",
    "createdAt": "2024-01-15T10:30:00Z"
  }
}

Create Refund

Creates a refund for a completed checkout session.
Refunds can only be created for sessions with status completed. Each session can only be refunded once.

Request

Authorization
string
required
Bearer token with your API key
checkoutSessionId
string
required
The ID of the completed checkout session to refund
reason
string
Reason for the refund (for internal tracking)

Response

success
boolean
Whether the request was successful
data
object
curl -X POST https://api.swiftpay.cx/api/refunds \
  -H "Authorization: Bearer mp_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "checkoutSessionId": "sess_abc123",
    "reason": "Customer requested refund"
  }'
{
  "success": true,
  "data": {
    "id": "ref_xyz789",
    "checkoutSessionId": "sess_abc123",
    "amountInCents": 2999,
    "reason": "Customer requested refund",
    "status": "pending",
    "createdAt": "2024-01-15T10:30:00Z"
  }
}

How Refunds Work

  1. Check Balance: We verify sufficient funds (available balance + reserves)
  2. Deduct Funds:
    • First from available balance
    • Then from oldest active reserves if needed
  3. Process Refund: Funds returned to customer’s payment method
  4. Webhook Notification: refund.completed or refund.failed event sent
Refund processing typically takes 5-10 business days to appear on the customer’s statement.