Skip to Content
Docs
Checkout sessions

Create a checkout session

POST/checkout

Creates a checkout session for line items from your catalog or sent inline, or for a single amount.

  • With line_items, amount and currency are optional. If you send them, they must equal the items' total, or the request returns 422 with amount_mismatch.
  • Without line_items, amount, currency and description make one line. A dynamic session lets the customer enter the amount.
  • The checkout asks for a shipping address when an item's product is shippable, and offers the rates in shipping_options, or your active rates for the customer's country.
  • flow overrides the design profile's flow for this session: one page, or steps.

Headers

AuthorizationstringRequired
HTTP Basic auth: your API key as the password, with an empty username. See Authentication.
idempotency-keystring

A unique key, such as a UUID, that makes a POST safe to retry. Pay.com keeps each key for 24 hours, separately for each workspace. A retry with the same key, endpoint and body gets the first response. Another endpoint or body gets 400 idempotency_error, and a retry while the first is running gets 409.

Parameters

modestringRequired

payment sells and creates an order. setup saves a payment method. subscription starts a subscription from the recurring line items, with subscription_options, and creates an order for the first payment.

One of payment, setup or subscription.

typestring

dynamic lets the customer enter the amount. It takes currency and no line items.

One of fixed or dynamic.

Default: fixed

line_itemsarray of objects
Show 4 child parametersHide child parameters
pricestring

A catalog price (prc_).

price_dataobject

A price sent inline. Pay.com finds the product's price by its reference, or without one by currency and schedule. A different unit_amount or tax behavior adds a version, and the same data reuses the current one.

Show 7 child parametersHide child parameters
currencystringRequired

Three-letter ISO currency code, in lowercase.

unit_amountintegerRequired
tax_behaviorstring

exclusive adds tax to the amount, and inclusive includes it.

One of exclusive or inclusive.

scheduleobject

Makes the price recurring.

Show 2 child parametersHide child parameters
intervalstringRequired

One of day, week, month or year.

interval_countinteger

Default: 1

referencestring
productstring

A catalog product (prod_). Send this or product_data.

product_dataobject

A product sent inline. Pay.com finds it by reference or creates it, and updates it with what you send (the latest wins).

Show 7 child parametersHide child parameters
referencestringRequired
namestringRequired
descriptionstring
imagesarray of strings
tax_codestring

A tax code (txcd_).

shippableboolean

Default: false

metadataobject

Your key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.

quantityinteger

Default: 1

adjustable_quantityobject

Lets the customer change the quantity at checkout.

Show 3 child parametersHide child parameters
enabledboolean
minimuminteger

Default: 1

maximuminteger

Default: 99

amountinteger
currencystring

Three-letter ISO currency code, in lowercase.

descriptionstring

The line's name when there are no line items.

customer_reference_idstring

Your ID for the customer. Leave it out for a guest.

customer_emailstring

Fills in the email field.

Show 28 more parametersShow fewer parameters
collectionobject

The details the checkout asks for. Pay.com adds any a payment method or tax needs, and lists them in collection.added.

Show 6 child parametersHide child parameters
nameobject
Show 1 child parameterHide child parameters
enabledboolean

Default: false

emailobject
Show 1 child parameterHide child parameters
enabledboolean

Default: true

phone_numberobject
Show 1 child parameterHide child parameters
enabledboolean

Default: false

billing_addressobject
Show 1 child parameterHide child parameters
levelstring

One of none, country, postal_code or full.

Default: country

shipping_addressobject

Asked for whenever an item ships, even if you leave this out. Use it to limit countries, or to ask for an address with no shippable items.

Show 2 child parametersHide child parameters
enabledboolean
allowed_countriesarray of strings
tax_idobject
Show 1 child parameterHide child parameters
enabledboolean

Default: false

shipping_optionsobject

The rates to offer. Without it, the checkout offers your active rates for the customer's country and the session's currency.

Show 2 child parametersHide child parameters
shipping_ratesarray of strings
shipping_rate_dataarray of objects
Show 6 child parametersHide child parameters
display_namestringRequired
amountintegerRequired
currencystringRequired

Three-letter ISO currency code, in lowercase.

delivery_estimateobject
Show 2 child parametersHide child parameters
minimumobject
Show 2 child parametersHide child parameters
unitstring

One of business_day, day or week.

valueinteger
maximumobject
Show 2 child parametersHide child parameters
unitstring

One of business_day, day or week.

valueinteger
tax_behaviorstring

exclusive adds tax to the amount, and inclusive includes it.

One of exclusive or inclusive.

tax_codestring
tax_optionsobject

