Create a checkout session
Creates a new checkout session for hosted or embedded checkout. Returns a session with a URL to redirect customers for payment.
Creates a new checkout session for hosted or embedded checkout. Returns a session with a URL to redirect customers for payment.
Authorization
api-key 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
curl -X POST "https://example.com/checkout/sessions" \ -H "Content-Type: application/json" \ -d '{ "afterCompletion": { "type": "redirect", "redirect": { "url": "https://example.com/success?session_id={CHECKOUT_SESSION_ID}" } } }'{ "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": { "url": "string" }, "hostedConfirmation": { "customMessage": "string", "returnUrl": "string" } }, "cancelUrl": "string", "url": "string", "clientSecret": "string", "expiresAt": "string", "isExpired": true, "customerId": "string", "customer": { "id": "string", "type": "guest", "name": "string", "email": "string", "phone": "string", "address": { "city": "string", "country": "string", "line1": "string", "line2": "string", "postalCode": "string", "state": "string" }, "shipping": { "name": "string", "phone": "string", "address": {} }, "metadata": { "property1": null, "property2": null } }, "customerDetails": { "name": "string", "email": "string", "phone": "string", "billingDetails": { "name": "string", "email": "string", "phone": "string", "address": {} }, "shipping": { "name": "string", "phone": "string", "address": {} } }, "paymentIntentId": "string", "lineItems": [ { "id": "string", "quantity": 0, "price": {}, "adjustableQuantity": {}, "amountSubtotal": 0, "amountTotal": 0, "amountDiscount": 0, "amountTax": 0, "currency": "EGP", "description": "string", "presentmentDetails": {}, "availability": "available" } ], "customFields": [ { "key": "string", "label": "string", "type": "TEXT", "isOptional": true, "hasLimits": true, "limitType": "AT_MOST", "minCharacters": 0, "maxCharacters": 0, "dropdownOptions": [ null ], "text": {}, "numeric": {}, "dropdown": {} } ], "discounts": [ { "id": "string", "object": "discount", "coupon": { "appliesToProductIds": [], "metadata": {} }, "promotionCodeId": "string", "promotionCodeCode": "string", "checkoutSessionId": "string", "customerId": "string", "start": "string", "end": "string" } ], "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": { "primary": "string", "primaryForeground": "string", "background": "string", "foreground": "string", "border": "string", "input": "string", "ring": "string", "muted": "string", "mutedForeground": "string", "accent": "string", "accentForeground": "string", "destructive": "string" }, "fontFamily": "string" }, "locale": "en", "paymentMethodTypes": [ { "type": "string", "displayName": "string", "category": "string", "minTransactionAmount": "string", "maxTransactionAmount": "string", "requiredCustomerFields": [ null ], "supportsRefund": true, "supportsPartialRefund": true, "supportsPartialCapture": true, "paymentConfirmation": "string" } ], "paymentMethodConfigurationId": "string", "fees": { "paymentMethodType": "string", "feeAmount": 0, "feePercentage": 0, "vatAmount": 0, "totalAmount": 0, "cardInfo": { "brand": "string", "isOnUs": true, "isInternational": true } }, "customerUpdate": { "address": "auto", "name": "auto", "shipping": "auto" }, "metadata": { "property1": null, "property2": null }, "merchantId": "string", "merchantName": "string", "merchantLogo": "string", "paymentLinkId": "string", "livemode": true, "paymentIntent": { "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": {}, "name": "string", "phone": "string" }, "amountDetails": { "productAmount": 0, "tax": {}, "platformFees": {}, "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": {}, "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" }, "charges": [ { "refunds": [] } ], "paymentMethod": { "id": "string", "object": "payment_method", "card": { "networks": {} }, "valu": {}, "fawry": {}, "billingDetails": {}, "type": "card", "createdAt": "2019-08-24T14:15:22Z" }, "customer": { "id": "string", "name": "string", "email": "string", "phone": "string" }, "nextAction": { "type": "redirect_to_url", "redirectToUrl": {}, "displayVoucherDetails": {} }, "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": {}, "paymentMethodType": "string", "type": "api_error", "processorCode": "string", "processorMessage": "string" } }}Retrieve account GET
Returns the account for the authenticated key: merchant id, display profile, chargeable currencies grouped by payment method type, live activation status, and the key's own type, mode, and permissions. Works with any secret or restricted key, and requires no specific permission. Publishable keys are refused.
Retrieve a checkout session GET
Retrieves an existing checkout session by ID. Returns full session data including clientSecret.