التوثيق

Create a refund

Creates a full or partial refund for a successful charge. Target: provide EXACTLY ONE of `chargeId` or `paymentIntentId`. When `paymentIntentId` is supplied the server resolves it to the unique succeeded charge under that intent; the request is rejected if the intent has zero or multiple succeeded charges. Features: - Full or partial refunds - Ledger reversal (double-entry bookkeeping) - Balance updates (debits available funds) - Updates `charge.amountRefunded` - Updates `paymentIntent.amountRefunded` Refund behaviour: - Hits available balance immediately (no hold period) - Creates negative balance transactions - Reverses the original charge's ledger entries - Platform keeps fees (business decision)

POST
/refunds

Creates a full or partial refund for a successful charge.

Target: provide EXACTLY ONE of chargeId or paymentIntentId. When paymentIntentId is supplied the server resolves it to the unique succeeded charge under that intent; the request is rejected if the intent has zero or multiple succeeded charges.

Features:

  • Full or partial refunds
  • Ledger reversal (double-entry bookkeeping)
  • Balance updates (debits available funds)
  • Updates charge.amountRefunded
  • Updates paymentIntent.amountRefunded

Refund behaviour:

  • Hits available balance immediately (no hold period)
  • Creates negative balance transactions
  • Reverses the original charge's ledger entries
  • Platform keeps fees (business decision)
AuthorizationBearer <token>

API key for merchant integrations. Send as Authorization: Bearer <your key>.

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

application/json

application/json

application/json

curl -X POST "https://example.com/refunds" \  -H "Content-Type: application/json" \  -d '{}'
{  "id": "string",  "object": "refund",  "amount": 0,  "chargeId": "string",  "paymentIntentId": "string",  "balanceTransactionId": "string",  "failureBalanceTransactionId": "string",  "externalRefundId": "string",  "createdAt": "2019-08-24T14:15:22Z",  "currency": "EGP",  "presentmentDetails": {    "amount": 0,    "currency": "EGP",    "exchangeRate": 0,    "exchangeRateId": "string"  },  "status": "PENDING",  "reason": "DUPLICATE",  "failureReason": "lost_or_stolen_card",  "failureCode": "string",  "failureMessage": "string",  "pendingReason": "processing",  "description": "string",  "destinationDetails": {    "type": "card",    "card": {      "reference": "string",      "referenceStatus": "pending",      "referenceType": "string",      "type": "pending"    },    "wallet": {      "reference": "string",      "provider": "string"    },    "bankTransfer": {      "reference": "string",      "referenceStatus": "pending"    },    "kiosk": {      "reference": "string",      "provider": "string"    }  },  "nextAction": {    "type": "display_details",    "displayDetails": {      "emailSentAt": "2019-08-24T14:15:22Z",      "emailSentTo": "string",      "expiresAt": "2019-08-24T14:15:22Z"    }  },  "instructionsEmail": "string",  "receiptNumber": "string",  "feeAmount": 0}