Establish Data

The Establish Data object is your gateway to kicking off bank authorization flows with Trustly. It’s the key structure that consolidates all the essential information—merchant credentials, transaction details, and customer data—needed to authorize transactions securely and reliably.

With a correctly configured Establish Data object, you'll be able to launch the Trustly UI (Lightbox or Select Bank Widget) giving users a simple way to authorize payments or share bank data. Once the flow is complete, you're ready to handle payments or retrieve data through Trustly’s APIs.

For more about how Trustly’s UI components work, check out the Trustly UI introduction.

This guide walks you through key usage details, including how to configure Establish Data for different scenarios, its base properties, practical examples for common use cases, and troubleshooting tips. Whether you’re working on one-time payments, recurring transactions, or bank account verification, this guide provides you with all the information you need to successfully integrate Trustly.

Usage

The establishData object is passed to the selectBankWidget or establish functions and is used to initialize the Bank Authorization for further processing.

The primary method for using Establish Data to initiate an authorization transaction is through the built-in methods of the Trustly UI libraries: establish and selectBankWidget. These methods both require the Establish Data as a parameter and if the provided data is valid, will launch a Trustly UI component.

For more details see the Trustly UI sections on Select Bank Widget or Launch the Lightbox.

Establish API (BETA)

An alternative to the Trustly UI, the Establish API can be used to generate a Trustly-hosted web page where a user can complete an authorization. This approach is useful for situations where Trustly cannot be easily integrated into an existing user experience but can also be valuable for early development and testing purposes, simplifying integration and reducing the compliance burden on your side.

Base Properties

The Establish Data object includes several base properties that are essential for successful integration. Below are the key properties you need to configure regardless of use case or industry requirements:

ParameterTypeRequiredDescription
accessIdStringTrueYour client application Access ID (provided by Trustly)
merchantIdStringTrueYour Trustly Merchant ID (provided by Trustly)
paymentTypeStringFalseSpecifies the type of transaction to create. Possible values are Deferred, Disbursement, Recurring, Verification, and Retrieval. Default value is Retrieval if not otherwise provided.
merchantReferenceStringTrueA unique identifier representing the transaction in your system. e.g. Order number or Payment ID number
returnUrlStringTrueRedirect URL to be called when a user successfully creates a bank authorization.
cancelUrlStringTrueRedirect URL to be called when a user cancels from the Lightbox or the bank authorization is otherwise unsuccessful.
notificationUrlStringFalseNotification URL for Trustly to send events (webhooks) associated with this transaction. If provided, overrides the default notification URL configured at the app level during onboarding.
requestSignatureStringTrueRequest Signature used to secure the request. See Securing Requests for more information.

Payment Properties

Payment properties define the key details of the transaction being processed. These fields are essential for specifying the transaction amount, providing context for the end user, and ensuring compliance with payment regulations. Most merchants using Trustly for payments are also required to include customer details, such as a name and address.

Note: Most payment properties will be required if the paymentType is set to Deferred, Instant or Recurring.

ParameterTypeDescription
amountFloatFor Instant payments, this is the transaction amount.
For Deferred payments, this is an optional limit for future capture transactions; the maximum amount of transactions that can be processed. (10 character max)
currencyString3-letter ISO Currency Code. Currently, only USD and CAD are supported.
descriptionStringA summary description of the order. Do not pass Consumer PII (name, email address, etc) in this field.
displayAmountStringThe amount to be displayed to the user during the Trustly Lightbox experience. This is often used in conjunction with the metadata.finishButtonLabelType field. Please note that this is for display purposes only, it has no impact on the actual bank authorization itself.
customerObjectCustomer of this payment. If the customer is already created you can send only the customerId attribute inside the customer object. See Customer Object.
recurrenceObjectRequired if paymentType is Recurring. Configuration options for recurring payments. See Recurrence Object.
metadataObjectUsed to customize components of the Trustly Lightbox. See MetaData Object.

