Checkout from your own site
Sell from your own website or app and take payment with your store's checkout, through checkout sessions your server creates.
Your website keeps its own pages and cart. When the buyer is ready to pay, your server creates a checkout session for the lines in that cart. The buyer pays on the session's pay page, with every payment method your store offers, and comes back to your site.
Your server learns how the session ended from a signed webhook, or by reading the session.
Your server ──POST /checkout-sessions──▶ your store ──▶ { id, url }
Buyer ──▶ url (pay page) ──▶ your successUrl or cancelUrl
Your store ──webhook: CheckoutSessionCompleted or …Expired──▶ your serverThe pay page is served on your store's domain. Payment, fraud checks, delivery and the order itself are the store's, exactly as for a purchase made on the store.
Set it up
In the dashboard, open Settings › Apps and add Headless checkout. It asks to prepare checkouts and to read the orders they end in.
Under Settings › Developers, choose Create API key, pick the App API key type, and
tick Headless checkout. Only the store owner can create one. Store the novinzo_api_… key
on your server; it is shown once.
Under Settings › Developers, add a webhook endpoint and select Checkout completed and Checkout expired. See Store webhooks to verify their signatures.
Every call goes to your store's domain, its .mynovinzo.com subdomain or its custom domain:
https://<store domain>/plugins/headless-checkout/storefront-public/v1/…
Authorization: Bearer novinzo_api_…A key only works on the store it was issued for. Removing the app takes it off every key. A key keeps opening the other apps it is granted, and installing the app again does not put it back on a key.
Create a session
Create the session from your server when the buyer starts paying:
curl -X POST "https://$STORE_DOMAIN/plugins/headless-checkout/storefront-public/v1/checkout-sessions" \
-H "Authorization: Bearer $NOVINZO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: cart-10482" \
-d '{
"items": [{ "variantId": "0d9a51b3-0987-4dc0-a5d1-f8e5d611fd05", "quantity": 1 }],
"email": "buyer@example.com",
"successUrl": "https://example.com/thanks?session={CHECKOUT_SESSION_ID}",
"cancelUrl": "https://example.com/cart",
"metadata": { "cartId": "10482" }
}'itemsare variants of your store, one line per variant. Read variant ids from the storefront product reads or keep them with your own products.successUrlandcancelUrlare absolutehttps:URLs.{CHECKOUT_SESSION_ID}in either is replaced with the new session's id.emailis kept for your reference. The pay page asks the buyer for theirs.metadataholds up to 20 of your own strings, at most 2 KB as JSON. It comes back with the session and its events.visitorIdis optional: a UUID your site keeps for this buyer, such as in a first-party cookie. Send it when your store credits affiliates for sales from your site, as in Credit affiliates. The order is then matched to your visitor instead of the pay page's, which your server never sees.- With an
Idempotency-Key, sending the same request again returns the session the first one created and creates nothing. The same key with a different body is refused with409.
A 201 answers with the session:
{
"id": "hcs_5b0d6c1f2e3a4b5c6d7e8f9a0b1c2d3e",
"url": "https://your-store.mynovinzo.com/checkout/3f9c…",
"expiresAt": "2026-11-07T12:00:00.000Z",
"totals": { "subtotal": { "amountMinorUnits": "1500", "currency": "USD" } }
}Amounts are strings of the currency's minor units. Send the buyer to url. The pay page prices the lines again, so totals is what the lines cost when you created the session, not a promise. Discounts and surcharges are added on the pay page.
A session can be paid for 24 hours. Create a new one for a buyer who comes back later.
Credit affiliates
If your store runs Affiliates, a sale made through your site can be credited to the affiliate link its buyer arrived on. Share each link as a URL of your own site, such as https://example.com/?ref=SUMMER, where SUMMER is the link's code. Tick Affiliates as well as Headless checkout on the app API key.
When a visitor arrives on a link, give them a visitor id if they have none: a UUID your site keeps, such as in a first-party cookie. Record the arrival from your server:
curl -X POST "https://dashboard.novinzo.com/api/plugins/affiliates/admin/clicks" \
-H "Authorization: Bearer $NOVINZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "code": "SUMMER", "visitorId": "6f9619ff-8b86-4d01-b42d-00cf4fc964ff" }'It answers { "recorded": true }, or false when the code names no live link of your store.
Arrivals of one visitor on a link less than a minute apart count once.
When that visitor pays, send the same visitorId as you create their checkout session.
The completed order is credited to the visitor's last arrival on any of your links in the 30 days before it, and counts in that link's stats under Affiliates. See RecordClick for the exact schema.
Learn how it ended
CheckoutSessionCompleted names the order the buyer paid with. CheckoutSessionExpired means the session ended unpaid. Their payloads are described under event payloads.
Fulfil from the webhook or from a read on your server, never from the buyer arriving at successUrl: anyone can open that URL.
A payment started before the session expired, such as crypto funds that confirm late, can still complete it, so CheckoutSessionCompleted can follow CheckoutSessionExpired.
To read a session, call GET /checkout-sessions/{id}. Its status is open, completed, expired or cancelled, and orderId is set once it is completed.
Errors
| Status | Error | Meaning |
|---|---|---|
| 400 | InvalidRequestError | The request does not match the contract. issues lists each field and what is wrong with it. |
| 401 | UnauthorizedError | The key is missing, unknown, revoked, expired, or for another store. |
| 403 | CheckoutNotPermittedError | The app is not allowed to prepare checkouts for the store. |
| 404 | CheckoutSessionNotFoundError | No session with that id in this store. |
| 409 | IdempotencyKeyReusedError | The Idempotency-Key was used for a different request. |
| 422 | CheckoutSessionLinesRefusedError | Some lines cannot be sold as asked. lines gives each one's reason; no session was created. |
| 503 | CheckoutSessionStockUnconfirmedError | Stock for a line could not be confirmed. Retry with the same Idempotency-Key. |
The reference lists the exact request and response schemas.
