POST /v1/checkout/sessions, get back a payment URL, redirect your customer, and Flexprice activates the subscription once payment is confirmed.
Session lifecycle
| Status | Meaning |
|---|---|
initiated | Session created; payment provider call in progress |
pending | Payment URL returned; awaiting customer payment |
completed | Payment confirmed; subscription activated, invoice finalized |
failed | Payment failed or provider cancelled the link |
expired | Session timed out without payment |
Create a Checkout Session
payment_action.url. Each session has its own link. Do not reuse URLs across sessions.
Request fields
| Field | Required | Description |
|---|---|---|
customer_external_id | Yes | Your identifier for the customer. Must already exist in Flexprice. |
action | Yes | Billing action to perform. create_subscription is supported. |
payment_provider | Yes | Payment gateway to use. See Choose your provider. |
configuration.create_subscription_params.plan_id | Yes | The plan to subscribe the customer to. |
configuration.create_subscription_params.currency | Yes | Billing currency (e.g., INR, USD). |
configuration.create_subscription_params.billing_period | No | monthly, quarterly, annual, etc. Defaults to the plan’s period. |
configuration.create_subscription_params.start_date | No | Subscription start date. Defaults to now. |
success_url | No | Where to redirect after successful payment. |
failure_url | No | Where to redirect after a failed payment. |
cancel_url | No | Where to redirect if the customer cancels. |
idempotency_key | No | Prevents duplicate sessions on retry. A duplicate key for an active session returns 409. |
Get a Checkout Session
checkout_status on your redirect pages before showing the customer a result.
Delete a Checkout Session
completed, failed, expired) cannot be deleted.
Webhook events
Subscribe to these in Settings > Webhooks to drive fulfillment from your backend.| Event | Fired when |
|---|---|
checkout.session.initiated | Session created and payment URL returned |
checkout.session.completed | Payment confirmed; subscription active, invoice finalized |
checkout.session.failed | Payment failed or provider cancelled |
checkout.session.expired | Session timed out without payment |
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. If your create call times out, retry with the same idempotency_key. You’ll get back the existing session instead of a duplicate.
Razorpay Setup
Configure the webhook events Razorpay needs to send Flexprice.
Implementation Guide
Full end-to-end integration with code examples.

