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.

Option Type Description
countryCode String Two-letter country code to scope the bank list, for example GB.
paymentRails Array or CSV string Filter banks by supported payment rails, for example ["FASTER_PAYMENTS", "SEPA_INSTANT", "SEPA"].
showCountrySelector Boolean Explicitly show or hide the country selector dropdown.

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.

https://pay.trustist.com/pay/{payIdString}?countryCode=GB&paymentRails=FASTER_PAYMENTS&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