Checkout Sessions
A Checkout Session creates a payment page hosted on
checkout.sangho.ga. Your customer is redirected to this
page, completes their payment there, and is then sent back to your success_url. You never handle payment data directly —
Sangho takes care of it.
This is the recommended integration for e-commerce sites and web applications: zero PCI DSS scope on your side, customizable to your brand colors from your dashboard.
Lifecycle
| Status | Meaning |
|---|---|
open | Session created — payment page accessible. |
processing | Payment submitted, processing in progress. |
complete | Payment successful — customer redirected to success_url. |
expired | Session expired without payment (deadline passed or /expire/ called). |
payment_failed | Payment attempt failed — session remains open for retry. |
Modes
| Mode | Usage |
|---|---|
payment | One-time payment — standard flow. Creates a PaymentIntent. |
subscription | Recurring subscription. Creates a Subscription. |
setup | Saves a payment method without an immediate charge. |
Endpoints
| Méthode | Endpoint | Description |
|---|---|---|
| POST | /checkout-sessions/ | Create a session |
| GET | /checkout-sessions/ | List sessions |
| GET | /checkout-sessions/{id}/ | Retrieve a session |
| POST | /checkout-sessions/{id}/expire/ | Manually expire a session |
Object schema
Create a Checkout Session
Creates a payment session and returns the URL of the hosted payment page
(url). Redirect your customer to this URL immediately.
success_urlRequisRedirect URL after a successful payment. Sangho automatically replaces {CHECKOUT_SESSION_ID} with the session ID — use it
to verify the payment server-side.
Always verify server-side that the session is indeed in complete status before delivering the product or service.
Never trust the redirect alone — a user could manipulate the URL.
line_itemsRequisOrder line items. Each object contains product (ID) or
description + unit_amount,
plus quantity (integer, default 1).
For Products with a free-form price (price_type: free),
you must provide the unit_amount in the line item to
override the default price. Maximum 20 line items per session.
currencyRequisCurrency code for the session. All line items are billed in this currency.
modeOptionnelSession mode: payment,
subscription, or setup.
En savoir plus
In subscription mode, the session creates a Subscription object and
charges the customer according to the plan’s recurrence. In setup mode, no charge is made — the method is saved for
future use.
customerOptionnelID of an existing Customer to associate with the session. The payment page is pre-filled with their information.
En savoir plus
Mutually exclusive with customer_email. If neither is
provided, Sangho creates an anonymous Customer at the time of payment if collect_customer_info: true.
customer_emailOptionnelEmail pre-filled in the payment page form. Sangho automatically creates or finds the corresponding Customer.
cancel_urlOptionnelRedirect URL if the buyer clicks “Cancel” or closes the payment page.
En savoir plus
If not provided, a generic back button is displayed. Recommended: point to the cart or the product page to reduce abandonment.
payment_method_typesOptionnelPayment methods offered on the checkout page. If omitted, all of the App’s active methods are available.
expires_inOptionnelValidity duration of the session in seconds from its creation.
En savoir plus
Minimum: 300 seconds (5 min). Maximum: 86,400 seconds (24h). Past this delay, the
payment page displays an expiration message and the session moves to expired. An expired session cannot be reactivated —
create a new one.
metadataOptionnelFree-form data associated with the session. Returned in the checkout.session.completed webhook.
After redirecting to success_url, always call GET /checkout-sessions/{id}/ server-side to confirm
that status === ‘complete’ before delivering your product.
Never grant delivery based on the URL redirect alone.