Checkout
One checkout for payments, subscriptions, and saving a payment method, shown as a hosted page, inline, an overlay, or native drop-ins in your app.
One checkout covers taking a payment, starting a subscription, and saving a payment method. You create one session, and show it in whichever form fits the page or app the customer is on. Card details are typed into Pay.com's card fields, so they never touch your pages or your servers.
One session, every form
Show a session in any of these forms:
- Hosted page: a page on checkout.pay.com or on your own domain. Send customers to it from your site, an email, a payment link, or your app.
- Inline: the checkout inside your own page, from Pay.com.js.
- Overlay: the checkout over your page, from Pay.com.js, so the customer never leaves it.
- Native drop-ins: the iOS, Android, and React Native drop-ins, on the same session.
Each form takes the same session and follows the same design profile. The checkout renders on one page or as a multi-step flow, controlled by the session's flow parameter.
Create a checkout session
Create the session on your server with POST /v1/checkout. Set mode to payment, subscription, or setup, and send what the customer buys in line_items, from your catalog or inline. Amounts are in the smallest currency unit, so 2000 is $20.00 USD. Then send the customer to the session's url, or show the same session inline or as an overlay.
curl https://api.sandbox.pay.com/v1/checkout \
-u ':sk-pay-com-sandbox-…' \
-H "Content-Type: application/json" \
-H "idempotency-key: $(uuidgen)" \
-d '{
"mode": "payment",
"customer_reference_id": "cust-jane-doe-001",
"line_items": [
{
"price_data": {
"currency": "usd",
"unit_amount": 2000,
"product_data": { "reference": "design-templates", "name": "Design templates" }
},
"quantity": 2
}
],
"metadata": { "cart_id": "cart-58213" }
}'{
"id": "cs_691204557318275072",
"resource": "checkout_session",
"mode": "payment",
"status": "open",
"url": "https://checkout.pay.com/a/9VbQ2xK7wPz4",
"amount": 4000,
"currency": "usd",
"customer_reference_id": "cust-jane-doe-001",
"line_items": [
{
"product": "prod_691180251832786944",
"price": "prc_691180255557328896",
"price_version": 1,
"name": "Design templates",
"quantity": 2,
"unit_amount": 2000,
"amount_subtotal": 4000,
"amount_total": 4000
}
],
"seller_of_record": { "type": "merchant", "entity": "ent_685022347811516416" },
"order": null,
"expires_at": "2026-11-26T10:30:00.000Z"
}See Create a checkout session in the Commerce API reference for every field, and Products and prices for sending your catalog inline.
What customers see
At checkout, customers see:
- The seller and the merchant, named.
- Wallets first, then the other payment methods in an accordion.
- Prices in their own currency, and the tax for their country. See Currencies and tax at checkout.
- English or one of the most-used languages, in a layout ready for right-to-left languages.
- Guest checkout, or their Pay.com account if they have one. See Guests and Pay.com accounts.
Your own domain
The hosted checkout can run on a domain of yours. Each domain needs its own Apple Pay verification, and a return domain that's different from the checkout's domain. Pay.com checks both automatically when you add a domain or register an app. GET /v1/payment_method_domains lists the domains registered for Apple Pay on the web.
From your app
Native apps and games can also link out to the hosted checkout in the browser, and bring the customer back with a Return to app button. See Sell from your app.
Fulfill from the webhook
The payment webhook is the proof of payment. Fulfill the order or start the subscription's access when it arrives, not when the customer comes back to your page or app. A customer can close the window before returning.
Listen for these events:
checkout_session.completed: the customer paid, or saved a payment method insetupmode.order.paid: the session's order, with its items. Fulfill one-time purchases from it.subscription.access.updated: a subscription'saccess.statuschanged. Grant access when it'sgranted.checkout_session.failed: the session failed.
Verify the Pay-Signature header on every event before you act on it. See Webhooks.