API Reference

A Checkout Session represents your customer's session as they pay for one-time purchases or subscriptions through Checkout. We recommend creating a new Session each time your customer attempts to pay.

You can create a Checkout Session on your server and pass its ID to the client to begin Checkout.

Related guide: Checkout Quickstart.

Checkout Session Object

{
  "id": "cs_a1U7SSk86e6DUcjD9Zg7c26WqxP13PEG0pIt2TvAGPmyK9kDnD4kGR4tri",
  "object": "checkout.session",
  "amount_total": 10.99,
  "cancel_url": "https://example.com/cancel",
  "created": 1671995248,
  "expires_at": 1671995248,
  "status": "expired",
  "success_url": "https://example.com/success",
  "url": "https://fanspay.io/checkout/cs_a1U7SSk86e6DUcjD9Zg7c26WqxP13PEG0pIt2TvAGPmyK9kDnD4kGR4tri",
  "transaction_status": "unconfirmed",
  "type": "payment"
}

Attributes

AttributeTypeDescription
idstringUnique identifier for the object.
objectstringA string representing the object’s type. Objects of the same type share the same value.
amount_totalnumberTotal of all items after discounts and taxes are applied.
cancel_urlstringIf set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel the payment and return to your website.
creatednumberTime at which the object was created. Measured in seconds since the Unix epoch.
expires_atnumberThe time at which the Checkout Session will expire. Measured in seconds since the Unix epoch.
statusstringThe status of the Checkout Session is one of open, completed, or expired.
success_urlstringThe URL the customer will be directed to after the payment or subscription creation is successful.
transaction_statusstringThe transaction status of the Checkout Session is one of confirmed, or unconfirmed. You can use this value to decide when to fulfill your customer’s order.
typestringThe type of Checkout Session is one of payment, subscription, or donation.
urlstringThe URL at which the user has to make the payment.