AccountPayout

Introduction

The AccountPayout method is used by merchants to transfer money to their customer's bank accounts. The merchant specifies the receiving bank account in the AccountPayout call by using the AccountID parameter, which is a unique identifier generated by Trustly. The merchant can get the AccountID from the account notification which is sent after a SelectAccount or a Deposit order has been completed.

Alternatively, the RegisterAccount method can be used to get theAccountID, if the merchant already has the bank account details and want to register them in Trustly's system.

Funds must be transferred to the merchant's Trustly account before the payout can be made. No credit is given. To see how much money you have on your Trustly account you can use the Balance method or simply log in to the Trustly backoffice.

Example flow 1: SelectAccount + AccountPayout

  1. The merchant makes an API-call to SelectAccount and redirects the end-user to the url.
  2. The end-user logs in to their bank and selects their bank account.
  3. Trustly sends an account notification to the merchant's system with an AccountID for the selected account.
  4. The merchant makes an API-call to AccountPayout with the Amount and Currency to transfer.
  5. Trustly's API replies with a synchronous response to let the merchant know that the AccountPayout request was received.
  6. A Payout confirmation notification is sent to the merchant when the transfer has been confirmed. Note: this notification is not enabled by default. Please speak to your Trustly contact person if you want to have it enabled.
    If the payout fails, a credit notification is sent (see more details in the section "Failed Payouts" below).

Example flow 2: RegisterAccount + AccountPayout

  1. The merchant makes an API-call to RegisterAccount method with the recipient's bank account details.
  2. Trustly's RegisterAccount API responds with an AccountID of the recipient's account.
  3. The merchant makes an API-call to AccountPayout with the Amount and Currency to transfer.
  4. Trustly's API replies with a synchronous response to let the merchant know that the AccountPayout request was received.
  5. A Payout confirmation notification is sent to the merchant when the transfer has been confirmed. Note: this notification is not enabled by default. Please speak to your Trustly contact person if you want to have it enabled.
    If the payout fails, a credit notification is sent (see more details in the section "Failed Payouts" below).

An AccountID does not expire in Trustly's system, so it can be used for multiple AccountPayout requests.

Request parameters

Parameter nameDescriptionReq.TypeExample
UsernameThe username.YesTextjoe
PasswordThe password.YesTextsecret
NotificationURLThe URL to which notifications for this payment should be sent to. This URL should be hard to guess and not contain a ? ("question mark").YesTexthttps://example.com/trustly/
notification/a2b63j23dj
AccountIDThe AccountID received from an account notification to which the money shall be sent.YesText1234567890
EndUserIDID, username, hash or anything uniquely identifying the end-user requesting the withdrawal.

Preferably the same ID/username as used in the merchant's own backoffice in order to simplify for the merchant's support department.
YesText123123
MessageIDYour unique ID for the payout. If the MessageID is a previously initiated P2P order then the payout will be attached to that P2P order and the amount must be equal to or lower than the previously deposited amount.YesText12345678
AmountThe amount to send. See format in Currencies Only digits. Use dot (.) as decimal separator. If the end-user holds a balance in the merchant's system then the amount must have been deducted from that balance before calling this method.YesText98.02
CurrencyThe currency of the amount to send.YesTextSEK
AttributesAttributes for this method.YesObject{"ShopperStatement": "MyBrand.com"}

The parameter Attributes{} is an object of attributes. New attributes may be added in future versions of the API but existing attributes will never be removed.

Attributes

Attribute nameDescriptionRequired.TypeExample
ShopperStatementThe text to show on the end-user's bank statement after Trustly's own 10 digit reference (which always will be displayed first). The reference must let the end user identify the merchant based on this value. So the ShopperStatement should contain either your brand name, website name, or company name.

If possible, try to keep this text as short as possible to maximise the chance that the full reference will fit into the reference field on the customer's bank since some banks allow only a limited number of characters. If the full ShopperStatement does not fit into the reference it will be truncated from the end.
YesTextMyBrand.com
ExternalReferenceThe ExternalReference is a reference set by the merchant for any purpose and does not need to be unique for every API call. The ExternalReference will be included in version 1.2 of the settlement report, ViewAutomaticSettlementDetailsCSV.NoText23423525234
PSPMerchantHuman-readable identifier of the consumer-facing merchant (e.g. legal name or trade name)Yes*TextMerchant Ltd.
PSPMerchantURLURL of the consumer-facing website where the order is initiatedYes*Textwww.merchant.com
MerchantCategoryCodeVISA category codes describing the merchant's nature of business.Yes*Text5499
SenderInformationInformation about the Payer (ultimate debtor). This is required for some merchants and partners, see below.Yes**Object{"Firstname": "Steve"...}

🚧

* PSPMerchant, PSPMerchantURL and MerchantCategoryCode

PSPMerchant, PSPMerchantURL and MerchantCategoryCode are mandatory attributes for Trustly Partners that are using Express Merchant Onboarding and aggregate traffic under a master processing account. It is also mandatory for E-wallets used directly in a merchant's checkout, whereby the purpose of a Trustly transaction is to pay for goods/services by placing funds on the payer's e-money account ("funding stage") following an immediate transfer into the e-money account of the payee ( "payment" stage).

🚧

** SenderInformation

SenderInformation{} is mandatory to send in Attributes{} for money transfer services (including remittance houses), e-wallets, prepaid cards, as well as for Trustly Partners that are using Express Merchant Onboarding and aggregate traffic under a master processing account (other cases may also apply).

SenderInformation attributes

NameDescriptionRequiredTypeExample
PartytypePartytype can be "PERSON" or "ORGANISATION" (if the ultimate debtor is an organization/company).YesTextPERSON
AddressThe Payer's addressYesTextStreet 1, 12345 Barcelona
CountryCodeThe ISO 3166-1-alpha-2 code of the Payer's country.YesTextSE
FirstnameFirst name of the person (or the name of the organization)YesTextSteve
LastnameLast name of the person (empty for organization)YesTextSmith
CustomerIDPayment account number or an alternative consistent unique identifier which allows to identify the Payer in the system of the PSP of the Payer.

Note: this is not a transaction ID or similar. This identifier must stay consistent across all transactions relating to this Payer.
NoText123456789
DateOfBirthDate of birth for the person (YYYY-MM-DD) or organisational number for the organizationNoText1990-03-31

Code example

{
  "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"
}
{
  "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"
}
{
  "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"
}
{
    "result": {
        "signature": "K47hjudG6sH0Ku ... S16VbzfG8==",
        "uuid": "258a2184-2842-b485-25ca-293525152425",
        "method": "AccountPayout",
        "data": {
            "orderid": "7653345737",
            "result": "1"
        }
    },
    "version":"1.1"
}

The result returned is a hash with the following elements:

Hash keyDescriptionTypeExample
orderidThe globally unique OrderID the account payout order was assigned in our system.Text7653345737
result1 if the payout could be accepted and 0 otherwise.Text1

Failed payouts

In case an error occurs when processing the payout, a credit notification or cancel notification 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.