Create a checkout session
Creates a new checkout session for a customer to proceed with a purchase or subscription.
Authorizations
The Server API Key obtained from the kelviq application. Pass as a Bearer token in the Authorization header. Example: 'Authorization: Bearer YOUR_API_KEY'
Body
The identifier of the specific plan the customer is checking out with.
"plan-pro-monthly"
The URL to which the user will be redirected after a successful checkout.
"https://kelviq.com/checkout/success"
The billing cycle for the subscription.
ONE_TIME, MONTHLY, YEARLY, WEEKLY, DAILY, TWENTY_EIGHT_DAYS, THREE_MONTHS, SIX_MONTHS "MONTHLY"
The customerId of the customer initiating the checkout. If omitted, Kelviq creates a new customer and generates a unique customerId. Multiple customer records can share the same email address, but every customerId must be unique.
"cust_789"
A list of features and their desired quantities. SDK documentation notes this as 'Required', but usage may vary based on examples.
The IP Address of the customer, used for location-based pricing.
"103.154.35.20"
The URL to which the user will be redirected if the payment is cancelled.
"https://kelviq.com/checkout/cancel"
A comma-separated list of plan identifiers to display on the checkout page.
"plan-pro-monthly,plan-pro-yearly"
The currency code for the checkout session (e.g. 'USD'). Required when customAmount is provided with a server API key.
"USD"
A custom amount to charge for this checkout session. When provided, taxBehavior is required. When using a server API key, currencyCode is also required.
2999
Specifies how taxes are applied to the custom amount. Required when customAmount is provided. INCLUSIVE means tax is included in the amount; EXCLUSIVE means tax is added on top.
INCLUSIVE, EXCLUSIVE "EXCLUSIVE"
Whether discount/coupon code entry is shown on the checkout page. Defaults to true.
false
A discount/coupon code to pre-apply to the checkout session. The code is applied only if it is active, unexpired, and valid for the selected plan; otherwise the request fails with an error.
"WELCOME20"
When true, the email field on the checkout page is pre-filled and locked so the customer cannot change it. Defaults to false.
true
ISO 3166-1 alpha-2 country code used to pre-fill the billing address country on the checkout page.
"US"
Arbitrary key-value pairs to attach to the checkout session. The keys are preserved verbatim and the object is returned unchanged on the checkout.completed webhook payload's metadata field.
Response
Checkout Session Created
The URL that the customer should be redirected to complete the payment.
"https://kelviq.com/checkout/cs_eeCGdGayc5oTMdGNV5XocfRk6o87K0vlwwCuKeiE7BLU9/"
The unique ID for the created checkout session.
"cs_eeCGdGayc5oTMdGNV5XocfRk6o87K0vlwwCuKeiE7BLU9"