logo
Trustly Docs
BETA

AccountPayout

Make payouts to customers' bank accounts without actions required from them
Updated 6 days ago

You can use the AccountPayout API method to transfer money to customers' bank accounts. To specify receiving bank accounts, the call needs to include AccountID parameter.

The AccountPayout method is used together with API methods SelectAccount and RegisterAccount in these situations:

  • When you do not have customers' bank account details, call SelectAccount so that customers can select their account for Trustly to respond with an accountid in an Account notification.

  • When you have customers' bank account details, call RegisterAccount so that Trustly will register the account and respond with an accountid in the response.

AccountPayout
{
  "method": "AccountPayout",
  "params": {
    "Signature": "K5+hjuMqbsH0Ku ... S16VbzRsw==",
    "UUID": "258a2184-2842-b485-25ca-293525152425",
    "Data": {
      "AccountID": "1234567890",
      "Amount": "800.00",
      "Attributes": {
        "ShopperStatement": "Trustly.com"
      },
      "Currency": "EUR",
      "EndUserID": "123123",
      "MessageID": "771463386074",
      "NotificationURL": "https://mynotifications.com/listener/f346212d",
      "Password": "*",
      "Username": "your_username"
    }
  },
  "version": "1.1"
}


AccountPayout for transfer services
{
  "method": "AccountPayout",
  "params": {
    "Signature": "K5+hjuMqbsH0Ku ... S16VbzRsw==",
    "UUID": "258a2184-2842-b485-25ca-293525152425",
    "Data": {
      "AccountID": "1234567890",
      "Amount": "800.00",
      "Attributes": {
        "SenderInformation": {
          "Address": "Street 1, 12345 Barcelona",
          "CountryCode": "ES",
          "CustomerID": "123456789",
          "DateOfBirth": "1990-03-31",
          "Firstname": "Steve",
          "Lastname": "Smith",
          "Partytype": "PERSON"
        },
        "ShopperStatement": "Trustly.com"
      },
      "Currency": "EUR",
      "EndUserID": "123123",
      "MessageID": "771463386074",
      "NotificationURL": "https://mynotifications.com/listener/f346212d",
      "Password": "*",
      "Username": "your_username"
    }
  },
  "version": "1.1"
}


AccountPayout for Partner with EMO
{
  "method": "AccountPayout",
  "params": {
    "Signature": "K5+hjuMqbsH0Ku ... S16VbzRsw==",
    "UUID": "258a2184-2842-b485-25ca-293525152425",
    "Data": {
      "AccountID": "1234567890",
      "Amount": "800.00",
      "Attributes": {
        "SenderInformation": {
          "Address": "Street 1, 12345 Barcelona",
          "CountryCode": "ES",
          "Firstname": "merchant_name",
          "Lastname": "",
          "Partytype": "ORGANISATION"
        },
        "PSPMerchant": "merchant_name",
        "PSPMerchantURL": "https://merchantURL.com/",
        "MerchantCategoryCode": "1234",
        "ShopperStatement": "merchant_name"
      },
      "Currency": "EUR",
      "EndUserID": "123123",
      "MessageID": "771463386074",
      "NotificationURL": "https://mynotifications.com/listener/f346212d",
      "Password": "*",
      "Username": "your_username"
    }
  },
  "version": "1.1"
}

The result returned is a hash with the following elements:

Response
{
    "result": {
        "signature": "K47hjudG6sH0Ku ... S16VbzfG8==",
        "uuid": "258a2184-2842-b485-25ca-293525152425",
        "method": "AccountPayout",
        "data": {
            "orderid": "7653345737",
            "result": "1"
        }
    },
    "version":"1.1"
}

In case an error occurs when processing the payout, a Credit notification or Cancel notification will be sent to the provided NotificationURL so that the merchant can flag the payout as failed in their system.

In case the end-user holds a balance on the merchant's system, the amount of the payout should be credited back to the end user's balance. Note that the credit notification will be sent AFTER the synchronous response containing "result":"1" has been sent, while a cancel notification can be sent at any point.

There are several reasons why an AccountPayout can fail after the "result":"1" response has been sent:

  1. There are not enough funds on the merchant's Trustly account. In this case the credit notification will be sent immediately after the AccountPayout request has been received.

  2. The funds are sent to the end user's bank account, but then later Trustly is notified by the bank that the transfer failed, for example if the recipient's bank account has been closed. This is usually very uncommon, but if it happens the credit notification can be sent several days after the AccountPayout request was sent.

  3. The transaction crashed, and was aborted before it was completed by Trustly.

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

New error codes can be added and existing error codes can be removed without notice.

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.
615ERROR_INVALID_AMOUNTThe Amount is invalid. The amount must be > 0 with 2 decimals.
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.
624ERROR_INVALID_BANK_ACCOUNT_NUMBERThe specified AccountID does not exist.
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 serialized incorrectly.
637ERROR_DUPLICATE_MESSAGE_IDThe MessageID has been used before.
638ERROR_ENDUSER_IS_BLOCKEDThe enduser that initiated the payment is blocked.
639ERROR_NO_PUBLIC_KEYNo public key has been configured for the merchant on Trustly’s side.
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
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.
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.