Create a session on your server
CallPOST /sdk/session from your backend with your private API key in the Authorization header.
clientToken and its lifetime in seconds:
Pass the token to the browser
DeliverclientToken to your front-end. Common approaches include:
- Inline JSON — embed it in your HTML template when the page is server-rendered.
- API response — return it from a lightweight
/api/checkout-sessionendpoint that your SPA calls on page load.
new TheriusSDK({ clientToken }).
Optional request parameters
Merchant-managed subscriptions
If you run your own recurring billing outside the Therius Subscriptions API — for example, a one-time checkout that should establish a card-on-file mandate you bill against yourself later — passcardOnFile when creating the session, instead of configuring anything in the Checkout Builder:
cardOnFile is set:
- The Checkout Widget skips the optional “save my card” checkbox entirely and shows a fixed disclosure (“Your card will be saved for future charges”) instead — there is nothing for the shopper to opt into, since you already declared the intent server-side.
- The resulting charge is tokenized and tagged with the given stored-credential fields (
usage/initiatedBy/type, see Stored Credentials) unconditionally, regardless of anything the browser sends — the signed session token is the source of truth, not the request body. customerIdis required — there must be a shopper to attribute the saved card to.
cardOnFile, the session behaves exactly as before: the checkout follows whatever the Checkout Builder’s “save my card” (vault-consent) setting says, and any resulting saved card is a plain card-on-file, not a recurring mandate.
There used to be a separate “Starts a merchant-managed subscription” checkbox in the Checkout Builder. It has been removed — this is now a per-transaction, server-controlled setting instead of a static per-checkout-config flag, so a shopper can never see (or suppress) the wrong consent state for a given session.
Load the SDK script with integrity checking
The session response also names the current release of the SDK script:url always serves exactly the bytes that integrity describes, so the browser refuses to run anything else, such as a script altered by a compromised CDN, proxy, or browser extension. When Therius ships a fix, new sessions name the new release and you change nothing.
- Do not hardcode the version or the hash. Read them from every session response.
- Do not cache the rendered page for longer than the token lifetime (30 minutes). Therius keeps recent releases available so pages that are already rendered keep working, but a retired release answers
410 Goneand the checkout does not load until the page is rendered again. For a security fix, Therius can retire a release immediately. - The lazy-loaded parts (wallet buttons, Click to Pay) load from the same release and are checked against hashes carried inside the main script. There is nothing to configure.
https://api.therius.io/v1/sdk/js always serves the latest release. It has no integrity check, so list it in your Content Security Policy script-src and in your script inventory, and monitor changes to your own page. Use the same URL when the session response has no sdk field. These measures support, but do not by themselves satisfy, the payment page script requirements of PCI DSS (6.4.3 and 11.6.1) for your page.
Initialize the SDK in the browser
Once the browser has the token, initialize the SDK:TheriusSDK throws synchronously.

