POST /v1/checkout/sessions, get back a payment URL, redirect your customer, and Flexprice activates the subscription once payment is confirmed.
Session lifecycle
Create a Checkout Session
payment_action.url. Each session has its own link. Do not reuse URLs across sessions.
Request fields
Other Checkout Actions
Four more actions exist, but they are not created through this endpoint. Each is triggered by adding acheckout object to the endpoint that owns the change, so that Flexprice can compute the amount and defer the change itself:
Passing any of these actions here returns a validation error naming the endpoint to use instead. Once created, all of them are read, cancelled, deleted, and monitored through the same endpoints and webhook events described on this page. See Pay-First Checkout.
Get a Checkout Session
checkout_status on your redirect pages before showing the customer a result.
Response (200):
Polling for the result
Reading a session that is stillinitiated or pending checks it against the payment provider and completes it if the customer has already paid, so a late or dropped webhook does not leave a paying customer waiting. Gateway calls are debounced, so reading in a tight loop does not add load. Poll until terminal is true, waiting next_poll_after_ms between reads.
A declined payment does not fail the session. The payment link stays live so the customer can retry, and the session remains
pending until the customer pays, the session reaches expires_at, or you cancel it.
Reconciliation on read applies to Razorpay sessions. Chargebee sessions reconcile through webhooks, and reads return stored state.
Cancel a Checkout Session
Cancel a session the customer has abandoned so that everything it was holding is released immediately instead of waiting forexpires_at.
GET /checkout/sessions/{id}, with terminal set to true. An active session comes back as expired. A session that had already failed or expired is returned unchanged, so checkout_status can also be failed.
Cancelling releases whatever the session was holding:
- Draft subscription: A subscription created behind the session is archived along with its addons, coupons, credit grants, and tax associations. A change deferred behind the session is never applied.
- Pending addon attachments: Addons attached behind the session are archived.
- Pending wallet top-up: The pending wallet transaction is marked failed, along with any pending bonus credit earned from the purchase.
- Payment and invoice: The payment and invoice created for the session are archived. If the invoice already holds customer value, such as applied prepaid credits, it is voided first so that value is returned.
Cancelling frees the session’s
idempotency_key for reuse.
Delete a Checkout Session
POST /checkout/sessions/{id}/cancel does, and then archives it. Sessions already in a terminal state (completed, failed, expired) are archived as is. Use cancel instead of delete when you still want to read the session’s final state afterwards.
Webhook events
Subscribe to these in Settings > Webhooks to drive fulfillment from your backend.Safe to receive the same event twice. If your payment provider delivers
payment_link.paid more than once, Flexprice ignores the duplicate. Your
webhook handler should also be idempotent for the same reason.Requirements
Customer must exist first. Thecustomer_external_id must refer to a customer already in Flexprice. Create them at sign-up if they don’t exist yet.
Plan must have a non-zero charge. Checkout requires a payable invoice amount to generate a payment link. Plans with only free or zero-amount charges will cause session creation to fail.
Idempotency on retry. An idempotency_key is reserved while its session is active, so retrying with the same key returns 409 rather than creating a duplicate. Read the open session with GET /checkout/sessions/{id} to recover its payment URL. Once the session reaches a terminal state the key can be reused.
Razorpay Setup
Configure the webhook events Razorpay needs to send Flexprice.
Implementation Guide
Full end-to-end integration with code examples.

