Create Checkout Session
Intent
Creates a checkout session from the values supplied in the request.
When to call it
Call this when your application has collected the required values and is ready to create a checkout session.
Access boundary
Authorize the request with a token that carries checkouts:write.
Successful result
A successful request returns 201. The response schema below defines the body your integration receives.
Authorizations
Body
Create a new checkout session from a list of products. Customers will be able to switch between those products.
Metadata set on the checkout will be copied to the resulting order and/or subscription.
Collection of product IDs available to select at that checkout. The first one will be selected by default.
1Unit used to measure the trial period.
day, week, month, year Length of the trial measured in the selected interval.
1 <= x <= 1000Metadata map for information your integration needs to retain.
The key must be a string with a maximum length of 40 characters. The value must be either:
- A string with a maximum length of 500 characters
- An integer
- A floating-point number
- A boolean
You can store up to 50 key-value pairs.
Map containing values collected through custom fields.
Identifier of the discount to apply to the checkout.
Indicates whether to allow the customer to apply discount codes. If you apply a discount through discount_id, it'll still be applied, but the customer won't be able to change it.
Indicates whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to true.
Amount: Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices.
x >= 0Seats: Predefined number of seats (works with seat-based pricing only).
1 <= x <= 10000Min Seats: Minimum number of seats (works with seat-based pricing only).
1 <= x <= 10000Max Seats: Maximum number of seats (works with seat-based pricing only).
1 <= x <= 10000Indicates whether to enable the trial period for the checkout session. If false, the trial period will be disabled, even if the selected product has a trial configured.
Identifier of an existing customer in the organization. The customer data will be pre-filled in the checkout form. The resulting order will be linked to this customer.
Indicates whether the customer is a business or an individual. If true, the customer will be required to fill their full billing address and billing name.
Identifier of the customer in your system. If a matching customer exists on Ruba, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set.
Name assigned to the customer.
256"John Doe"
Email used to identify and contact the customer.
Customer address used for billing and tax calculations.
Metadata map for information your integration needs to retain that'll be copied to the created customer.
The key must be a string with a maximum length of 40 characters. The value must be either:
- A string with a maximum length of 500 characters
- An integer
- A floating-point number
- A boolean
You can store up to 50 key-value pairs.
Identifier of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten.
Success Url: URL where the customer will be redirected after a successful payment.You can add the checkout_id={CHECKOUT_ID} query parameter to retrieve the checkout session id.
1 - 2083If provided, a back button will be shown in the checkout to return to this URL.
1 - 2083Embed Origin: If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Ruba iframe to communicate with the parent page.
Locale: Locale of the customer, given as an IETF BCP 47 language tag. Supported: language code (e.g. en) or language + region (e.g. en-US). If null or unsupported, the locale will default to en.
^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-[0-9]{3})?$"en"
aed, all, amd, aoa, ars, aud, awg, azn, bam, bbd, bdt, bif, bmd, bnd, bob, brl, bsd, bwp, bzd, cad, cdf, chf, clp, cny, cop, crc, cve, czk, djf, dkk, dop, dzd, egp, etb, eur, fjd, fkp, gbp, gel, gip, gmd, gnf, gtq, gyd, hkd, hnl, htg, huf, idr, ils, inr, isk, jmd, jpy, kes, kgs, khr, kmf, krw, kyd, kzt, lak, lkr, lrd, lsl, mad, mdl, mga, mkd, mnt, mop, mur, mvr, mwk, mxn, myr, mzn, nad, ngn, nio, nok, npr, nzd, pab, pen, pgk, php, pkr, pln, pyg, qar, ron, rsd, rwf, sar, sbd, scr, sek, sgd, shp, sos, srd, szl, thb, tjs, top, try, ttd, twd, tzs, uah, ugx, usd, uyu, uzs, vnd, vuv, wst, xaf, xcd, xcg, xof, xpf, yer, zar, zmw 3Prices: Optional mapping of product IDs to a list of ad-hoc prices to create for that product. If not set, catalog prices of the product will be used.
Response
Response: Checkout session created.
Checkout session data retrieved using an access token.
The stable identifier for this record.
The time Ruba created this record.
The time this record last changed.
Payment Processor: Payment processor used.
stripe Status of the checkout session.
open, expired, confirmed, succeeded, failed Client Secret: Client secret used to update and complete the checkout session from the client.
Url: URL where the customer can access the checkout session.
Expires At: Expiration date and time of the checkout session.
Success Url: URL where the customer will be redirected after a successful payment.
If provided, a back button will be shown in the checkout to return to this URL.
Embed Origin: When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page.
Amount: Amount in cents, before discounts and taxes.
Discount Amount: Discount amount in cents.
Net Amount: Amount in cents, after discounts but before taxes.
Tax Amount: Sales tax amount in cents. If null, it means there is no enough information yet to calculate it.
Tax Behavior: Tax behavior of the checkout. inclusive means the price includes tax, exclusive means tax is added on top. If null, tax is not yet calculated.
inclusive, exclusive Total Amount: Amount in cents, after discounts and taxes.
Currency: Currency code of the checkout session.
Indicates whether to enable the trial period for the checkout session. If false, the trial period will be disabled, even if the selected product has a trial configured.
Active Trial Interval: Interval unit of the trial period, if any. This value is either set from the checkout, if trial_interval is set, or from the selected product.
day, week, month, year Count of interval units of the trial period, if any. This value is either set from the checkout, if trial_interval_count is set, or from the selected product.
Trial End: End date and time of the trial period, if any.
Identifier of the organization owning the checkout session.
Identifier of the product to checkout.
Identifier of the product price to checkout.
Identifier of the discount applied to the checkout.
Indicates whether to allow the customer to apply discount codes. If you apply a discount through discount_id, it'll still be applied, but the customer won't be able to change it.
Indicates whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to true.
Indicates whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable.
Indicates whether the product price is free, regardless of discounts.
Indicates whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount.
Indicates whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles.
Indicates whether the checkout requires a payment form, whether because of a payment or payment method setup.
Indicates whether the customer is a business or an individual. If true, the customer will be required to fill their full billing address and billing name.
Customer Name: Name of the customer.
Email used to identify and contact the customer.
Customer address used for billing and tax calculations.
Billing Address Fields: Determines which billing address fields should be disabled, optional or required in the checkout form.
Unit used to measure the trial period.
day, week, month, year Length of the trial measured in the selected interval.
Identifier of the customer in your system. If a matching customer exists on Ruba, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set.
Collection of products available to select.
Product: Product selected to checkout.
A recurring price for a product, i.e. a subscription.
Deprecated: The recurring interval should be set on the product itself.
- LegacyRecurringProductPriceFixed
- LegacyRecurringProductPriceCustom
- ProductPriceFixed
- ProductPriceCustom
- ProductPriceSeatBased
- ProductPriceMeteredUnit
Prices: Mapping of product IDs to their list of prices.
Schema for a fixed amount discount that is applied once or forever.
- CheckoutDiscountFixedOnceForeverDuration
- CheckoutDiscountFixedRepeatDuration
- CheckoutDiscountPercentageOnceForeverDuration
- CheckoutDiscountPercentageRepeatDuration
Map containing values collected through custom fields.
Seats: Predefined number of seats (works with seat-based pricing only).
Min Seats: Minimum number of seats (works with seat-based pricing only).
Max Seats: Maximum number of seats (works with seat-based pricing only).