Create a new checkout session. Supports two modes: subscription (start a recurring plan) and credit_bundle (one-time credit pack purchase). Pass the returned checkout_session_token to the @lavapayments/checkout SDK to open the checkout flow.
Bearer token authentication used for standard API calls. Format: 'Bearer YOUR_API_KEY'
Checkout mode: 'subscription' creates a recurring subscription checkout, 'credit_bundle' purchases a credit pack for an existing subscriber
subscription, credit_bundle "subscription"
Origin url where the checkout will be opened
"https://your-app.example.com/"
Required for credit_bundle mode. Optional for subscription mode — omit for new customers (checkout collects identity and creates a customer) or include for returning customers (reuses the existing customer).
"con_test_01KKM3W4FS7GF0QBJ4YYHNPS2C"
Required when checkout_mode is 'subscription' - identifies the plan to use
"sc_123"
Required when checkout_mode is 'credit_bundle' - identifies the credit bundle to purchase
"cb_abc123"
Checkout session created
Unique identifier for the checkout session
"cs_test_01KKM3W4FRAEX8BER19F06YW4K"
Opaque token for the @lavapayments/checkout SDK. Pass this to open() to launch the checkout flow.
"eyJzZWNyZXQiOiJjc3NfdGVzdF9GNHFEQnVYM1FzSGUtTnVuaXJoZGlFR0NubjRFR3dCNUVuUXFZSEwyLVdzLXhyMUNWRFJzMS0xIiwiYmFzZSI6Imh0dHBzOi8vd3d3LmxhdmEuc28vIn0="
Checkout mode: 'subscription' creates a recurring subscription checkout, 'credit_bundle' purchases a credit pack for an existing subscriber
subscription, credit_bundle "subscription"
Origin url where the checkout will be opened
"https://your-app.example.com/"
ISO 8601 timestamp when the checkout session was created
"2023-05-15T08:30:00Z"
Identifier for the customer (only available after checkout completion)
"con_test_01KKM3W4FSP0AMHJSB8A4V9BPM"
Identifier for the plan (only available for subscription mode)
"sc_123"
If completed, ISO 8601 timestamp when the checkout was completed
"2023-05-15T08:35:42Z"