Establish Data object

The Establish Data object consolidates the 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), and allow your customers to authorize payments or share bank data. Once the workflow is complete, you're ready to handle payments or retrieve data with the Trustly APIs.

For more information about how Trustly UI components work, see About Trustly UI.

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 initiating 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.

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 early development, testing, and situations where Trustly cannot be integrated into an existing user experience.

Parameter reference

The Establish Data object includes all required and optional parameters, grouped for clarity. Note that optional parameters may become required based on the paymentType and merchant conditions.

ParameterTypeRequiredDescription
accessIdStringTrueYour client application Access ID (provided by Trustly).
merchantIdStringTrueYour Trustly Merchant ID (provided by Trustly).
requestSignatureStringTrueRequest Signature used to secure the request. See Securing Requests for more information.
merchantReferenceStringTrueA unique identifier representing the transaction in your system (e.g., Order number or Payment ID).
returnUrlStringTrueRedirect URL to be called when a user successfully creates a bank authorization (Success URL).
cancelUrlStringTrueRedirect URL to be called when a user cancels from the Lightbox or the bank authorization is otherwise unsuccessful (Failure URL).
paymentTypeStringFalseSpecifies the type of transaction to create. Possible values are Deferred, Disbursement, Recurring, Verification, and Retrieval. Default value is Retrieval if not otherwise provided.
notificationUrlStringFalseNotification URL for Trustly to send events/webhooks associated with this transaction. Overrides the default configured URL.
amountFloat*Required for Instant payments. For Deferred payments, this is an optional limit for future capture transactions (10 character max).
currencyString*3-letter ISO Currency Code (e.g., USD or CAD). Required if amount is present.
descriptionString*A summary description of the order. Do not pass Consumer PII in this field.
displayAmountStringFalseThe amount displayed to the user during the Lightbox experience. This is for display purposes only and has no impact on the actual authorization.
customerObject*Customer of this payment. Required if payment properties are set. See [Customer Object].
recurrenceObject*Required if paymentType is Recurring. Configuration options for recurring payments. See Recurrence Object.
metadataObjectFalseUsed to customize components of the Trustly Lightbox. See [MetaData Object].
allowedPaymentProviderTypesArray(String)FalseUsed to limit payment provider types. Possible values: 1 (Online Banking) and 2 (Manual Electronic Check).
paymentProviderIdStringFalseIf provided, the Lightbox opens directly to the FI login page. ID must be retrieved from the List Payment Providers API.
addressObjectFalseShipping address, required if different from the customer's billing address. See Address Object.
accountObjectFalseAccount information. Required if paymentType is Verification and a transactionId is not passed. See Account Object.
authTokenStringFalseValue is new. Required if paymentType is Verification and transactionId is passed.
transactionIdStringFalsePrevious transactionId that needs to be verified (e.g., split token refresh). Required if paymentType is Verification.
verificationObjectFalseUsed to set parameters for the fraud analysis engine. See [Verification Object].

Note: Most payment properties (amount, currency, description, customer) are required if paymentType is set to Deferred, Disbursement, Instant, or Recurring.

{
  "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"
}

Object definitions

The following objects define the nested data structures required for submitting customer details, verification data, and recurrence rules.

Recurrence object

See Capture Transaction for more information on Recurring Payments.

ParameterTypeRequiredDescription
frequencyUnitNumberTrueUnit that defines the frequency of payments based on the frequencyUnitType.
frequencyUnitTypeNumberTrueCode that defines the frequency unit type (1: day, 2: week, 3: month, 4: year).
recurringAmountStringTruePayment amount for each scheduled payment. (10 characters, 2 decimal places max).
automaticCaptureBooleanTrueSpecifies if Trustly automatically processes the payment per schedule, or if a Capture API request is required.
startDateUnix TimestampFalseStart date of the recurring payment (defaults to the date of authorization).
endDateUnix TimestampFalseEnd date of the recurring payment (continues until authorization is canceled if not specified).
frequencyNumberFalseUnit that defines how many payments should be made per Frequency Unit (Defaults to 1).

Account object

ParameterTypeRequiredDescription
accountNumberStringTrueBank Account Number.
ibanStringFalseStandardized account number for global transfers. Conditionally, only use with paymentType verification and don't include an account number and routing number.
routingNumberStringTrueBank Routing Number.
typeNumberTrueFinancial Institution Account Type.

Customer object

ParameterTypeRequiredDescription
externalIdStringTrueYour external identifier for the Customer.
nameStringTrueUser's full name.
addressObjectTrueAddress object representing the User's address.
enrollDateUnix TimestampTrueDate of the user's first transaction in your system (Unix Timestamp in ms).
taxIdString*Customer tax ID (e.g., SSN, SIN). May be required depending on industry and location.
phoneString*User's phone number in ITU E.164 format. Required if channel contains sms.
emailString*User's email address. Required if channel contains email.
dateOfBirthString*User's date of birth (i.e. '1965-01-23'). Required for gaming merchants.
driverLicenseObjectFalseUser's Drivers License number. See [Driver License Object].
vipStringFalseVIP status or tier. See VIP tiers.
balanceStringFalseUser's current balance in your system (10 characters, 2 decimal places max).
currencyStringFalse3-character ISO Currency Code of the User's balance.

Verification object

ParameterTypeRequiredDescription
verifyCustomerBooleanTrueIf true, Trustly only allows the transaction if the passed customer name and zip code match the data provided by the User's selected Bank Account.

Address object

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

Driver license object

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

Metadata object

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

ParameterTypeDescription
langStringConfigures the Lightbox language ({ISO 639 Language Code}_{ISO 3166 Country Code}, e.g., de_DE). Defaults to en_US.
flowTypeStringConfigures the Lightbox to utilize a specific pre-configured user flow. Contact your Trustly point of contact for options.
finishButtonLabelTypeStringDynamically changes the final button label in the Lightbox. Valid options are: continue (Default), deposit, withdraw, pay.
integrationContextStringConfigures Trustly UI to handle OAuth bank login flows in mobile applications. Accepted values are InAppBrowser, InAppBrowserNotify and ExternalBrowser. See the OAuth and Mobile apps guide.
urlSchemeStringThe URL associated with your mobile application used for redirects on success or failure. See 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.

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