Skip to main content
The Headless Checkout SDK is for merchants who want a fully custom checkout page on their own domain. You own the layout, fields, and buyer experience. Shoppex still creates the invoice, starts the payment session, handles 3DS or redirects, receives webhooks, and fulfills the order. Use this when the hosted checkout page or modal embed is not flexible enough.
Headless checkout requires an active Business plan.

What you need

  • A storefront or app page on your own domain.
  • An active Business plan.
  • A headless checkout publishable key from the dashboard.
  • At least one allowed origin for the site that will call the browser API.
  • @shoppexio/checkout-js installed in your frontend app.

Dashboard setup

Open Dashboard -> Settings -> Developer -> Headless Checkout.
1

Generate a publishable key

Click Generate key. Copy the pk_live_... key immediately. The full key is shown only once.
2

Add your storefront origin

Add the exact origin that hosts your checkout page, for example https://yourstore.com.
3

Add local development origins

For local testing, add the exact local origin too, for example http://localhost:3000.
An origin is only the scheme, host, and optional port. Do not include a path. If your site works on both https://vyy.gg and https://www.vyy.gg, add both origins.
Never put a secret shx_... API key in browser code. Headless checkout uses pk_live_... or pk_test_... publishable keys only.

Install

React example

ShoppexPoweredBy is currently required for every Headless Checkout. The SDK checks that the badge is visible before payment confirmation. The server owns this directive; the browser cannot disable it.

API shape

The browser SDK sends the publishable key in the x-shoppex-publishable-key header. Shoppex also checks the request Origin header against your allowed origins. The SDK can:
  • create a checkout session
  • read the current session status
  • apply or remove coupons
  • set tips
  • select add-ons
  • save buyer email, marketing preference, billing address, and method-specific terms acceptance
  • save product custom fields and delivery instructions
  • start a gateway payment session
  • complete zero-total checkouts
  • request and verify Customer Balance OTPs, then apply full or partial balance payments
  • submit browser-bound proof for manual payment methods
  • capture/finalize PayPal and SumUp payments
  • fetch delivery after the payment is complete
The session response includes line items, totals, authoritative gateway fee previews, payment-method presentation and requirements, buyer identity state, Customer Balance availability, product custom-field definitions, delivery instructions, shop branding, terms, and delivery state. Render against the gateway kind, not the provider name, so your UI works across card, redirect, crypto, balance, and manual payment flows.

Buyer details and payment requirements

Each entry in session.gateways_available contains:
  • fee_preview: the server-calculated fee for that method
  • presentation: merchant label, button label, icon, and provider-attribution preference
  • requirements: whether method terms and a billing address must be saved
presentation.hide_provider_attribution only controls the payment provider’s attribution. It does not remove the required ShoppexPoweredBy badge. Persist the details before starting the gateway:

Free and Customer Balance checkout

Customer Balance uses the same wallet, policy, attempt, reconciliation, stock-hold, and completion-access services as Hosted Checkout.

Crypto progress and underpayments

Call getSession() or the React refresh() action to read the authoritative payment projection. session.payment_detail includes the exact decimal strings needed for a crypto progress or underpayment UI:
The detail contains expected, received, remaining, crypto_currency, buyer_actionable, buyer_action_reason, provider_status, credited_fiat, received_fiat_estimate, fiat_currency, confirmations, and confirmations_needed when those values are available. credited_fiat is the amount the provider applied to the invoice. received_fiat_estimate is only a display estimate for crypto observed on-chain and must never be counted as paid. Keep the amount values as strings. Do not recalculate the remainder with JavaScript floating-point numbers.

Embed provider adapters

Stripe uses useStripePaymentSession. The framework-agnostic Headless export also includes:
These helpers mount provider-owned fields into your element and call the same Shoppex session/finalize endpoints as Hosted Checkout. Square and NMI perform their tokenized second session call; SumUp finalizes after the widget succeeds; PayPal captures the approved order. NMI includes Kount and 3D Secure when the merchant gateway requires them.

Manual payment proof

When a manual payment session has require_proof: true, use proof_type to render a note input, image input, or both. Then submit the proof with the completion grant returned by the start call:
The SDK registers completion access before uploading. A publishable key alone cannot submit proof for another buyer’s invoice.

Troubleshooting

Generate key fails

Check these first:
  • The shop has an active Business plan.
  • You are using the shop owner account or a team member with permission to manage webhooks/developer settings.
  • Your dashboard session is fresh. Refresh the page or log out and back in.
If it still fails, open browser DevTools -> Network and inspect:
Common responses:

Add origin fails

Use a full http:// or https:// origin. These are valid:
These are not valid saved origins:
The dashboard normalizes paths away before saving, but the backend still rejects non-http origins and malformed values. If the UI only shows a generic error, inspect this request:

Browser API calls fail

Check the browser response code:

Headless Commerce Overview

Pick the right integration shape for custom storefronts, apps, and backend flows.

Checkout Embed SDK

Use the hosted modal when you do not need a fully custom checkout UI.

Storefront SDK

Read public product, cart, and storefront data from browser code.

Webhooks

Fulfill orders and update your app after Shoppex receives payment events.