Trustly uses conventional HTTP response codes to indicate success or failure of an API request.

HTTP Status CodeDescription
200 OKEverything worked as expected.
400 Bad RequestOften due to a missing, required parameter.
401 UnauthorizedInvalid accessId or accessKey.
500 Server errorInternal Trustly error.
503 Service UnavailableThe server is currently unable to handle the request due to a temporary overloading or server maintenance.

Sample Error response

{
   "errors": [
    {
      "domain" : "com.trustly.merchantgateway.v1.exception.InvalidParameterException",
      "code" : 200,
     "message" : "Could not find a transaction using Id 10000021"
    }
   ]
}

Not all errors map cleanly onto HTTP response codes, however. In addition to the HTTP response code, Trustly returns an array of error objects that describes the errors.

Error CodeDescription
100Internal error. An internal error (an internal database exception for example) occurred when trying to process the request.
150Remote error. A remote error (the consumer's bank interface is down) occurred when trying to process the request. This is an internal error.
200Invalid parameter error. One of the request parameters is invalid (sending an invalid amount format string for example).
210This is a duplicate request. It has been ignored.
300Security error. These are generic security errors that can happen when trying to process the request.
326Expired split token.
330Invalid account.
331Not enough balance.
375Access control error. This occurs when some security parameter (accessId, accessKey or requestSignature) is invalid and the request cannot be processed.
378Internal error or bank request error. Show the suggested User message on the payment method page and allow the User to try the payment again.
380Invalid Split Token.
390Fraud analysis. Suspicious transaction or negative data.