Create a checkout session
/checkoutCreates a checkout session for line items from your catalog or sent inline, or for a single amount.
- With
line_items,amountandcurrencyare optional. If you send them, they must equal the items' total, or the request returns422withamount_mismatch. - Without
line_items,amount,currencyanddescriptionmake one line. Adynamicsession lets the customer enter the amount. - The checkout asks for a shipping address when an item's product is
shippable, and offers the rates inshipping_options, or your active rates for the customer's country. flowoverrides the design profile's flow for this session: one page, or steps.
Headers
AuthorizationstringRequiredidempotency-keystringA 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
modestringRequiredpayment 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.
typestringdynamic lets the customer enter the amount. It takes currency and no line items.
line_itemsarray of objectsShow 4 child parametersHide child parameters
pricestringA catalog price (prc_).
price_dataobjectA 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
currencystringRequiredThree-letter ISO currency code, in lowercase.
unit_amountintegerRequiredtax_behaviorstringexclusive adds tax to the amount, and inclusive includes it.
scheduleobjectMakes the price recurring.
Show 2 child parametersHide child parameters
intervalstringRequiredinterval_countintegerreferencestringproductstringA catalog product (prod_). Send this or product_data.
product_dataobjectA 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
referencestringRequirednamestringRequireddescriptionstringimagesarray of stringstax_codestringA tax code (txcd_).
shippablebooleanmetadataobjectYour key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.
quantityintegeradjustable_quantityobjectLets the customer change the quantity at checkout.
Show 3 child parametersHide child parameters
enabledbooleanminimumintegermaximumintegeramountintegercurrencystringThree-letter ISO currency code, in lowercase.
descriptionstringThe line's name when there are no line items.
customer_reference_idstringYour ID for the customer. Leave it out for a guest.
customer_emailstringFills in the email field.
Show 28 more parametersShow fewer parameters
collectionobjectThe 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
nameobjectShow 1 child parameterHide child parameters
enabledbooleanemailobjectShow 1 child parameterHide child parameters
enabledbooleanphone_numberobjectShow 1 child parameterHide child parameters
enabledbooleanbilling_addressobjectShow 1 child parameterHide child parameters
levelstringshipping_addressobjectAsked 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
enabledbooleanallowed_countriesarray of stringstax_idobjectShow 1 child parameterHide child parameters
enabledbooleanshipping_optionsobjectThe 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 stringsshipping_rate_dataarray of objectsShow 6 child parametersHide child parameters
display_namestringRequiredamountintegerRequiredcurrencystringRequiredThree-letter ISO currency code, in lowercase.
delivery_estimateobjectShow 2 child parametersHide child parameters
minimumobjectShow 2 child parametersHide child parameters
unitstringvalueintegermaximumobjectShow 2 child parametersHide child parameters
unitstringvalueintegertax_behaviorstringexclusive adds tax to the amount, and inclusive includes it.
tax_codestringtax_optionsobjectHow 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_configurationstringtax_quotestringtax_quote_dataobjectThe same object the main API's tax_options.tax_quote_data takes.
invoice_creationobjectWhether the order gets an invoice. Defaults to your Commerce settings.
Show 1 child parameterHide child parameters
enabledbooleanpayment_method_typesarray of stringsautomatic_payment_methodsbooleanpayment_method_optionsobjectThe same options payment sessions take.
setup_future_usagestringexpress_methodsobjectWhere Apple Pay, Google Pay and the other express methods show. Both default to true.
Show 2 child parametersHide child parameters
express_rowobjectShow 1 child parameterHide child parameters
enabledbooleanmethod_listobjectShow 1 child parameterHide child parameters
enabledbooleanflowstringone_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).
design_profilestringThe 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.
localestringsubmit_typestringsuccess_urlstringcancel_urlstringdurationintegerMinutes until the session expires.
max_attemptsintegerreceiptbooleanstatement_descriptor_suffixstringcustom_fieldsarray of objectscustom_textobjectreferencestringCopied to the order and the charge.
metadataobjectYour key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.
subscription_optionsobjectHow 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
enginestringpay_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.
connectionstringThe connection (subconn_), when you have more than one for the engine.
referencestringYour ID for the subscription, unique in your workspace and environment.
trialobjectShow 5 child parametersHide child parameters
intervalstringinterval_countintegerend_atstringpayment_method_requiredbooleanmissing_payment_methodstringcycle_anchorstringThe first full renewal date.
cancel_atstringexternalobjectThe IDs that already exist at an external engine.
Show 2 child parametersHide child parameters
customerstringsubscriptionstringtax_figuresstringWhen 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.
metadataobjectYour key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.
seller_of_recordobjectOverrides your seller rules for this sale, among the sellers your account is approved for.
Show 1 child parameterHide child parameters
typestringreturn_urlstringFor 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_statestringThe value the app SDK gives your server, returned on return_url.
store_linkobjectStore tokens and tap time for a purchase linked out from an app.
Show 3 child parametersHide child parameters
platformstringtokensarray of objectsShow 2 child parametersHide child parameters
typestringvaluestringtapped_atstringReturns
The checkout session.
idstringresourcestringstatusstringmodestringtypestringurlstringexpires_atstringflowstringone_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).
Show 34 more attributesShow fewer attributes
design_profilestringdesign_profile_versionintegerline_itemsarray of objectsShow 11 child attributesHide child attributes
idstringThe line item (oli_ on orders, csli_ on sessions).
productstring or nullnull for the line made from amount and description.
pricestring or nullprice_versioninteger or nullnamestringquantityintegerunit_amountintegeramount_subtotalintegeramount_taxintegeramount_totalintegershippablebooleancurrencystringThree-letter ISO currency code, in lowercase.
amount_subtotalinteger or nullamount_shippinginteger or nullamount_taxinteger or nullamount_totalinteger or nullamountinteger or nullThe same as amount_total.
taxobjectShow 5 child attributesHide child attributes
sourcestringmerchant 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.
amountintegerbreakdownarray of objectsBy jurisdiction, in the shape tax quotes return.
merchant_amountinteger or nullWhen 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 nullThe breakdown you sent, kept beside Pay.com's. Set with merchant_amount.
seller_of_recordobjectWho 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
typestringpay_com comes with merchant of record.
entitystringThe selling legal entity (ent_).
customerstring or nullcustomer_reference_idstring or nullcustomer_detailsobjectShow 5 child attributesHide child attributes
emailstring or nullnamestring or nullphonestring or nulladdressobject or nullThe billing address, at the level collected.
Show 2 child attributesHide child attributes
Option 1objectShow 6 child attributesHide child attributes
line1stringline2string or nullcitystringstatestring or nullpostal_codestringcountrystringTwo-letter country code (ISO 3166-1 alpha-2).
Option 2nulltax_idsarray of objectsShow 3 child attributesHide child attributes
typestringvaluestringverificationstringshipping_detailsobject or nullShow 2 child attributesHide child attributes
Option 1objectShow 4 child attributesHide child attributes
namestringphonestring or nulladdressobjectShow 6 child attributesHide child attributes
line1stringline2string or nullcitystringstatestring or nullpostal_codestringcountrystringTwo-letter country code (ISO 3166-1 alpha-2).
rateobjectShow 4 child attributesHide child attributes
idstring or nullThe rate (shr_), or null for one sent inline.
display_namestringamountintegerdelivery_estimateobjectShow 2 child attributesHide child attributes
minimumobjectShow 2 child attributesHide child attributes
unitstringvalueintegermaximumobjectShow 2 child attributesHide child attributes
unitstringvalueintegerOption 2nullcollectionobjectThe 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
nameobjectShow 1 child attributeHide child attributes
enabledbooleanemailobjectShow 1 child attributeHide child attributes
enabledbooleanphone_numberobjectShow 1 child attributeHide child attributes
enabledbooleanbilling_addressobjectShow 1 child attributeHide child attributes
levelstringshipping_addressobjectAsked 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
enabledbooleanallowed_countriesarray of stringstax_idobjectShow 1 child attributeHide child attributes
enabledbooleanaddedarray of objectsDetails Pay.com asks for beyond the ones you chose.
Show 2 child attributesHide child attributes
fieldstringreasonstringseller when Pay.com sells and needs the detail as merchant of record, such as the email for receipts and support.
express_methodsobjectWhere Apple Pay, Google Pay and the other express methods show. Both default to true.
Show 2 child attributesHide child attributes
express_rowobjectShow 1 child attributeHide child attributes
enabledbooleanmethod_listobjectShow 1 child attributeHide child attributes
enabledbooleanorderstring or nullThe order (ord_), once paid.
subscriptionstring or nullThe subscription the session started.
subscription_optionsobjectHow 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
enginestringpay_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.
connectionstringThe connection (subconn_), when you have more than one for the engine.
referencestringYour ID for the subscription, unique in your workspace and environment.
trialobjectShow 5 child attributesHide child attributes
intervalstringinterval_countintegerend_atstringpayment_method_requiredbooleanmissing_payment_methodstringcycle_anchorstringThe first full renewal date.
cancel_atstringexternalobjectThe IDs that already exist at an external engine.
Show 2 child attributesHide child attributes
customerstringsubscriptionstringtax_figuresstringWhen 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.
metadataobjectYour key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.
resolvedobjectWhat the request resolved to. Locked when the customer confirms, and never resolved again.
Show 9 child attributesHide child attributes
enginestringconnectionstring or nullcollection_modelstringresolved_fromstringseller_of_recordobjectWho 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
typestringpay_com comes with merchant of record.
entitystringThe selling legal entity (ent_).
processorobjectWhere 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
servicestringacquiring for Pay.com Acquiring, orchestration for one of your own processors.
account_ownerstringsettlement_accountstring or nullYour settlement account the payments go to. null when Pay.com sells.
providerstring or nullYour processor, with orchestration. Otherwise null.
responsibilitiesobjectWho owns each job. Exactly one owner each, so it's always clear which system charged a customer.
Show 5 child attributesHide child attributes
schedulerstringcollectorstringdunningstringinvoice_issuerstringtaxstringdue_nowobjectShow 2 child attributesHide child attributes
amountintegercurrencystringthenobjectShow 4 child attributesHide child attributes
amountintegercurrencystringintervalstringinterval_countintegerreturn_urlstring or nullclient_statestring or nullstore_linkobject or nullShow 2 child attributesHide child attributes
Option 1objectStore tokens and tap time for a purchase linked out from an app.
Show 3 child attributesHide child attributes
platformstringtokensarray of objectsShow 2 child attributesHide child attributes
typestringvaluestringtapped_atstringOption 2nullinvoicestring or nullchargestring or nullpayment_methodstring or nullpayment_linkstring or nullsuccess_urlstring or nullcancel_urlstring or nulllocalestringreferencestring or nullmetadataobjectYour key-value pairs. Up to 50 keys of 40 characters, with string values of up to 500 characters.
createdstringtest_modebooleanErrors
400401403404409422amount_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.429Retry-After header's seconds.500