Refund
A Refund returns funds from a successful Charge back to the customer's original payment method. Refunds can be full or partial, and a single Charge can be refunded multiple times up to its original amount. The Refund's `status` reflects the processor's progress as the money makes its way back: `pending` while in flight, `succeeded` once the funds have been returned, or `failed` if the processor rejected the request.
A Refund returns funds from a successful Charge back to the customer's original payment method. Refunds can be full or partial, and a single Charge can be refunded multiple times up to its original amount. The Refund's status reflects the processor's progress as the money makes its way back: pending while in flight, succeeded once the funds have been returned, or failed if the processor rejected the request.
{
"id": "re_abc123",
"object": "refund",
"amount": 50000,
"chargeId": "ch_xyz789",
"paymentIntentId": "pi_xyz789",
"balanceTransactionId": "string",
"failureBalanceTransactionId": "string",
"externalRefundId": "string",
"createdAt": "2025-03-25T12:00:00.000Z",
"currency": "EGP",
"presentmentDetails": {
"amount": 80000,
"currency": "KWD",
"exchangeRate": 168.21,
"exchangeRateId": "exr_3gQWCqaDsihr09Fi5MfwXL"
},
"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": "string",
"displayDetails": {
"emailSentAt": "string",
"emailSentTo": "string",
"expiresAt": "string"
}
},
"instructionsEmail": "string",
"receiptNumber": "string",
"feeAmount": 0
}Promotion Code
A Promotion Code is a customer-facing alphanumeric code (for example `SUMMER25`) that maps to a single Coupon. One Coupon can have many Promotion Codes, letting you run different campaigns (email vs. social, customer-specific codes, regional codes, …) against the same underlying discount. Customers enter the code at checkout to redeem the Coupon's discount. Promotion Codes can carry their own restrictions on top of the Coupon — a per-code redemption cap, an expiry date, or a binding to a specific Customer. You receive `promotion_code.created` and `promotion_code.updated` webhook events whenever a code is created or modified.
Webhook Endpoint
A webhook endpoint is a URL on your server where XPay sends event notifications, such as a payment succeeding or a refund completing. Each endpoint has a signing secret you use to verify that a delivery really came from XPay, and a list of enabled events that controls which notifications it receives. If deliveries to an endpoint keep failing, the endpoint is disabled automatically and its status changes to `disabled`.