This endpoint creates a new checkout session for subscribing to a plan or purchasing a product. It returns a checkout URL that redirects users to complete payment.
curl -X POST "https://frontier.example.com/v1beta1/organizations/{org_id}/billing/{billing_id}/checkouts" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"subscription_body": {
"plan": "plan_123",
"skip_trial": false,
"cancel_after_trial": false
},
"success_url": "https://acme.com/success",
"cancel_url": "https://acme.com/cancel"
}'
{
"checkout_session" : {
"id" : "checkout_123" ,
"checkout_url" : "https://checkout.stripe.com/c/pay/cs_test_123" ,
"success_url" : "https://acme.com/success" ,
"cancel_url" : "https://acme.com/cancel" ,
"state" : "open" ,
"plan" : "plan_123" ,
"created_at" : "2023-06-07T05:39:56.961Z" ,
"updated_at" : "2023-06-07T05:39:56.961Z" ,
"expire_at" : "2023-06-07T06:39:56.961Z"
}
}
Checkout Options
Subscription configuration for the checkout session. Skip the trial period (default: false)
Cancel subscription after trial ends (default: false)
Product configuration for one-time purchase. Quantity to purchase (default: 1)
Setup configuration for payment method or customer portal. Create setup session for adding payment method
Create session for customer portal access
URL to redirect to after successful checkout
URL to redirect to if checkout is cancelled