Get your keys
The SDK (software development kit) needs one thing from you: a publishable token. Each token works only on the websites you allow for it, so getting set up is two steps: copy a token, then make sure the site you are building on is on its list.
Your tokens
Open the Developers page of the Shoppable customer portal. It shows two publishable tokens for your cart, each with the domains it works on. If you cannot sign in, or do not see a Developers page, contact your Shoppable account manager.
| Token | How to tell | Works on | Orders |
|---|---|---|---|
| Test | Starts with pk_test_ | Your testing domains, plus localhost and 127.0.0.1 on any port | None are real. Use Stripe test cards. |
| Live | The one without a prefix | Your production domains only, never localhost | Real orders, real cards |
Publishable tokens are safe to ship in a browser bundle. They identify your cart and nothing more: every checkout call also needs a short-lived session token that the SDK obtains for you (see Authentication).
Live tokens work once your account is activated for live mode. To activate it, contact your Shoppable representative.
Allow your websites
Allowed websites live in the portal’s Cart Builder, on the Config tab. The dashboard’s Test/Live toggle decides which list you are editing:
- Test: Testing Domain and Testing Secondary Domains, used by the test token.
- Live: Production Domain and Production Secondary Domains, used by the live token.
Enter each domain without https://, as the form describes. A request is allowed when its
origin (scheme, host and port) matches one of the entries exactly, so example.com and
www.example.com are different sites: add both if shoppers can reach either.
Both tokens use the same API (application programming interface), so leave the client’s baseUrl at its default.
Origin
In the browser the SDK sends your page’s origin, or the embedding page’s origin when it runs
inside an iframe, so there is nothing to configure. In Node there is no page to read, so pass
origin yourself; it must be one of your allowed domains:
const client = new ShoppableCheckout({ token: "pk_test_...", origin: "https://staging.your-store.com",});When the origin is not allowed
getCartConfiguration() is the first call that checks your token and origin, so this is where
setup problems surface. The React provider puts the same error on
useShoppable().error.
| What you see | Cause |
|---|---|
ShoppableApiError with status 403 and the message “Your DTC license is no longer active!” | DTC is direct-to-consumer, the cart product your tokens belong to. Despite the wording, this means the origin is not on the list for this token’s mode: for example a live token on localhost or a testing domain, a test token on a production domain, or www missing from the list. |
ShoppableValidationError with status 400, “Missing or invalid Origin, Referer, or Parent header” | No origin could be determined. Pass origin. |
ShoppableConfigError, “An origin is required for this call” | You are running in Node without origin. |
ShoppableAuthError with status 401, “The cart token is not valid. Copy it again from the Developers page.” | The token is mistyped, truncated, or has something added to it. Copy it again from the Developers page. |
Test mode in the configuration
config.isTestMode is true for a test token. Show a visible “Test mode” badge in your checkout
when it is, so nobody mistakes a test order for a real one. Do not gate your checkout on
config.isActive: it is false in test mode and only reports whether the live cart is
published on your main production domain.