logo
Trustly Docs
BETA

Deposit

Accept payments from customers or deposits from players
Updated today

Overview

You can use the Deposit API method to accept payments from customers in general or accept deposits from players in gaming. For example, in a gaming app, you can integrate with Trustly so that players can make deposit in the game.

If you plan to use Deposit in the Netherlands, see iDeal.

Request parameters

Request example

Deposit
Deposit for money transfer business
Deposit for Partner with EMO
{
  "method": "Deposit",
  "params": {
    "Signature": "f4ThjuMqbsdG6u ... S16VbzD4h==",
    "UUID": "258a2184-2842-b485-25ca-293525152425",
    "Data": {
      "Username": "merchant_username",
      "Password": "merchant_password",
      "NotificationURL": "https://URL_to_your_notification_service/dajskldjakls123",
      "EndUserID": "12345",
      "MessageID": "your_unique_deposit_id",
      "Attributes": {
        "Country": "SE",
        "Locale": "sv_SE",
        "Currency": "SEK",
        "Amount": "103.00",
        "IP": "123.123.123.123",
        "MobilePhone": "+46709876543",
        "Firstname": "John",
        "Lastname": "Doe",
        "Email": "test@trustly.com",
        "NationalIdentificationNumber": "790131-1234",
        "SuccessURL": "https://yourpage.com/success",
        "FailURL": "https://yourpage.com/fail"
      }
    }
  },
  "version": "1.1"
}

Response attributes

The result returned is an object with the following elements:

Response example
{
  "result": {
    "signature": "4F8hjuMqbsH0Ku ... S16VbzRsw==",
    "uuid": "258a2184-2842-b485-25ca-293525152425",
    "method": "Deposit",
    "data": {
      "orderid": "2190971587",
      "url": "https://checkout.trustly.com/checkout?OrderID=1234567890&SessionID=..."
    }
  },
  "version": "1.1"
}

Failed deposits

If a credit notification has been sent, but Trustly never receives the funds, a debit notification will be sent to the merchant's NotificationURL. If you receive a debit after credit you should try to stop the order. If you are successfully able to stop the order before sending it to the end-user (or in case the user holds a balance on your side and you are able to lower the amount from their balance), you should respond with status "OK" to the debit notification. If you have already processed the order and are unable to recover the money you should respond with status "FAILED".

If you reply “OK” to the debit notification and the deposit still settles after that (which is not expected, but possible), Trustly's system will make an automatic refund to the end-user's bank account.

If you reply “FAILED” to the debit notification and the deposit settles after that, no automatic refund will be made.

You can trigger a debit notification in our test environment by running the D1 test case (see Acceptance testing.

Automatic refunds

If a Deposit is aborted during the payment process, a cancel notification is sent to the merchant. If Trustly for unknown reasons still receives the money for the Deposit, an automatic Refund is triggered and the end user will get the money back the the same bank account that they paid from. 

If the settlement report (ViewAutomaticSettlementDetailsCSV) is used by the merchant, both the settled Deposit and the automatic Refund will appear on the report. The sum of those two transactions will always be zero.

Error codes

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

Error NumError 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 s 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.
622ERROR_INVALID_CURRENCY_CODEThe currency code is invalid. See this page for valid currencies.
623ERROR_INVALID_PARAMETERSSome value or parameter in the deposit 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 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.
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
698ERROR_INVALID_IPThe IP attribute sent is invalid. Only one IP address can be sent.
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 may need to remove the following attributes from the Deposit data: RequestDirectDebitMandate, QuickDeposit, ChargeAccountID.
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.
732ERROR_PAY_AND_PLAY_NOT_ALLOWEDTrustly’s Pay N Play product is not enabled on the merchant’s user in Trustly’s system. If you want to use Pay N Play, please reach out to your Trustly contact.
734ERROR_NOT_SECURE_NOTIFICATIONURLThe NotificationURL must be using HTTPS, not plain HTTP.
737ERROR_INVALID_COUNTRYThe Country code sent in the Deposit data is invalid. The expected format is explained in Deposit with KYC attributes.