Coupon
A Coupon defines a reusable discount you can apply to Checkout Sessions and PaymentIntents. Coupons can grant either a percentage off (`percentOff`) or a fixed amount off (`amountOff`), and can apply once, forever, or repeating for a number of billing cycles. You can also cap how many times a Coupon may be redeemed and when it expires. Coupons are the reusable template. Each concrete application of a Coupon to a customer's purchase is recorded as a Discount.
{
"id": "string",
"object": "coupon",
"createdAt": "string",
"discountType": "percentage",
"percentOff": 0,
"amountOff": 0,
"currency": "EGP",
"duration": "once",
"durationInMonths": 0,
"name": "string",
"maxDiscountAmount": 0,
"minValue": 0,
"maxRedemptions": 0,
"customerMaxRedemptions": 0,
"timesRedeemed": 0,
"redeemBy": "string",
"valid": true,
"active": true,
"appliesToProductIds": [
"string"
],
"metadata": {},
"merchantId": "string",
"livemode": true
}Checkout Session
A Checkout Session represents your customer's session as they pay on an xpay-hosted checkout page. Create a new Session each time a customer begins a checkout: attach line items, customer details, or a PaymentIntent, then redirect the customer to the Session's `url` to begin payment. As the customer progresses, the Session's `status` and `paymentStatus` update; once payment succeeds, the Session contains references to the resulting Customer and PaymentIntent. Sessions expire 24 hours after creation if not completed.
Customer
A Customer represents a buyer you do business with. Use Customers to save payment methods for reuse, track lifetime spend, attach metadata for your CRM, and group related Charges, Refunds, and Checkout Sessions under a single record. You can identify a Customer by their email or by a stable external ID from your own system and reference them on any future payment.