Example Establish Data Object for a Deferred Payments Authorization.

{
  "merchantId": "YOUR_MERCHANT_ID",
  "accessId":"YOUR_ACCESS_ID",
  "requestSignature": {requestSignature},
  "merchantReference": {unique_merchant_payment_identifier},
  "description": "any additional user-friendly descriptive information for the payment",
  "paymentType": "Deferred",
  "currency": "USD",
  "amount": "0.00",
  "customer": {
    "name": "Joe User",
    "email": "[email protected]",
    "address": {
      "address1": "2000 Broadway St",
      "city": "Redwood City",
      "state": "CA",
      "zip": "94063",
      "country": "US"
    }
  },
  returnUrl: "https://yourapp.com/path/return",
  cancelUrl: "https://yourapp.com/path/cancel"
}

Additional Properties

A complete list of parameters can be found below. It is important to note that some optional parameters may be required due to the payment type and merchant conditions. Always consult your account representative when in doubt or experiencing unexpected behavior.

ParameterTypeDescription
accessIdStringYour client application access id. It will be provided to you.
accountObjectAccount information. Required if paymentType is Verification and a transactionId is not passed. See Account Object.
addressObjectShipping address of this payment is different from the customer's address. See Address Object.
allowedPaymentProviderTypesArray(String)Used to limit payment provider types available in the Trustly Lightbox. Possible values are 1 (Online Banking) and 2 (Manual Electronic Check)
amountFloatAn optional limit for future capture transactions. This represents the maximum amount of transactions that can be processed. (10 character max)
authTokenStringValue is new. Required if paymentType is Verification and transactionId is passed.
cancelUrlStringThe gateway redirects the customer browser to this URL if the customer cancels payment (must be a valid URL or function).
currencyString3-letter ISO Currency Code. Currently, only USD and CAD are supported.
customerObjectCustomer of this payment. If the customer is already created you can send only the customerId attribute inside the customer object. See Customer Object.
descriptionStringA summary description of the order. Do not pass Consumer PII (name, email address, etc) in this field.
displayAmountStringIf passed, this amount will be displayed during the Trustly Lightbox experience. This is often used in conjunction with the metadata.finishButtonLabelType field. Please note that this is for display purposes only, it has no impact on the actual bank authorization itself.
merchantIdStringYour Trustly Merchant Id. It will be provided to you.
merchantReferenceStringA unique identifier that you create to represent the Transaction in the Trustly system.
metadataObjectUsed to customize components of the Trustly Lightbox. See MetaData Object.
notificationUrlStringNotification URL to use for events associated with this transaction. Overrides the default notification URL configured at the merchant level.
returnUrlStringThe gateway redirects the customer browser to this URL if the customer authorizes payment (must be a valid URL or function).
paymentTypeStringSpecifies the type of transaction to create. Possible values are Deferred, Disbursement, Recurring, Verification, and Retrieval.
recurrenceObjectRequired if paymentType is Recurring. Configuration options for recurring payments. See Recurrence Object.
requestSignatureStringRequest Signature used to secure the request. See Securing Requests for more information.
transactionIdStringRequired if paymentType is Verification. Previous transactionId that needs to be verified (split token refresh or MCD flows).
verificationObjectUsed to set parameters to the fraud analysis engine. See Verification Object.
Do not pass Consumer PII in the `description` field. If you wish to pass Consumer PII, use the `customer` object.

Recurrence Object

See Capture Transaction for more information on using Trustly for Recurring Payments.

ParameterTypeRequiredDescription
frequencyUnitNumberTrueUnit that defines the frequency of payments based on the Frequency Unit Type.
frequencyUnitTypeNumberTrueCode that defines the frequency unit type (1: day, 2:week, 3: month, 4: year)
recurringAmountStringTruePayment amount for each scheduled payment. (10 characters with support for 2 decimal places)
automaticCaptureBooleanTrueSpecifies if this recurring payment will be processed by Trustly automatically per the Recurring schedule, or if a Capture API request will be made (also per the Recurring schedule).
startDateUnix Timestamp-Start date of the recurring payment. If not specified, the date of the authorization will be the start date.
endDateUnix Timestamp-End date of the recurring payment. If not specified, the recurring payment will be made according to the schedule until the authorization is canceled.
frequencyNumber-Unit that defines how many payments should be made per Frequency Unit. Defaults to 1.

