JavaScript SDK

The Trustist JavaScript SDK is the recommended way to start payments and standing orders from a browser. It renders the UI, loads the bank selector when needed, and drives the user through hosted or embedded payment flows, while your server keeps control of API calls.

Security note: the SDK runs in the browser, but API credentials must stay on your server. All payment and standing order creation must be done via your own backend endpoints.

Include the SDK

Load the SDK from Trustist and wait for trustistReadyCallback before initializing any flows.

Sandbox

<script src="https://sdk-sandbox.trustistecommerce.com/js/sdk.js?client-id=YOUR_CLIENT_ID" async></script>

Production

<script src="https://sdk.trustistecommerce.com/js/sdk.js?client-id=YOUR_CLIENT_ID" async></script>

Bootstrap

window.trustistReadyCallback = function () {
    // Initialize SDK flows here
};

What the SDK Can Do

Bank Selector Filters

Hosted and embedded payment flows can filter the list of banks shown to the payer.

Recommendation: for payment journeys, set the correct currency when you create the payment. Hosted payment pages will derive bank filtering from the underlying payment currency automatically.

For AIS-only bank selection or account-linking flows, bank-rail filtering is usually irrelevant and can be omitted.

Option Type Description
countryCode String Two-letter country code to scope the bank list, for example GB.
currency String Optional helper for SDK-driven bank-selector configuration. Hosted payment pages already infer bank filtering from the payment currency.
showCountrySelector Boolean Explicitly show or hide the country selector dropdown.

Existing integrations can continue to pass advanced bank-directory filters directly when needed, especially for AIS or specialist bank-directory use cases.

QR Options

Hosted and embedded flows can show a Trustist QR code on desktop for mobile handoff. You can suppress it if you want to keep the flow on the same device.

Option Type Description
qr.enabled Boolean Enable or disable the desktop QR code.

Retry Behaviour

Payments created via the TE API disable retry by default. If you want customers to retry a failed payment, set workflow.allowRetryOnFailure when you create the payment on your server.

Using payLink Without the SDK

If you are not using the JavaScript SDK, you can still influence the hosted and embedded checkout by appending querystring parameters to the payLink you receive from the TE API. For payment flows, you would normally only use presentation options such as countryCode, showCountrySelector, or showQr; the hosted payment page already knows the payment currency. AIS-only flows will usually only need countryCode.

https://pay.trustist.com/pay/{payIdString}?countryCode=GB&showCountrySelector=false&showQr=false

Server Responsibilities

Your backend must provide endpoints that the SDK calls for payments and standing orders.

  • Create payments and return a Trustist pay link
  • Optionally start payments for embedded bank flows and return the authorization URL
  • Verify final status after the payer returns to your site

Next Steps