How tax is worked out, as on the main API's charges. Send your own figures with tax_quote_data.tax_breakdown, a tax_quote you created, or a tax_configuration for Pay.com to calculate on your tax setup. Without it, Pay.com uses your default tax configuration, or charges no tax if you have none.

Show 3 child parametersHide child parameters
tax_configurationstring
tax_quotestring
tax_quote_dataobject

The same object the main API's tax_options.tax_quote_data takes.

invoice_creationobject

Whether the order gets an invoice. Defaults to your Commerce settings.

Show 1 child parameterHide child parameters
enabledboolean
payment_method_typesarray of strings
automatic_payment_methodsboolean

Default: true

payment_method_optionsobject

The same options payment sessions take.

setup_future_usagestring

One of on_session or off_session.

express_methodsobject

Where Apple Pay, Google Pay and the other express methods show. Both default to true.

Show 2 child parametersHide child parameters
express_rowobject
Show 1 child parameterHide child parameters
enabledboolean

Default: true

method_listobject
Show 1 child parameterHide child parameters
enabledboolean

Default: true

flowstring

one_page shows everything on one page. steps splits it into Details, Shipping (only when something ships and there's more than one rate) and Payment, with no review step. Details asks for the country when tax needs it, so the total is final before Payment, and billing details sit in Payment. Defaults to the design profile's flow (in the checkout builder: Layout, Flow).

One of one_page or steps.

design_profilestring

The design profile (dprof_). Defaults to your default profile. It must be published and not archived, or the request returns 422 with profile_not_published or profile_archived.

localestring

Default: auto

submit_typestring

One of pay, buy, donate, book or rent.

Default: pay

success_urlstring
cancel_urlstring
durationinteger

Minutes until the session expires.

Default: 1440

max_attemptsinteger

Default: 5

receiptboolean

Default: true

statement_descriptor_suffixstring
custom_fieldsarray of objects
custom_textobject
referencestring

Copied to the order and the charge.

metadataobject

Your key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.

subscription_optionsobject

How a subscription runs. Taken by checkout sessions in subscription mode, payment links and POST /v1/subscriptions, and by nothing on the main API. Your tax figures travel in tax_options, not here.

Show 9 child parametersHide child parameters
enginestring

pay_com, stripe for Stripe Billing, external for your own system or shop plugin, or the engine of one of your connections. Defaults to the price's, then your settings', then pay_com.

connectionstring

The connection (subconn_), when you have more than one for the engine.

referencestring

Your ID for the subscription, unique in your workspace and environment.

trialobject
Show 5 child parametersHide child parameters
intervalstring

One of day, week, month or year.

interval_countinteger
end_atstring
payment_method_requiredboolean

Default: true

missing_payment_methodstring

One of cancel or pause.

Default: cancel

cycle_anchorstring

The first full renewal date.

cancel_atstring
externalobject

The IDs that already exist at an external engine.

Show 2 child parametersHide child parameters
customerstring
subscriptionstring
tax_figuresstring

When you sell with your own tax figures: stored charges each renewal with the figures you sent, per_invoice asks for each renewal's with invoice.drafted.

One of stored or per_invoice.

Default: stored

metadataobject

Your key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.

seller_of_recordobject

Overrides your seller rules for this sale, among the sellers your account is approved for.

Show 1 child parameterHide child parameters
typestring

One of merchant or pay_com.

return_urlstring

For a purchase from an app: where Return to app sends the customer. Pay.com adds session_id, outcome and client_state. Its domain must differ from the checkout's.

client_statestring

The value the app SDK gives your server, returned on return_url.

Returns

The checkout session.

idstring
resourcestring
statusstring

One of open, completed, failed or expired.

modestring

One of payment, setup or subscription.

typestring

One of fixed or dynamic.

urlstring
expires_atstring
flowstring

one_page shows everything on one page. steps splits it into Details, Shipping (only when something ships and there's more than one rate) and Payment, with no review step. Details asks for the country when tax needs it, so the total is final before Payment, and billing details sit in Payment. Defaults to the design profile's flow (in the checkout builder: Layout, Flow).

One of one_page or steps.

Show 34 more attributesShow fewer attributes
design_profilestring
design_profile_versioninteger
line_itemsarray of objects
Show 11 child attributesHide child attributes
idstring

The line item (oli_ on orders, csli_ on sessions).

productstring or null

null for the line made from amount and description.

pricestring or null
price_versioninteger or null
namestring
quantityinteger
unit_amountinteger
amount_subtotalinteger
amount_taxinteger
amount_totalinteger
shippableboolean
currencystring

Three-letter ISO currency code, in lowercase.

amount_subtotalinteger or null
amount_shippinginteger or null
amount_taxinteger or null
amount_totalinteger or null
amountinteger or null

The same as amount_total.

taxobject
Show 5 child attributesHide child attributes
sourcestring

merchant for your own figures, pay_com for Pay.com's calculation (on your tax setup when you sell, and Pay.com's own when it sells), or none.

One of merchant, pay_com or none.

amountinteger
breakdownarray of objects

By jurisdiction, in the shape tax quotes return.

merchant_amountinteger or null

When Pay.com sells and you sent your own figures with this order or invoice: what they came to. Kept beside Pay.com's figures and never charged. Otherwise null.

merchant_breakdownarray of objects or null

The breakdown you sent, kept beside Pay.com's. Set with merchant_amount.

seller_of_recordobject

Who sells: you, or Pay.com as merchant of record. Fixed when the customer pays, and never changed on renewal.

Show 2 child attributesHide child attributes
typestring

pay_com comes with merchant of record.

One of merchant or pay_com.

entitystring

The selling legal entity (ent_).

customerstring or null
customer_reference_idstring or null
customer_detailsobject
Show 5 child attributesHide child attributes
emailstring or null
namestring or null
phonestring or null
addressobject or null

The billing address, at the level collected.

Show 2 child attributesHide child attributes
Option 1object
Show 6 child attributesHide child attributes
line1string
line2string or null
citystring
statestring or null
postal_codestring
countrystring

Two-letter country code (ISO 3166-1 alpha-2).

Option 2null
tax_idsarray of objects
Show 3 child attributesHide child attributes
typestring
valuestring
verificationstring

One of valid, invalid or unavailable.

shipping_detailsobject or null
Show 2 child attributesHide child attributes
Option 1object
Show 4 child attributesHide child attributes
namestring
phonestring or null
addressobject
Show 6 child attributesHide child attributes
line1string
line2string or null
citystring
statestring or null
postal_codestring
countrystring

Two-letter country code (ISO 3166-1 alpha-2).

rateobject
Show 4 child attributesHide child attributes
idstring or null

The rate (shr_), or null for one sent inline.

display_namestring
amountinteger
delivery_estimateobject
Show 2 child attributesHide child attributes
minimumobject
Show 2 child attributesHide child attributes
unitstring

One of business_day, day or week.

valueinteger
maximumobject
Show 2 child attributesHide child attributes
unitstring

One of business_day, day or week.

valueinteger
Option 2null
collectionobject

The details the checkout asks for. Pay.com adds any a payment method or tax needs, and lists them in collection.added.

Show 7 child attributesHide child attributes
nameobject
Show 1 child attributeHide child attributes
enabledboolean

Default: false

emailobject
Show 1 child attributeHide child attributes
enabledboolean

Default: true

phone_numberobject
Show 1 child attributeHide child attributes
enabledboolean

Default: false

billing_addressobject
Show 1 child attributeHide child attributes
levelstring

One of none, country, postal_code or full.

Default: country

shipping_addressobject

Asked for whenever an item ships, even if you leave this out. Use it to limit countries, or to ask for an address with no shippable items.

Show 2 child attributesHide child attributes
enabledboolean
allowed_countriesarray of strings
tax_idobject
Show 1 child attributeHide child attributes
enabledboolean

Default: false

addedarray of objects

Details Pay.com asks for beyond the ones you chose.

Show 2 child attributesHide child attributes
fieldstring
reasonstring

seller when Pay.com sells and needs the detail as merchant of record, such as the email for receipts and support.

One of tax, payment_method, shipping or seller.

express_methodsobject

Where Apple Pay, Google Pay and the other express methods show. Both default to true.

Show 2 child attributesHide child attributes
express_rowobject
Show 1 child attributeHide child attributes
enabledboolean

Default: true

method_listobject
Show 1 child attributeHide child attributes
enabledboolean

Default: true

orderstring or null

The order (ord_), once paid.

subscriptionstring or null

The subscription the session started.

subscription_optionsobject

How a subscription runs. Taken by checkout sessions in subscription mode, payment links and POST /v1/subscriptions, and by nothing on the main API. Your tax figures travel in tax_options, not here.

Show 10 child attributesHide child attributes
enginestring

pay_com, stripe for Stripe Billing, external for your own system or shop plugin, or the engine of one of your connections. Defaults to the price's, then your settings', then pay_com.

connectionstring

The connection (subconn_), when you have more than one for the engine.

referencestring

Your ID for the subscription, unique in your workspace and environment.

trialobject
Show 5 child attributesHide child attributes
intervalstring

One of day, week, month or year.

interval_countinteger
end_atstring
payment_method_requiredboolean

Default: true

missing_payment_methodstring

One of cancel or pause.

Default: cancel

cycle_anchorstring

The first full renewal date.

cancel_atstring
externalobject

The IDs that already exist at an external engine.

Show 2 child attributesHide child attributes
customerstring
subscriptionstring
tax_figuresstring

When you sell with your own tax figures: stored charges each renewal with the figures you sent, per_invoice asks for each renewal's with invoice.drafted.

One of stored or per_invoice.

Default: stored

metadataobject

Your key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.

resolvedobject

What the request resolved to. Locked when the customer confirms, and never resolved again.

Show 9 child attributesHide child attributes
enginestring
connectionstring or null
collection_modelstring

One of native, directed, handoff, engine_gateway, merchant_scheduled or mirror.

resolved_fromstring

One of session, price, account_default, seller_rule or default.

seller_of_recordobject

Who sells: you, or Pay.com as merchant of record. Fixed when the customer pays, and never changed on renewal.

Show 2 child attributesHide child attributes
typestring

pay_com comes with merchant of record.

One of merchant or pay_com.

entitystring

The selling legal entity (ent_).

processorobject

Where the subscription's payments are processed. It stays within the seller: Pay.com sells only on accounts it controls.

Show 4 child attributesHide child attributes
servicestring

acquiring for Pay.com Acquiring, orchestration for one of your own processors.

One of acquiring or orchestration.

account_ownerstring

One of pay_com or merchant.

settlement_accountstring or null

Your settlement account the payments go to. null when Pay.com sells.

providerstring or null

Your processor, with orchestration. Otherwise null.

responsibilitiesobject

Who owns each job. Exactly one owner each, so it's always clear which system charged a customer.

Show 5 child attributesHide child attributes
schedulerstring

One of pay_com, engine, merchant or outside.

collectorstring

One of pay_com, engine, merchant or outside.

dunningstring

One of pay_com, engine, merchant or outside.

invoice_issuerstring

One of pay_com, engine, merchant or outside.

taxstring

One of pay_com, engine, merchant or outside.

due_nowobject
Show 2 child attributesHide child attributes
amountinteger
currencystring
thenobject
Show 4 child attributesHide child attributes
amountinteger
currencystring
intervalstring
interval_countinteger
return_urlstring or null
client_statestring or null
invoicestring or null
chargestring or null
payment_methodstring or null
success_urlstring or null
cancel_urlstring or null
localestring
referencestring or null
metadataobject

Your key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.

createdstring
test_modeboolean

Errors

400
The request is invalid.
401
The API key is missing or wrong.
403
The key's permissions don't allow this route.
404
No such object in this workspace and environment.
409
A request with this idempotency key is still running.
422
The request is valid but can't be done. Codes include: - amount_mismatch: amount doesn't equal the line items' total. - price_inactive, product_inactive: an item can't be sold. - currency_mismatch: the items or rates use different currencies. - no_shipping_rate: an item ships and no active rate covers the session's currency. - checkout_not_open: the session is completed or expired. - order_not_refundable: the order is fully refunded, or under a dispute. - amount_exceeds_refundable: more than what's left to refund. - quantity_exceeds_refundable: more of an item than was sold and not yet refunded. - order_not_shippable: shipped_at was sent for an order with nothing that ships. - shipping_rate_inactive: a rate in shipping_options is archived. - tax_exceeds_amount: inclusive tax figures are more than an item's amount. - refund_failed: the payment method refused the refund. Nothing was refunded. - custom_css_not_approved: the draft's changed custom CSS isn't approved yet. - default_profile: your default design profile can't be archived. - profile_not_published: the design profile has nothing published yet, so sessions and links can't use it and it can't be your default. - profile_archived: the design profile is archived, so new sessions and links can't use it and it can't be your default. - display_name_required: the draft to publish has no display_name. - low_contrast: white text on colors.accent, or colors.text on colors.background, is under 4.5:1. - number_in_use: the next number is one the series has already used. - tax_rate_required: a subscription sent with your own tax figures has a tax_breakdown entry without a percentage_decimal or a flat_amount, so it can't be applied to renewals. - seller_engine_conflict: the request names an external engine for a sale that can resolve to Pay.com as seller. - engine_not_allowed_for_seller: the engine can't run a subscription this seller sells. - processor_not_allowed_for_seller: Pay.com sells only on accounts it controls, and the processor isn't one of them. - engine_capability_missing: the engine or its connection can't do what the request needs. - connection_not_ready: the engine's connection isn't connected, or needs action. - product_refused: a product failed review for merchant of record, and you can't sell it yourself in this request. Subscription and seller refusals come at creation, never at renewal.
429
Too many requests. Retry after the Retry-After header's seconds.
500
Something failed on Pay.com's side. Retry with the same idempotency key.
Was this page helpful?