التوثيق

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": "string",  "object": "payment_intent",  "checkoutSessionId": "string",  "amount": 0,  "amountCapturable": 0,  "amountReceived": 0,  "currency": "EGP",  "status": "REQUIRES_PAYMENT_METHOD",  "createdAt": "string",  "updatedAt": "string",  "clientSecret": "string",  "captureMethod": "string",  "confirmationMethod": "string",  "description": "string",  "receiptEmail": "string",  "canceledAt": "string",  "shipping": {    "address": {      "city": "string",      "country": "string",      "line1": "string",      "line2": "string",      "postalCode": "string",      "state": "string"    },    "name": "string",    "phone": "string"  },  "amountDetails": {    "productAmount": 0,    "tax": {      "amount": 0,      "rateBps": 0    },    "platformFees": {      "amount": 0,      "vatAmount": 0    },    "tip": 0,    "discount": 0  },  "presentmentDetails": {    "amount": 0,    "currency": "EGP",    "exchangeRate": 0,    "exchangeRateId": "string"  },  "latestCharge": {    "id": "string",    "object": "charge",    "amount": 0,    "amountCaptured": 0,    "amountRefunded": 0,    "currency": "EGP",    "createdAt": "2019-08-24T14:15:22Z",    "status": "SUCCEEDED",    "paid": true,    "refunded": true,    "captured": true,    "capturedAt": "2019-08-24T14:15:22Z",    "failureCode": "string",    "failureMessage": "string",    "receiptUrl": "string",    "receiptEmail": "string",    "billingDetails": {      "address": {},      "email": "string",      "name": "string",      "phone": "string"    },    "paymentMethodDetails": {      "type": "string",      "card": {},      "valu": {},      "fawry": {}    },    "outcome": {      "networkStatus": "string",      "reason": "string",      "riskLevel": "string",      "riskScore": 0,      "sellerMessage": "string",      "type": "string"    },    "balanceTransaction": {      "id": "string",      "object": "balance_transaction",      "amount": 0,      "availableOn": "2019-08-24T14:15:22Z",      "createdAt": "2019-08-24T14:15:22Z",      "currency": "EGP",      "description": "string",      "fee": 0,      "net": 0,      "feeDetails": [        null      ],      "status": "AVAILABLE",      "type": "CHARGE",      "reportingCategory": "string",      "exchangeRate": 0,      "source": "string",      "payoutBatch": {},      "paymentIntentId": "string",      "merchantId": "string"    },    "presentmentDetails": {      "amount": 0,      "currency": "EGP",      "exchangeRate": 0,      "exchangeRateId": "string"    },    "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": "string",    "merchantDomain": "string",    "processorCapabilities": {      "supportsRefund": true,      "supportsPartialRefund": true    },    "activeHoldId": "string",    "settlementModel": "aggregated"  },  "charges": [    {      "id": "string",      "object": "charge",      "amount": 0,      "amountCaptured": 0,      "amountRefunded": 0,      "currency": "EGP",      "createdAt": "2019-08-24T14:15:22Z",      "status": "SUCCEEDED",      "paid": true,      "refunded": true,      "captured": true,      "capturedAt": "2019-08-24T14:15:22Z",      "failureCode": "string",      "failureMessage": "string",      "receiptUrl": "string",      "receiptEmail": "string",      "billingDetails": {},      "paymentMethodDetails": {},      "outcome": {},      "balanceTransaction": {        "feeDetails": []      },      "presentmentDetails": {},      "refunds": [        null      ],      "paymentIntentId": "string",      "paymentMethodId": "string",      "calculatedStatementDescriptor": "string",      "disputed": true,      "externalChargeId": "string",      "config": {},      "geocoding": {},      "session": {},      "merchantOrigin": "string",      "merchantDomain": "string",      "processorCapabilities": {},      "activeHoldId": "string",      "settlementModel": "aggregated"    }  ],  "paymentMethod": {    "id": "string",    "object": "payment_method",    "card": {      "brand": "string",      "country": "string",      "displayBrand": "string",      "expMonth": 0,      "expYear": 0,      "fingerprint": "string",      "funding": "string",      "last4": "string",      "networks": {        "available": []      },      "regulatedStatus": "string",      "threeDSecureUsage": {},      "wallet": {}    },    "valu": {      "loanNumber": "string",      "tenure": 0,      "emi": "string",      "downPayment": "string",      "financedAmount": "string",      "firstEmiDueDate": "string",      "lastInstallmentDate": "string"    },    "fawry": {      "fawryRefNumber": "string",      "paymentReferenceNumber": "string",      "paymentMethod": "string",      "paymentTime": 0,      "expiresAt": "2019-08-24T14:15:22Z"    },    "billingDetails": {      "address": {},      "email": "string",      "name": "string",      "phone": "string"    },    "type": "card",    "createdAt": "2019-08-24T14:15:22Z"  },  "customer": {    "id": "string",    "name": "string",    "email": "string",    "phone": "string"  },  "nextAction": {    "type": "redirect_to_url",    "redirectToUrl": {      "url": "string",      "returnUrl": "string"    },    "displayVoucherDetails": {      "provider": "string",      "reference": "string",      "expiresAt": "2019-08-24T14:15:22Z",      "instructions": "string",      "hostedVoucherUrl": "string"    }  },  "metadata": {    "property1": null,    "property2": null  },  "lastPaymentError": {    "code": "string",    "declineCode": "string",    "networkDeclineCode": "string",    "docUrl": "string",    "message": "string",    "merchantMessage": "string",    "adviceCode": "confirm_card_data",    "param": "string",    "chargeId": "string",    "paymentMethod": {      "id": "string",      "type": "string",      "card": {},      "billingDetails": {}    },    "paymentMethodType": "string",    "type": "api_error",    "processorCode": "string",    "processorMessage": "string"  },  "checkoutSession": {    "id": "string",    "object": "checkout.session",    "createdAt": "string",    "updatedAt": "string",    "mode": "payment",    "uiMode": "hosted",    "submitType": "PAY",    "customerCreation": "always",    "status": "open",    "paymentStatus": "paid",    "currency": "EGP",    "amountSubtotal": 0,    "amountTotal": 0,    "totalDetails": {      "amountDiscount": 0,      "amountShipping": 0,      "amountTax": 0,      "amountPlatformFee": 0,      "amountCollectedVat": 0    },    "presentmentDetails": {      "amount": 0,      "currency": "EGP",      "exchangeRate": 0,      "exchangeRateId": "string",      "amountSubtotal": 0,      "amountTotal": 0,      "amountDiscount": 0,      "amountCollectedVat": 0,      "amountPlatformFee": 0,      "amountTax": 0    },    "afterCompletion": {      "type": "redirect",      "redirect": {},      "hostedConfirmation": {}    },    "cancelUrl": "string",    "url": "string",    "clientSecret": "string",    "expiresAt": "string",    "isExpired": true,    "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": {      "property1": null,      "property2": null    },    "merchantId": "string",    "merchantName": "string",    "merchantLogo": "string",    "paymentLinkId": "string",    "livemode": true  }}