logo
Trustly Docs
BETA

SelectAccount

Let customers select their bank accounts within the Trustly flow
Updated 8 days ago

Overview

Initiates a new order where customers can select and verify one of their bank accounts.

You can find more information about how to present the Trustly URL in Trustly URL presentation.

When the account has been verified an Account notification is immediately sent to the NotificationURL.

A typical flow is:

  1. The merchant makes an API-call to SelectAccount and redirects the end-user to the url.

  2. The end-user selects his/her bank and completes the identification process.

  3. The end-user is redirected back to the merchant at the SuccessURL, note that the account might not be verified yet at this point.

  4. When the account is verified, Trustly sends an Account notification to the merchant's system with information about the selected account

Request parameters

Request example

Request example
{
  "method": "SelectAccount",
  "params": {
    "Data": {
      "Attributes": {
        "Country": "SE",
        "Firstname": "Steve",
        "IP": "83.140.44.184",
        "Lastname": "Smith",
        "Locale": "sv_SE",
        "Email": "test@trustly.com",
        "MobilePhone": "+46709876543",
        "NationalIdentificationNumber": "197901311234",
        "DateOfBirth": "1979-01-31",
        "SuccessURL": "https://your_success_page.com"
      },
      "EndUserID": "12345",
      "MessageID": "your_unique_id",
      "NotificationURL": "https://URL_to_your_notification_service",
      "Password": "merchant_password",
      "Username": "merchant_username"
    },
    "Signature": "Hh+sfaUnbtMKW[...]9YngA9bTpiqxw==",
    "UUID": "258a2184-2842-b485-25ca-293525152425"
  },
  "version": "1.1"
}

Response attributes

The result returned is a hash with the following attributes.

Response example
{
    "result": {
        "signature": "R9+hjuMqbsH0Ku ... S16VbzRsw==",
        "uuid": "258a2184-2842-b485-25ca-293525152425",
        "method": "SelectAccount",
        "data": {
            "orderid": "2190971587",
            "url": "https://trustly.com/_/bec96a48-d454-448e-a9ba-25fea8eeba3f"
        }
    },
    "version": "1.1"
}

Error codes

These error codes can be returned for SelectAccount calls. To handle errors, see Error handling.

Error NumberError CodeDescription
602ERROR_FUNCTION_ACCESS_DENIEDThe merchant does not have access to this function.
607ERROR_HOST_ACCESS_DENIEDThe IP address of the merchant has not been added to Trustly’s IP-whitelist.
616ERROR_INVALID_CREDENTIALSThe username and/or password used in the API call is incorrect.
620ERROR_UNKNOWNThere could be several reasons for this error, please reach out to your Trustly contact for details.
623ERROR_INVALID_PARAMETERSSome value or parameter in the API call does not match the expected format.
636ERROR_UNABLE_TO_VERIFY_RSA_SIGNATUREThe signature could not be verified using the merchant’s public key. Either the wrong private key was used to generate the signature, or the the data object used to create the signature was serialised incorrectly.
637ERROR_DUPLICATE_MESSAGE_IDThe MessageID sent in the API call has been used before.
639ERROR_NO_PUBLIC_KEYNo public key has been configured for the merchant on Trustly’s side.
642ERROR_INVALID_EMAILThe email attribute is missing or invalid (this is a requirement when using Trustly Direct Debit).
645ERROR_INVALID_LOCALEThe Locale attribute is sent with an incorrect value.
688ERROR_DUPLICATE_UUIDThis UUID has been used before.
696ERROR_ENDUSERID_IS_NULLThe EndUserID sent in the request is null
697ERROR_MESSAGEID_IS_NULLThe MessageID sent in the request is null
700ERROR_MALFORMED_SUCCESSURLThe SuccessURL sent in the request is malformed. It must be a valid http(s) address.
701ERROR_MALFORMED_FAILURLThe FailURL sent in the request is malformed. It must be a valid http(s) address.
702ERROR_MALFORMED_TEMPLATEURLThe TemplateURL sent in the request is malformed. It must be a valid http(s) address.
703ERROR_MALFORMED_URLTARGETThe URLTarget sent in the request is malformed.
704ERROR_MALFORMED_MESSAGEIDThe MessageID sent in the request is malformed.
705ERROR_MALFORMED_NOTIFICATIONURLThe NotificationURL sent in the request is malformed. It must be a valid https address.
706ERROR_MALFORMED_ENDUSERIDThe EndUserID sent in the request is malformed.
712ERROR_DIRECT_DEBIT_NOT_ALLOWEDTrustly Direct Debit (TDD) is not enabled on the merchant’s user in Trusty’s system. If you want to use TDD, please reach out to your Trustly contact. If you don’t want to use TDD and still get this error message, you need to remove the RequestDirectDebitMandate attribute from the SelectAccount data.
717ERROR_INVALID_ORDER_ATTRIBUTEOne or more attributes are sent with the incorrect value. Please reach out to your Trustly contact for more information.
718ERROR_DISABLED_USERThe merchant’s user is disabled in Trustly’s system.
734ERROR_NOT_SECURE_NOTIFICATIONURLThe NotificationURL must be using HTTPS, not plain HTTP.
737ERROR_INVALID_COUNTRYThe Country code is invalid.