Skip to main content
The Therius JS SDK is the browser-side companion to the Therius payment API. It renders card fields inside Therius-hosted iframes, so a raw PAN never transits your server — you only ever receive a one-time nonce or a final PaymentResult. Your checkout page controls the layout and styling; Therius controls what happens inside each field.

When to use the SDK

Hosted Fields

Use hosted fields or the Checkout Widget when accepting cards directly from a browser. Your DOM never contains a raw card number.

Wallet Buttons

Use wallet buttons for Apple Pay and Google Pay. The native payment sheet handles authentication; Therius decrypts the result server-side.

Click to Pay

Use Click to Pay for Visa and Mastercard network-level saved cards. Cardholders authenticate without re-entering details.

APM Redirects

Use sdk.purchaseApm for redirect-based alternative payment methods such as iDEAL, Klarna, and Pix.
For server-to-server integrations — backend services or mobile native apps — use the REST API directly. The JS SDK is browser-only.

Installation

Or load the SDK via CDN with no build step required:

Initialization

Import and initialize the SDK with a clientToken obtained from your server. Your private API key never leaves the backend.
TheriusSDK throws immediately if clientToken is missing — there is no silent half-initialized state. Always pass a valid token before calling any SDK method.

Integration flow

1

Server creates SDK session

Your server calls POST /sdk/session with your private API key and receives a short-lived clientToken.
2

Browser receives clientToken

Pass the token to the browser — for example, as inline JSON in your HTML template or as a JSON response to an AJAX request.
3

SDK initializes

The browser constructs new TheriusSDK({ clientToken }). The SDK is now ready to render fields and process payments.
4

SDK renders card fields in hosted iframes

Each card field (number, expiry, CVV) is rendered inside a Therius-hosted iframe. Your JavaScript and DOM never see the PAN.
5

User fills in card — SDK creates a one-time nonce

When the shopper submits the form, call sdk.createNonce(). The SDK returns a short-lived nonce that represents the card data.
6

Nonce sent to your server — server charges via API

Your page posts the nonce to your backend. Your server then calls POST /payment/purchase with the nonce to complete the charge.

Next steps

Session Bootstrap

Learn how to exchange your private API key for a client token on your server.

Hosted Fields

Build a fully custom card form while keeping raw card numbers out of your DOM.

Checkout Widget

Drop in a ready-made payment form with saved-card support in two lines of code.

Wallet Buttons

Add Apple Pay and Google Pay to your checkout with createWalletButton.