Hosted Redirect Payments
Use the JavaScript SDK to render a payment button and redirect the payer to a Trustist-hosted checkout. Your server creates the payment, the SDK handles the redirect, and your page receives the return callback.
payLink.
Flow Summary
- Render a payment button with the SDK.
- When clicked, the SDK calls your server to create a payment.
- Your server returns the
payLink. - The SDK redirects the payer to the hosted payment page.
- After completion, the payer returns to your page with
tr-payment-id.
Client Example
<div id="payment-button"></div>
<script src="https://sdk-sandbox.trustistecommerce.com/js/sdk.js?client-id=YOUR_CLIENT_ID" async></script>
<script>
window.trustistReadyCallback = function () {
const currency = "GBP";
trustist.ecommerce.Payment({
createPayment: () => {
return fetch("/api/payments", {
method: "post",
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
amount: 99.99,
currency: currency,
reference: "ORDER-12345",
returnUrl: window.location.origin + "/checkout/complete"
})
})
.then((response) => response.json())
.then((payment) => payment.payLink);
},
paymentComplete: (payment) => {
return fetch("/api/payments/" + payment["tr-payment-id"], {
method: "get"
})
.then((response) => response.json())
.then((paymentStatus) => {
if (paymentStatus.status === "COMPLETE") {
window.location.href = "/thank-you";
}
});
},
bankSelector: {
countryCode: "GB",
showCountrySelector: false
},
qr: {
enabled: true
}
}).render({
path: "#payment-button",
buttonText: "Pay now",
loadingText: "Redirecting..."
});
};
</script>
Server Responsibilities
- Create a payment using the Trustist Ecommerce API.
- Return the
payLinkto the SDK. - On return, verify payment status using
tr-payment-id.
To allow customers to retry a failed payment, set workflow.allowRetryOnFailure when you create the payment.
The default behaviour is to return the customer to your site on failure.
Filtering the Bank List
Hosted payments can apply bank filters via the bankSelector option.
The SDK appends the selected filters to the pay link before redirecting.
Defaults: the hosted page infers bank filtering from the payment currency and continues to use countryCode and
showCountrySelector only for bank-list presentation.
If you are not using the SDK, existing integrations can continue to append bank-filter query parameters directly to the payLink.
https://pay.trustist.com/pay/{payIdString}?countryCode=GB&showCountrySelector=false&showQr=false
| Option | Example | Description |
|---|---|---|
countryCode |
"GB" |
Limit the bank list to a specific country. |
currency |
"GBP" |
Optional compatibility input. Hosted payment pages already infer bank filtering from the payment currency. |
showCountrySelector |
false |
Hide the country selector dropdown on the hosted payment page. |
Existing integrations can continue to use advanced bank-directory filters directly when needed, but most payment flows do not need to.
QR Options
Hosted checkout shows a Trustist QR code on desktop by default. You can suppress it if you want to force on-screen bank selection.
| Option | Example | Description |
|---|---|---|
qr.enabled |
false |
Disable the desktop QR code on the hosted payment page. |