Account Object

ParameterTypeRequiredDescription
accountNumberStringTrueBank Account Number.
routingNumberStringTrueBank Routing Number.
typeNumberTrueFinancial Institution Account Type.

Customer Object

ParameterTypeRequiredDescription
externalIdStringTrueYour external identifier for the Customer.
nameStringTrueUser's full name.
taxIdString*'Customer tax ID (e.g. SSN (US), SIN (CA)). May be required depending on industry and location.'
driverLicenseObject-User's Drivers License number. See Driver License Object.
vipString-VIP status or tier. See VIP tiers for more information.
addressObjectTrueAddress object representing the User's address.
phoneString*User's phone number in ITU E.164 format (ie, +14155551212). Required if channel contains sms.
emailString*User's email address. Required if channel contains email.
balanceString-User's current balance in your system. (10 characters with support for 2 decimal places)
currencyString-3-character ISO Currency Code of the User's balance.
enrollDateUnix TimestampTrueDate of the user's first transaction in your system, regardless of payment method used. This should be passed as a Unix Timestamp (epoch) in ms.
dateOfBirthString*User's date of birth (i.e. '1965-01-23'). Required for gaming merchants

Driver License Object

ParameterTypeRequiredDescription
numberStringTrueUser's Drivers License number.
stateStringTrue2-character ISO State code where the User's Drivers License was issued.

Address Object

ParameterTypeRequiredDescription
zipStringTrueAddress zip (5 digit US Zip Code).
address1StringTrueAddress Line 1.
address2String-Address Line 2.
cityStringTrueAddress City.
stateStringTrueAddress State (2 character ISO code).
countryStringTrueAddress Country (ISO 3166 Country Code).

Verification Object

ParameterTypeRequiredDescription
verifyCustomerBooleanTrueIf enabled and set to true, Trustly will only allow the transaction if the passed customer name and zip code match what is provided by the User's selected Bank Account.

Metadata Object

Additional data used for less common scenarios can be provided in the Metadata object.

ParameterTypeDescription
langStringConfigures the Lightbox to be displayed in the specified language. The value should be passed in the format {ISO 639 Language Code}_{ISO 3166 Country Code} (ie, de_DE or fr_CA). Defaults to en_US if not passed.
flowTypeStringConfigures the Lightbox to utilize a specific pre-configured user flow. Contact your Trustly point of contact for the flowType options available for your application.
finishButtonLabelTypeStringDynamically changes the final button in the Lightbox based on the specified value. Valid options are:

- continue displays 'Continue' (Default)
- deposit displays 'Deposit'
- withdraw displays 'Withdraw'
- pay displays 'Pay Now'
integrationContextStringConfigures Trustly UI to handle OAuth bank login flows in mobile applications. Accepted values are InAppBrowser, InAppBrowserNotify and ExternalBrowser. More details can be found in the OAuth and Mobile apps guide.
urlSchemeStringThe url associated with your mobile application. When users are directed to an external bank login or application on success or failure they will be redirected to this url. More details can be found in the OAuth and Mobile apps guide .
clcObjectIdentifying data for Trustly In-Person transactions. Requires Trustly In-Person configurations. See CLC object.

CLC Object

If configured for Trustly In-Person, the CLC object is required. Each property's requirement denoted below is only relevant for apps configured for Trustly In-person.

ParameterTypeRequiredDescription
propertyIdStringTrueID number for property or location
gamingAssetNumberStringTrueID number specific to Electronic Wagering System
datetimeQRStringTrueTimestamp of QR code generation
playerCardNumberStringFalsePlayer tracking number