Payment Intent
A PaymentIntent tracks the full lifecycle of collecting one payment from your customer: from creation, through authorization and 3-D Secure, to capture and final outcome. We recommend creating one PaymentIntent per order: you can inspect its history of Charge attempts, watch its `status` as it transitions, and reference the successful Charge it ultimately produces. PaymentIntents are the object that the hosted Checkout and xpay.js drive on the client to complete a payment.
A PaymentIntent tracks the full lifecycle of collecting one payment from your customer: from creation, through authorization and 3-D Secure, to capture and final outcome. We recommend creating one PaymentIntent per order: you can inspect its history of Charge attempts, watch its status as it transitions, and reference the successful Charge it ultimately produces. PaymentIntents are the object that the hosted Checkout and xpay.js drive on the client to complete a payment.
{
"id": "pi_3MqAaCB4Otk1z2A30vXyz9aB",
"object": "payment_intent",
"checkoutSessionId": "cs_test_a1b2c3d4",
"checkoutSession": {
"id": "string",
"object": "checkout.session",
"createdAt": "string",
"updatedAt": "string",
"mode": "payment",
"uiMode": "hosted",
"submitType": "PAY",
"customerCreation": "always",
"status": "open",
"paymentStatus": "unpaid",
"currency": "EGP",
"amountSubtotal": 0,
"amountTotal": 0,
"totalDetails": {
"amountDiscount": 0,
"amountShipping": 0,
"amountTax": 0,
"amountPlatformFee": 0,
"amountCollectedVat": 0
},
"presentmentDetails": {
"amount": 80000,
"currency": "KWD",
"exchangeRate": 168.21,
"exchangeRateId": "exr_3gQWCqaDsihr09Fi5MfwXL",
"amountSubtotal": 100000,
"amountTotal": 80000,
"amountDiscount": 20000,
"amountCollectedVat": 11200,
"amountPlatformFee": 0,
"amountTax": 0
},
"afterCompletion": {},
"cancelUrl": "string",
"url": "string",
"clientSecret": "string",
"expiresAt": "string",
"customerId": "string",
"customer": {
"id": "string",
"type": "guest",
"name": "string",
"email": "string",
"phone": "string",
"address": {},
"shipping": {},
"metadata": {}
},
"customerDetails": {
"name": "string",
"email": "string",
"phone": "string",
"billingDetails": {},
"shipping": {}
},
"paymentIntentId": "string",
"lineItems": [
{}
],
"customFields": [
{
"dropdownOptions": []
}
],
"discounts": [
{}
],
"allowPromotionCodes": true,
"nameCollection": true,
"billingAddressCollection": true,
"shippingAddressCollection": true,
"phoneNumberCollection": true,
"feeConfig": {
"feesPassThrough": true,
"vatCollectionEnabled": true,
"vatCollectionRate": 0,
"source": "session"
},
"brandingSettings": {
"colorMode": "light",
"borderStyle": "rounded",
"spacing": "condensed",
"inputSize": "small",
"inputStyle": "flat",
"formLayout": "compact",
"colors": {},
"fontFamily": "string"
},
"locale": "en",
"paymentMethodTypes": [
{
"requiredCustomerFields": []
}
],
"paymentMethodConfigurationId": "string",
"fees": {
"paymentMethodType": "string",
"feeAmount": 0,
"feePercentage": 0,
"vatAmount": 0,
"totalAmount": 0,
"cardInfo": {}
},
"customerUpdate": {
"address": "auto",
"name": "auto",
"shipping": "auto"
},
"metadata": {},
"merchantId": "string",
"merchantName": "string",
"merchantLogo": "string",
"paymentLinkId": "string",
"livemode": true
},
"amount": 10000,
"amountCapturable": 0,
"amountReceived": 10000,
"currency": "EGP",
"status": "SUCCEEDED",
"createdAt": "2025-03-25T12:00:00.000Z",
"updatedAt": "2025-03-25T12:00:00.000Z",
"clientSecret": "pi_3MqAaCB4Otk1z2A30vXyz9aB_secret_xyz",
"captureMethod": "automatic",
"confirmationMethod": "automatic",
"description": "Order #1234",
"receiptEmail": "customer@example.com",
"canceledAt": "2025-03-25T12:00:00.000Z",
"shipping": {
"address": {
"city": "string",
"country": "string",
"line1": "string",
"line2": "string",
"postalCode": "string",
"state": "string"
},
"name": "Mohamed Ali",
"phone": "+20 100 123 4567"
},
"amountDetails": {
"productAmount": 10000,
"tax": {
"amount": 1400,
"rateBps": 1400
},
"platformFees": {
"amount": 500,
"vatAmount": 70
},
"tip": 1000,
"discount": 500
},
"presentmentDetails": {
"amount": 80000,
"currency": "KWD",
"exchangeRate": 168.21,
"exchangeRateId": "exr_3gQWCqaDsihr09Fi5MfwXL"
},
"latestCharge": {
"id": "string",
"object": "charge",
"amount": 0,
"amountCaptured": 0,
"amountRefunded": 0,
"currency": "EGP",
"createdAt": "2025-03-25T12:00:00.000Z",
"status": "string",
"paid": true,
"refunded": true,
"captured": true,
"capturedAt": "2025-03-25T12:00:00.000Z",
"failureCode": "string",
"failureMessage": "string",
"receiptUrl": "string",
"receiptEmail": "string",
"billingDetails": {
"address": {},
"email": "string",
"name": "string",
"phone": "string"
},
"paymentMethodDetails": {
"type": "string",
"card": {
"threeDSecure": {},
"wallet": {}
},
"valu": {}
},
"outcome": {
"networkStatus": "string",
"reason": "string",
"riskLevel": "string",
"riskScore": 0,
"sellerMessage": "string",
"type": "string"
},
"balanceTransaction": {
"id": "txn_abc123",
"object": "balance_transaction",
"amount": 22604,
"availableOn": "string",
"createdAt": "string",
"currency": "EGP",
"description": "string",
"fee": 912,
"net": 21692,
"feeDetails": [
{}
],
"status": "AVAILABLE",
"type": "CHARGE",
"reportingCategory": "string",
"exchangeRate": 0,
"source": "string",
"payoutBatch": {},
"paymentIntentId": "string",
"merchantId": "string"
},
"presentmentDetails": {
"amount": 80000,
"currency": "KWD",
"exchangeRate": 168.21,
"exchangeRateId": "exr_3gQWCqaDsihr09Fi5MfwXL"
},
"refunds": [
{}
],
"paymentIntentId": "string",
"paymentMethodId": "string",
"calculatedStatementDescriptor": "string",
"disputed": true,
"externalChargeId": "string",
"config": {
"vatCollectionEnabled": true,
"vatCollectionRate": 0,
"collectedVatAmount": 0,
"platformFeePassThrough": true,
"merchantFeeDeduction": 0
},
"geocoding": {
"ipAddress": "string",
"location": {}
},
"session": {
"browser": "string",
"browserVersion": "string",
"platform": "string",
"device": "string",
"deviceVendor": "string",
"deviceModel": "string"
},
"merchantOrigin": "https://shop.merchant.com",
"merchantDomain": "merchant.com",
"processorCapabilities": {
"supportsRefund": true,
"supportsPartialRefund": true
},
"activeHoldId": "hld_xxx",
"settlementModel": "aggregated"
},
"charges": [
{
"id": "string",
"object": "charge",
"amount": 0,
"amountCaptured": 0,
"amountRefunded": 0,
"currency": "EGP",
"createdAt": "2025-03-25T12:00:00.000Z",
"status": "string",
"paid": true,
"refunded": true,
"captured": true,
"capturedAt": "2025-03-25T12:00:00.000Z",
"failureCode": "string",
"failureMessage": "string",
"receiptUrl": "string",
"receiptEmail": "string",
"billingDetails": {
"address": {}
},
"paymentMethodDetails": {
"card": {},
"valu": {}
},
"outcome": {},
"balanceTransaction": {
"feeDetails": [],
"payoutBatch": {}
},
"presentmentDetails": {},
"refunds": [
{}
],
"paymentIntentId": "string",
"paymentMethodId": "string",
"calculatedStatementDescriptor": "string",
"disputed": true,
"externalChargeId": "string",
"config": {},
"geocoding": {
"location": {}
},
"session": {},
"merchantOrigin": "https://shop.merchant.com",
"merchantDomain": "merchant.com",
"processorCapabilities": {},
"activeHoldId": "hld_xxx",
"settlementModel": "aggregated"
}
],
"paymentMethod": {
"id": "string",
"object": "string",
"card": {
"brand": "string",
"country": "string",
"displayBrand": "string",
"expMonth": 0,
"expYear": 0,
"fingerprint": "string",
"funding": "string",
"last4": "string",
"networks": {},
"regulatedStatus": "string",
"threeDSecureUsage": {},
"wallet": {}
},
"valu": {
"loanNumber": "string",
"tenure": 0,
"emi": "string",
"downPayment": "string",
"financedAmount": "string",
"firstEmiDueDate": "string",
"lastInstallmentDate": "string"
},
"billingDetails": {
"address": {},
"email": "string",
"name": "string",
"phone": "string"
},
"type": "card",
"createdAt": "2025-03-25T12:00:00.000Z"
},
"customer": {
"id": "cus_abc123",
"name": "Mohamed Ali",
"email": "customer@example.com",
"phone": "+20 100 123 4567"
},
"nextAction": {
"type": "redirect_to_url",
"redirectToUrl": {
"url": "https://hooks.xpay.app/3ds/redirect/abc123",
"returnUrl": "https://example.com/checkout/return"
}
},
"metadata": {
"orderId": "1234",
"channel": "web"
},
"lastPaymentError": {
"code": "card_declined",
"declineCode": "insufficient_funds",
"networkDeclineCode": "string",
"docUrl": "https://docs.xpay.app/integrate/errors/decline-codes#insufficient_funds",
"message": "Your card has insufficient funds. Please try a different card.",
"merchantMessage": "string",
"adviceCode": "confirm_card_data",
"param": "string",
"chargeId": "ch_3MqAaCB4Ot...",
"paymentMethod": {},
"paymentMethodType": "card",
"type": "card_error",
"processorCode": "string",
"processorMessage": "string"
}
}Discount
A Discount records a single application of a Coupon to a specific Checkout Session, PaymentIntent, or Customer. Where a Coupon is the reusable template, a Discount captures the concrete redemption: which Coupon was applied, when it became active, when it expires, and (when applicable) which Promotion Code the customer entered to claim it.
Payment Link
A Payment Link is a shareable URL you can send to a customer to collect a single payment or set up a subscription, without writing any checkout code. Open the URL in any browser and we render the hosted checkout, collect payment details, and process the payment. Use Payment Links for one-off invoices, social-media checkout, in-person QR codes, or anywhere you need a checkout page without integrating the SDK.