NAV
.NET (C#) PHP JAVA curl HTTP form

General

Overview

API endpoints:
Live - https://aapi.trustpay.eu/

OAuth

Getting access token

OAuth API endpoints:
Live - https://aapi.trustpay.eu/api/oauth2/token

This method grants you an authentication token that can be used to call other REST API methods from TrustPay.

Request

Obtain token example:

using System;
using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string OAuth()
{
   using (var client = new WebClient())
   {
      string url = "https://aapi.trustpay.eu/api/oauth2/token";
      string userName = "test";
      string password = "test";
      string auth = $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes($"{userName}:{password}"))}";
      client.Headers = new WebHeaderCollection
      {
         "Authorization:" + auth,
         "Content-Type: application/x-www-form-urlencoded"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();
      var request = Encoding.UTF8.GetBytes("grant_type=client_credentials");
      var responseData = client.UploadData(url, request);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));
      return response["access_token"];
   }
}


function GetToken($username, $password)
{
    $url = 'https://aapi.trustpay.eu/api/oauth2/token';
    $data = array('grant_type' => 'client_credentials');

    $auth = base64_encode("$username:$password");

    $options = array(
       'http' => array(
          'header'  => array(
             "Authorization:Basic $auth",
             "Content-type:application/x-www-form-urlencoded",
          ),
          'method'  => 'POST',
          'content' => http_build_query($data)
       ),
    );
    $context  = stream_context_create($options);
    $response = file_get_contents($url, false, $context);
    $response = json_decode(file_get_contents($url, false, $context), true);
    return $response['access_token'];
}

This code is using external library Jackson to parse text from and to json format
import org.codehaus.jackson.map.ObjectMapper; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Base64; import java.util.Map; public String OAuth(){ HttpsURLConnection con = null; try { URL obj = new URL("https://aapi.trustpay.eu/api/oauth2/token"); con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); String username = "abcdef"; String password = "123abc"; String encoded = "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); con.setRequestProperty("Authorization", encoded); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes("grant_type=client_credentials"); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } ObjectMapper JsonParser = new ObjectMapper(); Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized.get("access_token"); } catch(Exception ex){ throw new RuntimeException(ex.getMessage()); } finally { if(con != null) { con.disconnect(); } } }
Name Description Format Required
username ProjectID Varchar(20) Yes
password SecretKey Varchar(256) Yes

Response

Response example:
{
    "access_token":"L3_DbiQdateYLPYmp31AHEeErRzF84SVRcyr5Zw4jgw3CqDZjn4dbmVilTQx6dh_8ZbPztJGQh-9",
    "token_type":"Bearer",
    "expires_in":1799
}
Name Description Format
access_token Authorization token Varchar(235)
token_type Type of token Varchar(20)
expires_in Duration of recieved token Smallint

Callback Urls

Redirect examples:
When merchant SuccessUrl is https://somedomain.com/success
Then redirect url will https://somedomain.com/success?PaymentRequestId=123456&Reference=MerchhantReference

When merchant CancelUrl is https://somedomain.com/cancel
Then redirect url will https://somedomain.com/cancel?PaymentRequestId=123456&Reference=MerchhantReference

When merchant ErrorUrl is https://somedomain.com/error
Then redirect url will https://somedomain.com/error?PaymentRequestId=123456&Reference=MerchhantReference

After payment initiate, merchant is redirected to Callback Url filled in request or in project's settings depended of result of process. When result is Success or Processed, merchant will redirect to SuccessUrl. For Canceled result, CancelUrl will use. And ErrorUrl for Error, Timeout or Rejected results.

Callback Url Description
SuccessUrl Payment initiation was successful, now you can finish order process.
CancelUrl Customer cancels payment process.
ErrorUrl Error occurred during payment initiation, eg. card provider rejects the payment or request timed out, because of customer long time inactivity.

For easier payment identification, there are appended these two parameters:

Parameter Type Description
PaymentRequestId Numeric This is parameter returned in first API call's response or in notification
Reference Varchar(35) This is parameter contains string chose by merchant

Code lists

Supported currencies

The list of currencies (according to ISO 4217) supported by TrustPay.

Code ID Name
AUD 036 Australian Dollar
BAM 977 Bosnia and Herzegovina convertible mark
BGN 975 Bulgarian lev
CAD 124 Canadian Dollar
CHF 756 Swiss Franc
CZK 203 Czech koruna
DKK 208 Danish Krone
EUR 978 Euro
GBP 826 Pound sterling
HKD 344 Hong Kong Dollar
HRK 191 Croatian kuna
HUF 348 Hungarian forint
ILS 376 Israeli new shekel
JPY 392 Japanese yen
LTL 440 Lithuanian litas
LVL 428 Latvian lats
NOK 578 Norwegian Krone
PLN 985 Polish zloty
RON 946 Romanian leu
RSD 941 Serbian dinar
SEK 752 Swedish Krona
TRY 949 Turkish Lira
USD 840 United States dollar

Supported languages

The list of languages (according to ISO 639-1) supported by TrustPay.

Code Language SEPA Direct Debits
enEnglishYes
skSlovakYes

Result codes

The list of Result codes

ResultCode Description
1001000Success
1112008InvalidPaymentState
1112009RefundRejected
1122006AccountCurrencyNotAllowed
1130000MapiSuccess
1130001MapiPending
1130002MapiAnnounced
1130003MapiAuthorized
1130004MapiProcessing
1130005MapiAuthorizedOnly
1132000InvalidMapiRequest
1132001UnknownAccount
1132002MerchantAccountDisabled
1132003InvalidSign
1132004DisposableBalance
1132005TransactionNotFound
1132006UnsupportedTransaction
1132007GeneralMapiError
1132008UnsupportedCurrencyConversion
1132009UnknownMandate
1132010CanceledMandate
1132011MissingCid
1132012MandateAlreadyPaid
1132013AccountIsTesting
1132014RequestThrottled
1133000InvalidAuthentication
1133001ServiceNotAllowed
1133002PaymentRequestNotFound
1133003UnexpectedGateway
1133004MissingExternalId
1152000RiskDecline

Notifications

Notification Signature

Creating a secret key

You can view the project's secret key in TrustPay Merchant Portal under Technical Settings – Secret Key. You can view your secret key any time. You are also able to see the history of secret keys and generate a new key if required.

Creating a Notification signature


using System;
using System.Security.Cryptography;
using System.Text;

public static string GetSignature(string key, string message)
{
    using (var hmac = HMAC.Create("HMACSHA256"))
    {
        hmac.Key = Encoding.UTF8.GetBytes(key);
        byte[] signature = hmac.ComputeHash(Encoding.UTF8.GetBytes(message));
        return BitConverter.ToString(signature).Replace("-", "").ToUpperInvariant();
    }
}
    

function GetSignature($key, $message){
    return strtoupper(hash_hmac('sha256', pack('A*', $message), pack('A*', $key)));
}
    

public static String GetSignature(String key, String message) throws Exception
{
    byte[] keyBytes = key.getBytes("UTF-8");
    byte[] messageBytes = message.getBytes("UTF-8");
    javax.crypto.Mac mac = javax.crypto.Mac.getInstance("HmacSHA256");
    mac.init(new javax.crypto.spec.SecretKeySpec(keyBytes, mac.getAlgorithm()));
    return ByteArrayToHexString(mac.doFinal(messageBytes));
}

public static String ByteArrayToHexString(byte[] b)
{
    java.math.BigInteger bi = new java.math.BigInteger(1, b);
    return String.format("%0" + (b.length << 1) + "X", bi);
}
    

HMAC-SHA-256 (RFC 2104) code is used for checking the integrity of the data sent between TrustPay and Merchant. This Notification signature is created using the secret key and message data.
Data signature calculated from concatenated values of all values (in ASCII sorted order) in the notification. Slash character ('/') is used as separator. Not empty values are sorted in ascending order and then concatenated using the separator.
After computing the signature, it needs to be converted to hexadecimal uppercase string.

Functions for creating the signature in .NET C#, PHP and JAVA are provided by TrustPay.

Verification of Notification signature

Here you can verify your implementation to check the TrustPay Notification signature. Just enter your parameters and the signature you calculated and our tool will check whether the signature is valid or not. For parameters that are not relevant leave empty.

















































Transaction notifications

In MerchantPortal you can enable notifications not only about succeeded transactions but rejected, refunded and chargebacked too. These notifications differs from common ones by they Status property. Format of notifications is same for URL and email notifications.

Status
Rejected
Refunded
Chargebacked
Rejected card payment notification:

{
  "PaymentMethod": "Card",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": 10.00,
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Rejected",
    "StatusReasonInformation": {
      "Reason": {
        "Code": "100.390.103",
        "RejectReason": "PARes Validation failed - problem with signature"
      }
    },
    "References": {
      "MerchantReference": "1234567890",
      "PaymentRequestId": "72750",
      "ClearingSystemReference": "0207.0705.0926"
    },
    "CardTransaction": {
      "Card": {
        "MaskedPan": "499999******6854",
        "ExpiryDate": "12/22"
      }
    }
  },
  "Signature": "7C01C1206810674F3AFFAE0C9C6940CA6D1743A8056F68E30600493B7A60BF2D"
}

    

Refunds

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Refund

Refund request example:

{
    "MerchantIdentification": {
        "ProjectId": 4107123456
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": 6.00,
            "Currency": "EUR"
        },
        "References": {
            "MerchantReference": "Order 12345"
        }
    }
}

This function allows refunding or canceling (if it is possible) a transaction.

You can cancel SEPA Direct Debits with separate API request.

Request

Parameters are the same as for standard Purchase with more optional parameters, but endpoint url is different and these additional parameters have to be added to the request:

Refund example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string RefundPayment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Refund";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new 
         {
             ProjectId = 4107123456
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR",
             },
             References = new
             {
                 MerchantReference = "Order 12345"
             },
         },
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();
                
      var requestdata = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestdata);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));
      if (Encoding.UTF8.GetString(responseData) == "{}")
      {
         return "Refund was successful";
      }
      return response["ResultInfo"];
   }
}

function RefundPayment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Refund';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '4107123456'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
         'References' => array(
            'MerchantReference' => 'Order 12345'
          ),
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = file_get_contents($url, false, $context);
   if ($response == "{}"){
      return null;
   }
   throw new Exception(json_decode($response, true)['ResultInfo']);
}

This code is using external library Jackson to parse text from and to json format
import org.codehaus.jackson.map.ObjectMapper; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Map; public String RefundPayment(String token){ try { URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Refund"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-type", "application/json"); Object request = new Object() { public Object MerchantIdentification = new Object(){ public long ProjectId = 4107123456; }; public Object PaymentInformation = new Object(){ public Object Amount = new Object(){ public double Amount = 1.50; public String Currency = "EUR"; }; public Object References = new Object(){ public String MerchantReference = "Order 12345"; }; }; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } System.out.println(response); Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized.get("ResultInfo"); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the refund Amount Yes
References Reference (merchant’s payment identification) References No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the refund (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) No

Response

Response example:

{
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)

Payment Methods

Card Payments PopUp

Merchant's implementation has to include link to Merchant API JavaScript on it's page and load the TrustPay payment gateway inside an IFrame. Url to payment gateway is filled in response on initiate request. (Initiate request is json object, sent on API endpoint, as you can see in Payment example) The included JavaScript will style the IFrame so that it is hidden. It also contains the code necessary to show the payment gateway from the hidden IFrame as a popup overlaid over the merchant's e-shop. To allow users to show the payment gateway popup, the merchant needs to include some link/button/etc. with CSS class "show-popup" somewhere on the page. Onclick event handler that shows the popup will be automatically added to this element. Please see the example to the right.

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new card payment request.

Request

Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Card Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No
Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Card",
         MerchantIdentification = new
         {
             ProjectId = "4107123456"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 123.45,
                 Currency = "EUR",
             },
             Localization = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             CardTransaction = new 
             {
                PaymentType = "Purchase"
             }
         },
         CallbackUrls = new
         {
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Card',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'CardTransaction' => array(
            'PaymentType' => 'Purchase'
          )
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Card";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public Object CardTransaction = new Object(){
                        public String PaymentType = "Purchase";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Purchase

Purchase initiate request example:

{
    "PaymentMethod": "Card",
    "MerchantIdentification": {
        "ProjectId": 4107123456
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": 123.45,
            "Currency": "EUR"
        },
        "Debtor": {
            "Name": "John Debtor",
            "Address": {
                "PostCode": "83103",
                "City": "Bratislava",
                "CountryCode": "SK",
                "Lines": ["Street 1"]
            }
        },
        "Localization": "SK",
        "References": {
            "MerchantReference": "Order 12345"
        },
        "CardTransaction": {
            "PaymentType": "Purchase"
        }
    },
    "CallbackUrls": {
        "Notification": "https://somedomain.eu/notification_handler"
    }
}


Initiate response:

    {
        "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
        "PaymentRequestId":123123,
        "ResultInfo": {
            "ResultCode": 1001000,
            "AdditionalInfo": "Success"
        }
    }

        
HTML code:

        <script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
        <iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
        <a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
PaymentType In CardTransaction parameter set PaymentType to Purchase Varchar Yes

Preauthorization

This functionality allows merchant to perform preauthorization followed by a later capture. It is suitable in scenarios where reservation is required earlier than delivery of goods or services is possible.

When the merchant performs a preauthorization, the amount on the card is only reserved. This works in a similar way to standard transaction. Capture is performed later in the background by the merchant's system.

Preauthorization request example:

{
    "PaymentMethod": "Card",
    "MerchantIdentification": {
        "ProjectId": 4107123456
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": 123.45,
            "Currency": "EUR"
        },
        "Debtor": {
            "Name": "John Debtor",
            "Address": {
                "PostCode": "83103",
                "City": "Bratislava",
                "CountryCode": "SK",
                "Lines": ["Street 1"]
            },
            "Email": "email@email.eu"
        },
        "Localization": "SK",
        "References": {
            "MerchantReference": "Order 12345"
        },
        "CardTransaction": {
            "PaymentType": "Preauthorization"
        }
    },
    "CallbackUrls": {
        "Notification": "https://somedomain.eu/notification_handler"
    }
}

Parameters of request and response are the same as for standard Purchase, but there is one additional parameter required:

Name Description Format Required
PaymentType In CardTransaction parameter set PaymentType to Preauthorization Varchar Yes

Capture

Capture request example:

{
    "PaymentMethod": "Card",
    "MerchantIdentification": {
        "ProjectId": 4107123456
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": 123.45,
            "Currency": "EUR"
        },
        "Debtor": {
            "Name": "John Debtor",
            "Address": {
                "PostCode": "83103",
                "City": "Bratislava",
                "CountryCode": "SK",
                "Lines": ["Street 1"]
            },
            "Email": "email@email.eu"
        },
        "Localization": "SK",
        "References": {
            "MerchantReference": "Order 12345",
            "OriginalPaymentRequestId": 123456
        },
        "CardTransaction": {
            "PaymentType": "Capture"
        }
    },
    "CallbackUrls": {
        "Notification": "https://somedomain.eu/notification_handler"
    }
}        
Capture response example:

{
    "ResultCode": 0,
    "AcquirerResponseId": "000.100.112"
}

Once a transaction has been authorized, you can request a capture to complete the transaction. This is done by a background call using parameters received in the notification of the preauthorization.

Name Description Format Required
PaymentType In CardTransaction parameter set PaymentType to Capture Varchar Yes
OriginalPaymentRequestId In References parameter set OriginalPaymentRequestId to payment request ID from 1. response or from notification Numeric(10) Yes

Card On File

Card on file functionality allows merchants to store card tokens in their systems, without storing any sensitive card data (card number, expiry date, CVV code) and to subsequently use such tokens to process payments, without any need for the client (cardholder) to enter any card details during subsequent purchases.

Card On File request example:

{
    "PaymentMethod": "Card",
    "MerchantIdentification": {
        "ProjectId": 4107123456
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": 123.45,
            "Currency": "EUR"
        },
        "Localization": "SK",
        "References": {
            "MerchantReference": "Order 12345"
        },
        "CardTransaction": {
            "Card": {
                "Token": "8a8394851cfd3602015d0dc3f783355b"
            },
            "PaymentType": "Purchase"
        }
    },
    "CallbackUrls": {
        "Notification": "https://somedomain.eu/notification_handler"
    }
}}

Card On File response example:

{
    "PaymentRequestId": 123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

Parameters of request and response for card on file are the same as for standard payment, but these additional parameters have to be added to the request:

Name Description Format Required
PaymentType In CardTransaction parameter set PaymentType to Purchase Varchar Yes
Token In Card parameter fill Token from notification of Card On File - Registration payment Varchar(37) Yes

Card On File - Registration

Card On File - Registration request example:

{
    "PaymentMethod": "Card",
    "MerchantIdentification": {
        "ProjectId": 4107618141
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": 6.00,
            "Currency": "EUR"
        },
        "Debtor": {
            "Name": "John Debtor",
            "Address": {
                "PostCode": "83103",
                "City": "Bratislava",
                "CountryCode": "SK",
                "Lines": ["Street 1"]
            },
            "Email": "email@trustpay.eu"
        },
        "Localization": "sk",
        "References": {
            "MerchantReference": "Order 12345"
        },
        "CardTransaction": {
            "PaymentType": "Purchase",
            "RegisterCard": true
        }
    },
    "CallbackUrls": {
        "Notification": "https://somedomain.eu/notification_handler"
    }
}

To register card for later card on file purchases, a first purchase must be made that works similar to standard purchase, but this additional parameter is required:

Parameters of request and response for card on file authorization are the same as for standard payment, but these additional parameters have to be added to the request:

Name Description Format Required
PaymentType In CardTransaction parameter set PaymentType to Purchase Varchar Yes
RegisterCard In CardTransaction parameter set RegisterCard as True payment Boolean Yes

Card On File - Authorization

Card On File - Authorization request example:

{
    "PaymentMethod": "Card",
    "MerchantIdentification": {
        "ProjectId": 4107123456
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": 6.00,
            "Currency": "EUR"
        },
        "Localization": "sk",
        "References": {
            "MerchantReference": "Order 12345"
        },
        "CardTransaction": {
            "Card": {
                "Token": "8b8394855cfd3692025d0dc3f791355b"
            },
            "PaymentType": "Preauthorization",
        }
    },
    "CallbackUrls": {
        "Notification": "https://somedomain.eu/notification_handler"
    }
}

Parameters of request and response for card on file authorization are the same as for standard payment, but these additional parameters have to be added to the request:

Name Description Format Required
PaymentType In CardTransaction parameter set PaymentType to Preauthorization Varchar Yes
Token In Card parameter fill Token from notification of Card On File - Registration payment Varchar(37) Yes

Recurring Initial Transaction

Recurring transactions allow repetition of card payments. For instance, this allows merchant to implement auto-recharge payments or scheduled payments.

Merchants responsibilities:

Recurring Initial request example:

{
    "PaymentMethod": "Card",
    "MerchantIdentification": {
        "ProjectId": 4107123456
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": 123.45,
            "Currency": "EUR"
        },
        "Debtor": {
            "Name": "John Debtor",
            "Address": {
                "PostCode": "83103",
                "City": "Bratislava",
                "CountryCode": "SK",
                "Lines": ["Street 1"]
            },
            "Email": "email@email.eu"
        },
        "Localization": "sk",
        "References": {
            "MerchantReference": "Order 12345"
        },
        "CardTransaction": {
            "PaymentType": "Purchase",
            "Recurring": true
        }
    },
    "CallbackUrls": {
        "Notification": "https://somedomain.eu/notification_handler"
    }
}
Name Description Format Required
PaymentType In CardTransaction parameter set PaymentType to Purchase Varchar Yes
Recurring In CardTransaction parameter set Recurring to True Boolean Yes

Recurring Subsequent Transaction

Once an initial transaction was made, you can make repeated transactions. This is done by a background call using the parameters received in the notification of initial transaction.

Recurring Subsequent request example:

{
    "PaymentMethod": "Card",
    "MerchantIdentification": {
        "ProjectId": 4107123456
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": 123.45,
            "Currency": "EUR"
        },
        "Debtor": {
            "Name": "John Debtor",
            "Address": {
                "PostCode": "83103",
                "City": "Bratislava",
                "CountryCode": "SK",
                "Lines": ["Street 1"]
            },
            "Email": "email@email.eu"
        },
        "Localization": "sk",
        "References": {
            "MerchantReference": "Order 12345",
            "OriginalPaymentRequestId": 123456
        },
        "CardTransaction": {
            "PaymentType": "Purchase",
            "Recurring": true
        }
    },
    "CallbackUrls": {
        "Notification": "https://somedomain.eu/notification_handler"
    }
}

Recurring Subsequent response example:

{
    "PaymentRequestId": 123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format Required
PaymentType In CardTransaction parameter set PaymentType to Purchase Varchar Yes
Recurring In CardTransaction parameter set Recurring to True Boolean Yes
OriginalPaymentRequestId In References parameter set OriginalPaymentRequestId to payment request ID from Recurring Initial response or from notification Boolean Yes

Check required and optional parameters in Refunds section.

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information Yes
Country Format defined in ISO3166-1Alpha-2 Char(2) No
Localization Language Varchar(2) Yes
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes
CardTransaction Card Transaction Details CardTransaction Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Currency Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
AUD 036 Australian Dollar
BAM 977 Bosnia and Herzegovina convertible mark
BGN 975 Bulgarian lev
CAD 124 Canadian Dollar
CHF 756 Swiss Franc
CZK 203 Czech koruna
DKK 208 Danish Krone
EUR 978 Euro
GBP 826 Pound sterling
HKD 344 Hong Kong Dollar
HRK 191 Croatian kuna
HUF 348 Hungarian forint
ILS 376 Israeli new shekel
JPY 392 Japanese yen
LTL 440 Lithuanian litas
LVL 428 Latvian lats
NOK 578 Norwegian Krone
PLN 985 Polish zloty
RON 946 Romanian leu
RSD 941 Serbian dinar
SEK 752 Swedish Krona
TRY 949 Turkish Lira
USD 840 United States dollar

Request/PaymentInformation/Debtor

Name Description Format Required
Name Card holder's name (at least 3 characters) Varchar Yes
Address Debtor's address Address Yes
Email Customer email Varchar(254) Yes

Request/PaymentInformation/Debtor/Address

Name Description Format Required
PostCode Billing PostCode Varchar(30) Yes
City Billing City Varchar(80) Yes
CountryCode Billing Country (ISO 3166-1 alpha-2) Char(2) Yes
Lines Address lines string[] Yes

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId Fill when RecurringInitialTransaction or RecurringSubsequentTransaction PaymentType is used Numeric No

Request/CallbackUrls

Name Description Format Required
Success Url address to which the customer is redirected after successful payment Varchar(256) No
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No
Cancel Cancel URL (overrides default Cancel Return URL) Varchar(256) No
Error Error URL (overrides default Error Return URL) Varchar(256) No

Request/PaymentInformation/CardTransaction

Name Description Format Required
Card Card details Card No
PaymentType Payment Type PaymentType Yes
Recurring Set as True when RecurringInitialTransaction or RecurringSubsequentTransaction PaymentType is used Bool No
RegisterCard Set as True when CardOnFile PaymentType is used Bool No
Descriptor Description of the payment appearing on the bank statement Varchar(22) No

Request/PaymentInformation/CardTransaction/Card

Name Description Format Required
Token CardId Varchar(64) No

Payment Types

Value Description
Purchase Used in: Purchase, Card On File, Card On File - Registration, Recurring Initial Transaction, Recurring Subsequent Transaction
Preauthorization Used in: Preauthorization, Card On File - Authorization
Capture Used in: Capture

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Card payments notifications v3

Card payments URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Card",
  "MerchantIdentification": {
    "ProjectId": "41071234"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": 123.45,
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "merchant reference",
      "PaymentId": "12345678",
      "PaymentRequestId": "12345",
      "ClearingSystemReference": "6640.2103.6494"
    },
    "Debtor": {
      "Name": "John Debtor"
    },
    "CardTransaction": {
      "Card": {
        "MaskedPan": "420000******0000",
        "ExpiryDate": "12/21"
      }
    }
  },
  "Signature": "I63F2A2E869F515B8AA18AEC7EF495EA1C4185F6609FD9A6F815A3DE72872E19"
}


Card payments E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid, Authorized, Rejected Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor information Debtor Information Yes
DebtorAccount Debtor Account Information Debtor Account Information Yes
CardTransaction Card Transaction Details Card Transaction Information Yes

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) No1
PaymentRequestId Id of payment request Numeric(20) Always
ClearingSystemReference Clearing system reference Varchar(35) No

1 Field present for status Paid

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor Name Varchar(512) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor Iban Varchar(512) Always

Notification/PaymentInformation/CardTransaction

Name Description Format Included
Card Card Details Card Details Always

Notification/PaymentInformation/CardTransaction/Card

Name Description Format Included
MaskedPan Masked Card Number Varchar(16) Always
ExpiryDate Card Expiration Date Varchar(5) Always
Token Card ID that can be used to make card-on-file payments Varchar(64) No

Test cards

When you are testing your implementation in your test (onboarding) project, you can use these test cards to make simulated payments:

Card number Result when using this card
4200 0000 0000 0000
4200 0000 0000 1234
4200 0000 0000 5555
Payment is successful
4200 0000 0000 0001 Payment fails with result card expired
4200 0000 0000 0002 Payment fails with result card limit exceeded
4200 0000 0000 0003 Payment fails with result failed 3DS authentication
4200 0000 0000 0004 Payment fails with result insufficient funds
4200 0000 0000 0005 Payment fails with result invalid CVV
4200 0000 0000 0006 Payment fails with result invalid expiry date
4200 0000 0000 0007 Payment fails with result too many invalid tries
Any other card number Payment fails with result invalid card number

Card Payments EmbeddedFields

TrustPay Gateway Embedded Fields API is a web-based payment widget that the merchants can use to receive payments from their customers.

Together with TP.js it enables a simple, customizable and secure way to integrate payment forms into a website.

TrustPay Gateway supports the following payment methods:

Embedded Fields API endpoint:
Live - https://tpgw.trustpay.eu/client/v1/

Overview of the payment process:

  1. Customer creates an order on the merchant's site.
  2. (Server side) Merchant uses the order details and an API key to create a payment intent.
    As a result, the merchant receives an unique identifier instanceId and a set of secrets:
    • The instanceId represents TrustPay's payment reference. It can be used to (re)obtain a a payment's status or or in some requests (capture, refund, reverse) to reference a previous payment.
    • The set of secrets are used by the TP.js client to communicate with TrustPay services.
  3. (Merchant's site) HTML placeholder elements are placed on the website into which the payment components will be loaded.
  4. (Merchant's site) TrustPay TP.js API is used to process payments, see TrustPay TP.js API Declarations.
  5. (Server side) The merchant checks the payment status through a Transaction status call.

Prerequisites:

Initialization

Every TrustPay payment using Embedded Fields must start with the server side Create Intent call.

The merchant uses the Create Intent call to create a payment instance. The payment instance is a unique TrustPay entity that represents the intent to execute a payment. Its id (instanceId) can be used later to (re)obtain a payment's status or in some requests to reference a previous payment (applies to capture, reverse and refund).

Create Intent

Create Intent endpoint:
Live - https://tpgw.trustpay.eu/api/v1/intent

An authentication header X-API-KEY needs to be present this request.

Request

Name Description Format Required
X-API-KEY The merchant's TrustPay API key, this parameter is supplied via HTTP header Varchar(256) Yes
PaymentAction Payment action to execute1 PaymentAction No
PaymentType Payment type2 PaymentType No
Amount Amount of the payment Numeric(18,2)
en-US format
Yes
Currency Code of the payment's amount currency Currency Yes
Reference Merchant's reference Varchar(35) No
Descriptor Payment's description (appears on the bank statement) Varchar(22) No
NotificationUrl Notification URL (overrides default Notification URL) Varchar(256) No
InitApplePay If true, Apple Pay will be initialized3 Bool No
InitGooglePay If true, Google Pay will be initialized4 Bool No
Billing Address Data Customer's address Billing Address Data Yes
Customer Data Additional customer data Customer Data Yes
Cardholder Holder of the credit card account Varchar(255) No
threeDSecure.ChallengeIndicator Indicates whether a challenge is requested for this transaction ChallengeIndicator No
threeDSecure.ExemptionFlag Flags the transaction as exemption during authorization ExemptionFlag No

1 Default: Purchase
2 Default: Plain
3 appleInitResultData will be added to the response
4 googleInitResultData will be added to the response

Example of a create intent request:
    
curl --location --request POST 'https://tpgw.trustpay.eu/api/v1/intent' \
--header 'X-API-KEY: <YOUR_API_KEY>' \
--form 'paymentAction="0"' \
--form 'paymentType="plain"' \
--form 'amount="0.01"' \
--form 'currency="EUR"' \
--form 'reference="Reference"' \
--form 'notificationUrl="https://tpgw.trustpay.eu"' \
--form 'descriptor="\"Descriptor\""' \
--form 'initApplePay="true"' \
--form 'initGooglePay="true"' \
--form 'applePayApiVersion="4"' \
--form 'billing.city="Bratislava"' \
--form 'billing.country="SK"' \
--form 'billing.street1="Trnavske Myto 1234"' \
--form 'billing.postcode="83101"' \
--form 'customer.email="trustpay@trustpay.eu"' \
--form 'customer.ipAddress="127.0.0.1"' \
--form 'cardholder="Cardholder"'\
        
    

Response

Name Description Presence Type
status Create Intent call status always Status
description Description of the status always string
instanceId Unique operation/transaction identifier success string
secrets TrustPay's authorization secrets used by client success Secrets
appleInitResultData Data object to be used for Apple Pay conditional object
googleInitResultData Data object to be used for Google Pay conditional object
Example of a create intent response:
    
{
    "status": 0,
    "description": "payment intent successfully created",
    "instanceId": "Y5JuHHnGSrrlIKwd",
    "secrets": {
        "display": "1aDKdI...h2ywzJ",
        "payment": "msorzU...KS9Bit"
    },
    "appleInitResultData": {
        "countryCode": "SK",
        "currencyCode": "EUR",
        "supportedNetworks": [
            "visa",
            "masterCard"
        ],
        "merchantCapabilities": [
            "supports3DS"
        ],
        "total": {
            "label": "Description",
            "amount": "0.01"
        }
    },
    "googleInitResultData": {
        "apiVersion": 2,
        "apiVersionMinor": 0,
        "environment": "TEST",
        "merchantInfo": {
            "merchantName": "Cool Shop",
            "merchantId": "MID",
            "merchantOrigin": "cool.shop.eu"
        },
        "allowedPaymentMethods": [
            {
                "parameters": {
                    "allowedAuthMethods": [
                        "PAN_ONLY",
                        "CRYPTOGRAM_3DS"
                    ],
                    "allowedCardNetworks": [
                        "MASTERCARD",
                        "VISA"
                    ],
                    "assuranceDetailsRequired": true
                },
                "tokenizationSpecification": {
                    "type": "PAYMENT_GATEWAY",
                    "parameters": {
                        "gateway": "trustpay",
                        "gatewayMerchantId": "1"
                    }
                },
                "type": "CARD"
            }
        ],
        "transactionInfo": {
            "transactionId": "TID",
            "totalPriceStatus": "FINAL",
            "totalPrice": "0.01",
            "totalPriceLabel": "Description",
            "currencyCode": "EUR",
            "countryCode": "SK"
        }
    }
}
    
    

Card Payment

The most basic payment type supported by TrustPay Embedded Fields API is a card payment.

The merchant website embeds a card component provided by TrustPay so that the card details are collected within the TrustPay's trusted environment.

The benefit of this solution is two-fold:

TrustPay supports the following cards:

Integration

This section provides a description of the method used to include Embedded Fields on a website.

Server Side

  1. Initialize a payment request with a Create Intent call
    • Associate the instanceId received from the response with your order
  2. Provide secrets received from Create Intent call to the TP.js object

Client Side

1.
Add TrustPay v1.js JavaScript reference to your webpage
2.
Create TrustPayApi object in your JavaScript code
3.
Create a form to collect customer's card data

You have two options here:

  • Combined Card Component Layout
  • Custom Card Component Layout

3.1. Combined Card Component Layout
A card component layout that displays all three card data inputs (PAN, Expiration date and CVV) combined together in a single joint input.

You can style the card inputs, but you can't reorder them.

Example of this layout:



To create your own layout with the combined card component:

Card component placeholder:


 <div id="card-element"></div>

3.1.1. Place a card placeholder HTML element on your webpage

Card component creation:
                var cardComponent = trustPayApi.createComponent("card", {
     style: {
         // style properties to apply to the joint card data input and to the placeholder (see available properties)
     }
});
            

3.1.2. Create TrustPay's card component using TrustPayApi object in your JavaScript code

Card component creation:
                cardComponent.mount("#card-element"});
            

3.1.3. Mount the card component created to the placeholder HTML element

3.2. Custom Card Component Layout
Instead of creating one card component with a pre-built layout, you can arrange all the card components (Cardholder, PAN, Expiration date, CVV) separately and lay them out as needed.

Example of a custom layout:



To create your own layout with separate card components:

Card component mount:

<div id="card-holder"></div>
<div id="card-number"></div>
<div id="card-exp"></div>
<div id="card-cvv"></div>

3.2.1. Place HTML placeholders on your webpage for each of the card components (Cardholder, PAN, Expiration date, CVV)

Card components placeholders:

var cardHolderComponent = trustPayApi.createComponent("cardHolder", {
    style: {
        // style properties to apply to the card holder input and the placeholder (see available properties)
    }
});

var cardPanComponent = trustPayApi.createComponent("cardPan", {
    style: {
        // style properties to apply to the card number input and the placeholder (see available properties)
    }
});

var cardExpComponent = trustPayApi.createComponent("cardExpirationDate", {
    style: {
        // style properties to apply to the card pan input and the placeholder (see available properties)
    }
});

var cardCvvComponent = trustPayApi.createComponent("cardVerificationCode", {
    style: {
        // style properties to apply to the card cvv input and the placeholder (see available properties)
    }
});

3.2.2. Create the TrustPay's card components using TrustPayApi object in your JavaScript code

Card component mount:

cardHolderComponent.mount("#card-holder"});
cardPanComponent.mount("#card-number"})
cardExpComponent.mount("#card-exp");
cardCvvComponent.mount("#card-cvv"});

3.2.3. Mount the card components created to the placeholder corresponding HTML elements

4.
Create a Pay button on your webpage
Example of a pay button's click handler:

document.getElementById("button-pay").addEventListener("click", function(){
    // send card data to TrustPay and execute payment
    // payment secret can be found in secrets object you have received from server
    trustPayApi.finishCardPayment(paymentSecret, { card: cardComponent}).then(function(result) {
        if (result.status >= 0) {
            // the payment has completed successfully
            // execute additional payment status check on your server
            // show success to your customer
        } else {
            // the payment has failed
            // execute additional payment status check on your server
            // show error to your customer
        }
    })
    .catch(function(result) {
        // the payment has failed
        // show error to your customer
    });
});
5.
Register a click event handler for the Pay button
6.
Execute additional payment status check on the backend

Google Pay

Google Pay give your customers fast, hassle-free checkouts. TrustPay fully supports Google Pay and helps you integrate it into your webpage.

Integration

This section provides a description of the method used to enable Google Pay payments on your website.

Server Side

  1. Initialize a payment request with a Create Intent call
    • Set initGooglePay in the request to true
    • Associate the instanceId received from the response with your order
  2. Provide secrets and googleInitResultData received from Create Intent to the TP.js object

Client Side

1.
Add TrustPay v1.js JavaScript reference to your webpage
Add Google Pay script reference:

<script async src="https://pay.google.com/gp/p/js/pay.js" onload="onGooglePayScriptLoaded()"></script>
2.
Add Google Pay's JavaScript reference https://pay.google.com/gp/p/js/pay.js to your webpage
  • Don't forget to attach an event handler for the onload event
Create HTML placeholders:

<div id="placeholder-googlepay"></div>
<div id="placeholder-card"></div>
3.
Create an HTML element placeholder for the Google Pay button and TrustPay card component on your webpage
  • If you host the Google Pay button inside an iframe, set allowpaymentrequest attribute to the iframe element
Iframe with nested Google Pay button:

<iframe src="<url>" allowpaymentrequest></iframe>
    
4.
Create TrustPayApi object in your JavaScript code
Mount card component:

// you can create a single joint card data input component or a standalone card, cardNumber or cardCvv component
var cardComponent = trustPayApi.createComponent("card", {
    style: {
        // style properties to apply to any kind of card input component and to the placeholder (see available properties)
    }
});
cardComponent.mount("#placeholder-card");
5.
Mount a TrustPay Embedded Field
  • A combined card data input component or at least a PAN card data input component is required.
  • You can skip this s tep if you have already mounted such an Embedded Field card data input component.
Google Pay script onload event handler:

var googlePay;

function onGooglePayScriptLoaded(){
    // check whether we have googleInitResultData object
    if (googleInitResultData) {
        // create instance of TrustPay' GooglePay object
        googlePay = new trustpay.payments.api.GooglePay();
        // use GooglePay object to check whether the Google Pay is supported
        googlePay.isPaymentSupported().then(function(result) {
            if (result) {
                // Google Pay is supported in current environment
                // initialize Google Pay button
                initializeGooglePayButton();
            } else {
                // Google Pay is not supported in current environment
            }
        }).catch(function(error) {
            // Google Pay error
        });
    }
    else {
        // Google Pay can not be initialized (check if enabled for Project);
    }
}
6.
Add a handler that prepares Google Pay, preferably onload handler for the GooglePay' script

This handler should:

  1. Check whether googleInitResultData was present in Create Intent's response
  2. Create an instance of TrustPay's GooglePay object
  3. Use TrustPay's GooglePay object to check whether the Google Pay is supported
  4. Initialize the Google Pay button, if Google Pay is supported
Initialize Google Pay button:

function initializeGooglePayButton(){
    var buttonOptions = {
        onClick: () => {
            startGooglePayment();
        },
        buttonColor: "black",
        buttonType: "plain",
    };
    var googlePayButton = googlePay.getStyledButtonElement(buttonOptions);
    document.querySelector("#placeholder-googlepay").appendChild(googlePayButton );
}
7.
Add functionality that initializes the Google Pay button

In this step you should:

  1. Create the Google Pay button

    You can either use TrustPay' GooglePay method getStyledButtonElement to create the Google Pay button, or create it from scratch using a Google's guidelines.

    buttonOptions is of type: google.payments.api.ButtonOptions

  2. Attach an event handler for the button's click event to trigger the Google Pay payment process
  3. Place the button onto your website
Google Pay button click event handler:

function startGooglePayment(){
    googlePay.startPayment(googleInitResultData).then(function(googlePayData){
        // Google Pay encrypted payment data received
        finishGooglePayment(googlePayData);
    }).catch(function(error)){
        // Google Payment Sheet error (closed or failure)
    }
}
8.
Implement Google Pay button click event handler

This event handler should:

  1. Initialize the Google Pay payment process using TrustPay's GooglePay startPayment method
  2. Send the Google Pay payment data received from Google to TrustPay to execute the payment
Google Pay payment:

function finishGooglePayment(googlePayData){
    // send payment data received from Google to TrustPay and execute payment
    trustPayApi.finishGooglePayment(secrets.payment, googlePayData, { card: cardComponent }).then(function(result){
        if (result.status >= 0) {
            // the payment has completed successfully
            // execute additional payment status check on your server
            // show success to your customer
        }
        else {
            // the payment has failed`
            // execute additional payment status check on your server
            // show error to your customer
        }
    }).catch(function(result)){
        // the payment has failed
        // show error to your customer
    }
}
9.
Execute Google Pay payment using the TrustPayApi object

This function should:

  1. Send the payment data received from Google Pay to TrustPay
  2. Handle the result of the operation
10.
Execute a backend payment status check

Apple Pay

Apple Pay provides an easy way for your customer to securely pay through your online store.
TrustPay supports Apple Pay and helps you to integrate it into your webpage.

Integration

This section provides a description of the method used to enable Apple Pay payments on your website.

Server Side

  1. Initialize a payment request with a Create Intent call
    • Set initApplePay in the request to true
    • Associate the instanceId received from the response with your order
  2. Provide secrets and appleInitResultData received from Create Intent to the TP.js object

Client Side

1.
Add TrustPay v1.js JavaScript reference to your webpage
Add Apple Pay button to your webpage:

<btn id="button-applepay">Pay with Apple Pay</btn>
2.
Add an Apple Pay button element to your webpage
3.
Create TrustPayApi object in your JavaScript code
4.
Initialize Apple Pay payment

The handling here depends on whether you have obtained appleInitResultData from CreateIntent call.

Initialize Apple Pay payment:

if (TrustPayEnvironment.isApplePaySupported()) {
    // Apple Pay is supported
    initializeApplePayButton(appleInitResultData);
} else {
    // Apple Pay is not supported
}
  • In case you have already obtained appleInitResultData:
    1. Use TrustPayEnvironment to check whether Apple Pay is supported
    2. Initialize Apple Pay button, if Apple Pay is supported
Initialize Apple Pay payment:


trustPayApi.startApplePayment(secrets.payment).then(function(result){
    // Apple Pay is supported
    initializeApplePayButton(result.appleObject);
}).catch(function(result){
    // Apple Pay is not supported
});
  • In case you don't have appleInitResultData
    1. Use TrustPayApi's startApplePayment method to initialize Apple Payment
    2. Initialize Apple Pay button, if Apple Pay is supported
Initialize Apple Pay button:

function initializeApplePayButton(applePaymentData){
    var applePayButton = document.querySelector("#button-applepay");
    applePayButton.className = "apple-pay-button apple-pay-button-white";
    applePayButton.addEventListener("click", () => {
        this.finishApplePayment(applePaymentData);
    });
}
5.
Initialize Apple Pay button

If Apple Pay is supported, you can proceed to the initialization of the Apple Pay button.

Here you should:

  1. Style and display Apple Pay button to the customer
  2. Attach an event handler for click event that triggers Apple Pay payment process
Execute Apple Pay payment:

function finishApplePayment(applePaymentData){
    trustPayApi.finishApplePayment(secrets.payment, applePaymentData.appleObject).then(function(result){
        // send Apple Pay payment data to TrustPay to process payment
        if (result.code >= 0) {
            // the payment has completed successfully
            // execute additional payment status check on your server
            // show success to your customer
        } else {
            // the payment has failed
            // execute additional payment status check on your server
            // show error to your customer
        }
    }).catch(function(result)){
        // the payment has failed
        // show error to your customer
    }
}
6.

Execute Apple Pay payment using TrustPayApi

Here you should:

  1. Send the payment data received from Apple Pay API to TrustPay API
  2. Handle the payment result
7.
Execute a backend payment status check

Common Instructions

TP.js

Including TrustPay JavaScript API file

Example of including the TrustPayApi's script file:

<script type="text/javascript" src="https://tpgw.trustpay.eu/js/v1.js"></script>
        

Include the TrustPay's v1.js script in your webpage.

TrustPayApi object

Creating TrustPayApi object

Example of instantiating the TrustPayApi object:

var trustPayApi = new TrustPayApi(<secrets>);
        

Use the secrets received from a Create Intent call to create a TrustPayApi object instance.

Styling of the TrustPayApi's input components

Example of styling input components:

var cardComponent = trustPayApi.createComponent("card", {
    style: {
        fontFamily: "Arial, Helvetica, sans-serif",
        fontSize: "1em",
    }
});

Only a selected subset of the css styling properties are accepted by the TrustPayApi's card data input components. They are color, border, border-width, font-family, font-size, font-weight, outline, text-align, and letter-spacing.

Checking Payment Status

After you receive a payment status on the client-side, we recommend to do an additional payment status check on your backend using a Get Transaction Status call.

Use paymentStatus property to determine whether the payment was successful.

The paymentStatus has the following format: nnn.nnn.nnn,
where n is a number from the interval <0, 9>.

The payment is considered successful if the paymentStatus matches any of the following expressions:

Get Transaction Status call

Get Transaction Status call can be used to retrieve information about the operation.

Get Transaction Status endpoint:
Live - https://tpgw.trustpay.eu/api/v1/Instance/{instanceId}

Request

The instanceId needs to be provided as a GET parameter.

This API call is a HTTP GET request.

An authentication header X-API-KEY needs to be present in this request.

Example of a Get Transaction Status request:
    
curl https://tpgw.trustpay.eu/api/v1/Instance/{instanceId} \
    -H "X-API-KEY: <Merchant's TrustPay API Key>" -k
    

Response

Example of a Get Transaction Status response:
        
{
    "status": 0,
    "instanceId": "Y5JuHHnGSrrlIKwd",
    "created": "2021-01-12T16:55:05.0841239Z",
    "reference": "note to the future",
    "amount": "0.01",
    "currency": "EUR",
    "paymentStatus": "000.100.110",
    "paymentDescription": "Request successfully processed in 'Merchant in Integrator Test Mode'",
    "card": {
        "maskedPan": "************0000",
        "expiration": "10/22"
    }
}
    

Check the list of common PaymentStatus codes

Preauthorization

This functionality allows merchants to perform preauthorization followed by a later capture. It is suitable in scenarios where reservation is required earlier than delivery of goods or services is possible.

When the merchant performs a preauthorization, the amount on the card is only reserved. This works in a similar way as a standard transaction. Capture is performed later as a backend call by the merchant's system.

Once a transaction has been authorized, you can either request a capture to complete the transaction or reverse to revert the transaction. This is done by the merchant using a backend call.

Integration

1.
Initialize a payment request with a Create Intent call

This is the same process as with a standard Card Payment operation, but there is one additional PaymentAction parameter required:

Name Description Format Required
PaymentAction Must be set to Preauthorization PaymentAction Yes
2.
Let the customer execute the payment
3.
Capture or Reverse the payment using our backend S2S API call

Recurring Payment

Recurring transactions allow repetition of card payments. For instance, this allows merchant to implement auto-recharge payments or scheduled payments.

Once the customers give permission to the merchant, the amount can be deducted at predefined intervals until the customer retracts their permission or the subscription expires.

Once an initial transaction was made, you can make repeated transactions. This is done by a backend call using the parameters received in the Create Intent call.

Integration

1.
Initialize a payment request with a Create Intent call

This is the same process as with a standard Card Payment operation, but there is one additional PaymentType parameter required:

Create Intent parameters are the same as for standard Create Intent, but there is one additional parameter PaymentType required:

Name Description Format Required
PaymentType Must be set to RecurringInitial PaymentType Yes
2.
Let the customer execute the initial payment
3.
Maintain a payment schedule using our backend S2S Subsequent Recurring Payment call

Common Types

Request

PaymentType

PaymentType is an enumeration type.

Value Description
Plain Ordinary payment request, implicit
RecurringInitial The first payment of a recurring payment request
RecurringSubsequent Subsequent payment of recurring payment request

PaymentAction

PaymentAction is an enumeration type.

Value Description
Purchase Ordinary purchase request, implicit
Preauthorization Reserve amount on customer's credit card, must be release later by Capture/Reverse

Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of commonly used currencies:

Code ID Name
CZK 348 Czech koruna
EUR 978 Euro
HUF 203 Hungarian forint
USD 840 United States dollar

Response

Status

Status is an integer type that represents server call status.

Value Description
0 Call succeeded
1 Call succeeded, pending operation
< 0 Failure

Secrets

Object that holds client secrets, consisting of:

Property Description
display Used internally by TrustPay API to load widgets
payment Used by the customer to execute payment

Card Payments ServerToServer

TrustPay Gateway API (TPGW API) allows for a direct communication with payment provider.

API endpoints:
Live - https://tpgw.trustpay.eu/api/v1

Requests to TPGW API are made as HTTP POST requests with parameters sent as form data if not specified otherwise.

All parameter names are case-insensitive.

Most of the requests to TPGW API return a unique operation identifier - InstanceId. This can be used to (re)obtain a payment's status or in some requests to reference a previous payment.

Authentication

An authentication header X-API-KEY needs to be present in all TPGW API requests.

Purchase

Represents a basic payment request.

Purchase endpoint:
Live - https://tpgw.trustpay.eu/api/v1/purchase

Plain purchase request

Name Description Format Required
PaymentType Set to Plain for basic payment PaymentType No
Amount The payment's amount Numeric(18,2) Yes
Currency Code of the payment's amount currency Currency Yes
Card Data Credit/Debit card data information Card Data Yes
Reference Merchant's reference Varchar(35) No
URLs URLs No
Billing Address Data Customer's address Billing Address Data Yes
Customer Data Additional customer data Customer Data Yes
Browser Data Customer's browser information Browser Data Yes
3DS Data Authentication data generated by the 3D Secure MPI 3DS Data No*
Descriptor Payment's description (appears on the bank statement) Varchar(22) No

* Required when using a third-party MPI.

Example of a purchase request:
    
 curl https://tpgw.trustpay.eu/api/v1/purchase \
 -d "Amount=0.01" \
 -d "Currency=EUR" \
 -d "Pan=4200000000000000" \
 -d "Cvv=123" \
 -d "Exp=01/24" \
 -d "Cardholder=Honourable Gentleman" \
 -d "Reference=not a flamethrower" \
 -d "NotificationUrl=https://tpgw.trustpay.eu" \
 -d "RedirectUrl=https://tpgw.trustpay.eu" \
 -d "Billing.City=Bratislava" \
 -d "Billing.Country=SK" \
 -d "Billing.Street1=Test street No.1" \
 -d "Billing.Postcode=01234" \
 -d "Customer.Email=gentleman@trustpay.eu" \
 -d "Customer.Ipaddress=127.0.0.1" \
 -d "Browser.AcceptHeader=*" \
 -d "Browser.Language=en-US" \
 -d "Browser.ScreenHeight=1080" \
 -d "Browser.ScreenWidth=1920" \
 -d "Browser.Timezone=3600" \
 -d "Browser.UserAgent=none" \
 -d "Browser.JavaEnabled=false" \
 -d "Browser.JavaScriptEnabled=true" \
 -d "Browser.ScreenColorDepth=24" \
 -d "Browser.ChallengeWindow=1" \
 -H 'X-API-KEY: YOUR_API_KEY'
        
    
And a successful response:
    
{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "dlfunKRnrpN_tuih23wJzw",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed"
}
        
    

Recurring Purchase

A recurring payment is subsequent to some initial payment which it must reference in some way. You may reference to an initial TPGW payment by it's InstanceId while not providing the card data or you may reference to any initial payment by its CardSchemeTxId while providing the card data.

Initial recurring

To set-up new recurring payments via TPGW you need first to create an initial recurring payment. A succesful response includes its InstanceId required for future reference.

Initial recurring purchase request

Name Description Format Required
PaymentType Set to RecurringInitial PaymentType Yes
Amount The payment's amount Numeric(18,2) Yes
Currency Code of the payment's amount currency Currency Yes
Card Data Credit/Debit card data information Card Data Yes
Reference Merchant's reference Varchar(35) No
URLs URLs No
Billing Address Data Customer's address Billing Address Data Yes
Customer Data Additional customer data Customer Data Yes
Browser Data Customer's browser information Browser Data Yes
3DS Data Authentication data generated by the 3D Secure MPI 3DS Data No*
Descriptor Payment's description (appears on the bank statement) Varchar(22) No

* Required when using a third-party MPI.

Example of an initial recurring payment request:
    
 curl https://tpgw.trustpay.eu/api/v1/purchase \
 -d "PaymentType=RecurringInitial" \
 -d "Amount=0.01" \
 -d "Currency=EUR" \
 -d "Pan=4200000000000000" \
 -d "Cvv=123" \
 -d "Exp=01/24" \
 -d "Reference=not a flamethrower" \
 -d "NotificationUrl=https://tpgw.trustpay.eu" \
 -d "RedirectUrl=https://tpgw.trustpay.eu" \
 -d "Billing.City=Bratislava" \
 -d "Billing.Country=SK" \
 -d "Billing.Street1=Test street No.1" \
 -d "Billing.Postcode=01234" \
 -d "Customer.Email=gentleman@trustpay.eu" \
 -d "Customer.Ipaddress=127.0.0.1" \
 -d "Browser.AcceptHeader=*" \
 -d "Browser.Language=en-US" \
 -d "Browser.ScreenHeight=1080" \
 -d "Browser.ScreenWidth=1920" \
 -d "Browser.Timezone=3600" \
 -d "Browser.UserAgent=none" \
 -d "Browser.JavaEnabled=false" \
 -d "Browser.JavaScriptEnabled=true" \
 -d "Browser.ScreenColorDepth=24" \
 -d "Browser.ChallengeWindow=1" \
 -H 'X-API-KEY: YOUR_API_KEY'
        
    
And a successful response:
    
{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "I1D0Uf9niYSUqCZ259yMJg",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302083458578661"
}
        
    

Subsequent recurring

A subsequent TPGW recurring purchase uses card data stored by TPGW while a subsequent non-TPGW recurring purchase does not. (Read more.)

Subsequent TPGW recurring purchase

To execute a subsequent recurring payment reference to an initial TPGW recurring payment by its InstanceId.

Subsequent TPGW recurring purchase request

Name Description Format Required
PaymentType Set to RecurringSubsequent PaymentType Yes
InstanceId InstanceId of the initial payment Varchar(32) Yes
Amount The payment's amount Numeric(18,2) Yes
Currency Code of the payment's amount currency Currency Yes
Reference Merchant's reference Varchar(35) No
URLs URLs No
Billing Address Data Customer's address Billing Address Data Yes
Customer Data Additional customer data Customer Data Yes
Browser Data Customer's browser information Browser Data Yes
3DS Data Authentication data generated by the 3D Secure MPI 3DS Data No*
Descriptor Payment's description (appears on the bank statement) Varchar(22) No

* Required when using a third-party MPI.

Example of a subsequent TPGW recurring payment request
    
 curl https://tpgw.trustpay.eu/api/v1/purchase \
 -d "PaymentType=RecurringSubsequent" \
 -d "InstanceId=I1D0Uf9niYSUqCZ259yMJg" \
 -d "Amount=0.01" \
 -d "Currency=EUR" \
 -d "Reference=not a flamethrower" \
 -d "NotificationUrl=https://tpgw.trustpay.eu" \
 -d "RedirectUrl=https://tpgw.trustpay.eu" \
 -d "Billing.City=Bratislava" \
 -d "Billing.Country=SK" \
 -d "Billing.Street1=Test street No.1" \
 -d "Billing.Postcode=01234" \
 -d "Customer.Email=gentleman@trustpay.eu" \
 -d "Customer.Ipaddress=127.0.0.1" \
 -d "Browser.AcceptHeader=*" \
 -d "Browser.Language=en-US" \
 -d "Browser.ScreenHeight=1080" \
 -d "Browser.ScreenWidth=1920" \
 -d "Browser.Timezone=3600" \
 -d "Browser.UserAgent=none" \
 -d "Browser.JavaEnabled=false" \
 -d "Browser.JavaScriptEnabled=true" \
 -d "Browser.ScreenColorDepth=24" \
 -d "Browser.ChallengeWindow=1" \
 -H 'X-API-KEY: YOUR_API_KEY'
        
    
And a successful response:
    
{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "E0omTN9iYMcQxKs1MLBZ_g",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302084259578665"
}
        
    

Subsequent non-TPGW recurring purchase

To relay a subsequent recurring payment without the initial recurring payment executed via TPGW reference to it with its CardSchemeTxId and provide the card data.

Subsequent non-TPGW recurring purchase request

Name Description Format Required
PaymentType Set to RecurringSubsequent PaymentType Yes
CardSchemeTxId Reference to an initial recurring payment CardSchemeTxId Yes
Card Data Credit/Debit card data information Card Data Yes
Amount The payment's amount Numeric(18,2) Yes
Currency Code of the payment's amount currency Currency Yes
Reference Merchant's reference Varchar(35) No
URLs URLs No
Billing Address Data Customer's address Billing Address Data Yes
Customer Data Additional customer data Customer Data Yes
Browser Data Customer's browser information Browser Data Yes
3DS Data Authentication data generated by the 3D Secure MPI 3DS Data No*
Descriptor Payment's description (appears on the bank statement) Varchar(22) No

* Required when using a third-party MPI.

Example of a subsequent non-TPGW recurring payment request:
    
 curl https://tpgw.trustpay.eu/api/v1/purchase \
 -d "PaymentType=RecurringSubsequent" \
 -d "CardSchemeTxId=302083458578661"\
 -d "Amount=0.01" \
 -d "Currency=EUR" \
 -d "Pan=4200000000000000" \
 -d "Cvv=123" \
 -d "Exp=10/22" \
 -d "Reference=not a flamethrower" \
 -d "NotificationUrl=https://tpgw.trustpay.eu" \
 -d "RedirectUrl=https://tpgw.trustpay.eu" \
 -d "Billing.City=Bratislava" \
 -d "Billing.Country=SK" \
 -d "Billing.Street1=Test street No.1" \
 -d "Billing.Postcode=01234" \
 -d "Customer.Email=gentleman@trustpay.eu" \
 -d "Customer.Ipaddress=127.0.0.1" \
 -d "Browser.AcceptHeader=*" \
 -d "Browser.Language=en-US" \
 -d "Browser.ScreenHeight=1080" \
 -d "Browser.ScreenWidth=1920" \
 -d "Browser.Timezone=3600" \
 -d "Browser.UserAgent=none" \
 -d "Browser.JavaEnabled=false" \
 -d "Browser.JavaScriptEnabled=true" \
 -d "Browser.ScreenColorDepth=24" \
 -d "Browser.ChallengeWindow=1" \
 -H 'X-API-KEY: YOUR_API_KEY'
        
    

And a successful response:
    
{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "fx3-muUbTWT009tm-jNTXw",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302085824578925"
}
        
    

Card on File Purchase

A basic purchase may be requested to store the card data. Such purchase shall generate a unique handle for the end consumer of the service. You may register a card within TPGW and reference to it with the provided CardId or you may relay a subsequent Card on File transaction with providing the card data on your own.

Initial Card on File

A basic purchase can be marked as an initial card on file purchase in order to store the card data. Successful request returns the card's unique CardId which can be later used to reference to the card data without actually providing it.

Initial Card on File purchase request

Name Description Format Required
PaymentType Set to CardOnFileInitial PaymentType Yes
Card Data Credit/Debit card data information Card Data Yes
Amount The payment's amount Numeric(18,2) Yes
Currency Code of the payment's amount currency Currency Yes
Reference Merchant's reference Varchar(35) No
URLs URLs No
Billing Address Data Customer's address Billing Address Data Yes
Customer Data Additional customer data Customer Data Yes
Browser Data Customer's browser information Browser Data Yes
3DS Data Authentication data generated by the 3D Secure MPI 3DS Data No*
Descriptor Payment's description (appears on the bank statement) Varchar(22) No

* Required when using a third-party MPI.

Example of an initial Card on File payment request:
    
 curl https://tpgw.trustpay.eu/api/v1/purchase \
 -d "PaymentType=CardOnFileInitial" \
 -d "Amount=0.01" \
 -d "Currency=EUR" \
 -d "Pan=4200000000000000" \
 -d "Cvv=123" \
 -d "Exp=01/24" \
 -d "Cardholder=Honourable Gentleman" \
 -d "Reference=not a flamethrower" \
 -d "NotificationUrl=https://tpgw.trustpay.eu" \
 -d "RedirectUrl=https://tpgw.trustpay.eu" \
 -d "Billing.City=Bratislava" \
 -d "Billing.Country=SK" \
 -d "Billing.Street1=Test street No.1" \
 -d "Billing.Postcode=01234" \
 -d "Customer.Email=gentleman@trustpay.eu" \
 -d "Customer.Ipaddress=127.0.0.1" \
 -d "Browser.AcceptHeader=*" \
 -d "Browser.Language=en-US" \
 -d "Browser.ScreenHeight=1080" \
 -d "Browser.ScreenWidth=1920" \
 -d "Browser.Timezone=3600" \
 -d "Browser.UserAgent=none" \
 -d "Browser.JavaEnabled=false" \
 -d "Browser.JavaScriptEnabled=true" \
 -d "Browser.ScreenColorDepth=24" \
 -d "Browser.ChallengeWindow=1" \
 -H 'X-API-KEY: YOUR_API_KEY'
        
    

And a successful response:
    
{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "TBtibCHdPY-NWW56v3q3WQ",
    "cardId": "45505032-b673-19a1-de3f-512ee9fa3ffc",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302090102578979"
}
        
    

Subsequent Card on File

A subsequent TPGW Card on File purchase uses card data stored by TPGW while a subsequent non-TPGW Card on File purchase does not. (Read more.)

Subsequent TPGW Card on File purchase

A subsequent TPGW Card on File purchase must provide the CardId from the initial payment instead of the card data.

Subsequent TPGW Card on File purchase request

Name Description Format Required
PaymentType Set to CardOnFileSubsequent PaymentType Yes
CardId Reference to the card used in the initial payment Varchar(40) Yes
CardSchemeTxId Reference to an initial recurring payment CardSchemeTxId No
Amount The payment's amount Numeric(18,2) Yes
Currency Code of the payment's amount currency Currency Yes
Reference Merchant's reference Varchar(35) No
URLs URLs No
Billing Address Data Customer's address Billing Address Data Yes
Customer Data Additional customer data Customer Data Yes
Browser Data Customer's browser information Browser Data Yes
3DS Data Authentication data generated by the 3D Secure MPI 3DS Data No*
Descriptor Payment's description (appears on the bank statement) Varchar(22) No

* Required when using a third-party MPI.

Example of a subsequent TPGW Card on File payment request:
    
 curl https://tpgw.trustpay.eu/api/v1/purchase \
 -d "PaymentType=CardOnFileSubsequent" \
 -d "CardId=45505032-b673-19a1-de3f-512ee9fa3ffc" \
 -d "Amount=0.01" \
 -d "Currency=EUR" \
 -d "Cardholder=Honourable Gentleman" \
 -d "Reference=not a flamethrower" \
 -d "NotificationUrl=https://tpgw.trustpay.eu" \
 -d "RedirectUrl=https://tpgw.trustpay.eu" \
 -d "Billing.City=Bratislava" \
 -d "Billing.Country=SK" \
 -d "Billing.Street1=Test street No.1" \
 -d "Billing.Postcode=01234" \
 -d "Customer.Email=gentleman@trustpay.eu" \
 -d "Customer.Ipaddress=127.0.0.1" \
 -d "Browser.AcceptHeader=*" \
 -d "Browser.Language=en-US" \
 -d "Browser.ScreenHeight=1080" \
 -d "Browser.ScreenWidth=1920" \
 -d "Browser.Timezone=3600" \
 -d "Browser.UserAgent=Browser.UserAgent=Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" \
 -d "Browser.JavaEnabled=false" \
 -d "Browser.JavaScriptEnabled=true" \
 -d "Browser.ScreenColorDepth=24" \
 -d "Browser.ChallengeWindow=1" \
 -H 'X-API-KEY: YOUR_API_KEY'
        
    
And a successful response:
    
{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "MX88Rp6UKzjIKqCNv1TBPg",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302090547579153"
}
        
    

Subsequent non-TPGW Card on File purchase

A subsequent non-TPGW Card on File purchase must again provide the card data.

Subsequent non-TPGW Card on File purchase request

Name Description Format Required
PaymentType Set to CardOnFileSubsequent PaymentType Yes
Card Data Credit/Debit card data information Card Data Yes
CardSchemeTxId Reference to an initial recurring payment CardSchemeTxId No
Amount The payment's amount Numeric(18,2) Yes
Currency Code of the payment's amount currency Currency Yes
Reference Merchant's reference Varchar(35) No
URLs URLs No
Billing Address Data Customer's address Billing Address Data Yes
Customer Data Additional customer data Customer Data Yes
Browser Data Customer's browser information Browser Data Yes
3DS Data Authentication data generated by the 3D Secure MPI 3DS Data No*
Descriptor Payment's description (appears on the bank statement) Varchar(22) No

* Required when using a third-party MPI.

Example of a subsequent TPGW Card on File payment request:
    
 curl https://tpgw.trustpay.eu/api/v1/purchase \
 -d "PaymentType=CardOnFileSubsequent" \
 -d "Pan=4200000000000000" \
 -d "Cvv=123" \
 -d "Exp=01/24" \
 -d "CardSchemeTxId=302090102578979" \
 -d "Amount=0.01" \
 -d "Currency=EUR" \
 -d "Cardholder=Honourable Gentleman" \
 -d "Reference=not a flamethrower" \
 -d "NotificationUrl=https://tpgw.trustpay.eu" \
 -d "RedirectUrl=https://tpgw.trustpay.eu" \
 -d "Billing.City=Bratislava" \
 -d "Billing.Country=SK" \
 -d "Billing.Street1=Test street No.1" \
 -d "Billing.Postcode=01234" \
 -d "Customer.Email=gentleman@trustpay.eu" \
 -d "Customer.Ipaddress=127.0.0.1" \
 -d "Browser.AcceptHeader=*" \
 -d "Browser.Language=en-US" \
 -d "Browser.ScreenHeight=1080" \
 -d "Browser.ScreenWidth=1920" \
 -d "Browser.Timezone=3600" \
 -d "Browser.UserAgent=none" \
 -d "Browser.JavaEnabled=false" \
 -d "Browser.JavaScriptEnabled=true" \
 -d "Browser.ScreenColorDepth=24" \
 -d "Browser.ChallengeWindow=1" \
 -H 'X-API-KEY: YOUR_API_KEY'
        
    
And a successful response:
    
{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "1odXLVrSbPCeGDWUw22RJg",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302090102578979"
}
        
    

Preauthorization

Money reserved via Preauthorization can be released by Capture.

Use the same endpoint as for Purchase with extra parameter PaymentAction set to Preauthorization.

Example of parameters used for preauthorization:

PaymentAction=Preauthorization
Amount=100.00
Currency=EUR
Pan=4200000000000000
Cvv=123
Exp=10/22
Billing.City=Bratislava
Billing.Country=SK
Billing.Street1=ul.29 Decembra 108 
Billing.Postcode=01234
Cardholder=Victor Hugo
Customer.Email=hugomail@trustpay.eu
Customer.Ipaddress=127.0.0.1
Browser.AcceptHeader=*
Browser.Language=en-US
Browser.ScreenHeight=1080
Browser.ScreenWidth=1920
Browser.Timezone=0
Browser.UserAgent=Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0
Browser.JavaEnabled=false
Browser.JavaScriptEnabled=true
Browser.ScreenColorDepth=24
Browser.ChallengeWindow=1
NotificationUrl=https://www.trustpay.eu
RedirectUrl=https://www.trustpay.eu
    

Capture

A capture request is performed against a previous Preauthorization payment by referencing its InstanceId.

Captures can be for full or partial amounts and multiple capture requests against the same preauthorization transaction are allowed.

Capture endpoint:
Live - https://tpgw.trustpay.eu/api/v1/capture

Capture request

Name Description Format Required
Amount Amount of the payment Numeric(18,2) Yes
Currency The currency code of the payment request's amount Currency Yes
InstanceId InstanceId referencing a previous operation Varchar(32) Yes
Reference Merchant's reference Varchar(35) No
NotificationURL URLs No
Example of parameters used for capture:

InstanceId=sbNyN1_Uw2Ohee_McFPg8A
Amount=0.02
Currency=EUR
NotificationUrl=https://www.trustpay.eu
Example of the Capture request:
    
curl --location --request POST 'https://tpgw.trustpay.eu/api/v1/Capture' \
--header 'x-api-key: ' \
--form 'instanceId="INSTANCEID"' \
--form 'amount="0.01"' \
--form 'currency="EUR"'
        
    
And a successful response:
    
{
    "status": 0,
    "description": "Request successfully processed in 'Merchant in Connector Test Mode'",
    "instanceId": "fhtK20BZvLa8o2Chlrq44w",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed in 'Merchant in Connector Test Mode'"
}
        
    

Refund

A refund is performed against a previous payment, referencing its InstanceId.

Refund can be used to return full or partial amount.

Refund endpoint:
Live - https://tpgw.trustpay.eu/api/v1/refund

Refund request

Name Description Format Required
InstanceId Identification referencing payment to be refunded Varchar(32) Yes
Amount Amount of the payment Numeric(18,2) Yes
Currency The currency code of the payment request's amount Currency Yes
Reference Merchant's reference Varchar(35) No
NotificationUrl URLs No
Example of the Refund request:
    
curl --location --request POST 'https://tpgw.trustpay.eu/api/v1/Refund' \
--header 'x-api-key: ' \
--form 'instanceId="INSTANCEID"' \
--form 'amount="0.01"' \
--form 'currency="EUR"'
        
    
And a successful response:
    
{
    "status": 0,
    "description": "Request successfully processed in 'Merchant in Connector Test Mode'",
    "instanceId": "fhtK20BZvLa8o2Chlrq44w",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed in 'Merchant in Connector Test Mode'"
}
        
    

Reversal

A reversal is performed against an already processed Preauthorization (PA) or Purchase (DB), referencing its InstanceId.

A Reversal is only possible until specific cut-off time.

Reversal endpoint:
Live - https://tpgw.trustpay.eu/api/v1/reverse

Reversal request

Name Description Format Required
InstanceId Identification referencing payment to be refunded Varchar(32) Yes
Reference Merchant's reference Varchar(35) No
NotificationUrl URLs No
Example of the Reversal request:
    
curl --location --request POST 'https://tpgw.trustpay.eu/api/v1/Reverse' \
--header 'x-api-key: ' \
--form 'instanceId="INSTANCEID"' \
--form 'amount="0.01"' \
--form 'currency="EUR"'
        
    
And a successful response:
    
{
    "status": 0,
    "description": "Request successfully processed in 'Merchant in Connector Test Mode'",
    "instanceId": "fhtK20BZvLa8o2Chlrq44w",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed in 'Merchant in Connector Test Mode'"
}
        
    

Transaction status

Transaction status endpoint:
Live - https://tpgw.trustpay.eu/api/v1/instance/{instanceId}

This call is used to query status of a instance/transaction.

Use InstanceId as a query parameter.

This API call is a HTTP GET request.

Get transaction status request example:
    
     curl https://tpgw.trustpay.eu/api/v1/instance/617z4szmbu7ipyarpD4_Ww  \
     -H 'X-API-KEY: YOUR_API_KEY'
    
    
Transaction status response - success
    
{
      "status": 0,
      "instanceId": "617z4szmbu7ipyarpD4_Ww",
      "created": "2021-02-23T12:36:03.7851749Z",
      "amount": "0.01",
      "currency": "EUR",
      "paymentStatus": "000.100.110",
      "paymentDescription": "Request successfully processed in 'Merchant in Integrator Test Mode'",
      "card": {
          "maskedPan": "420000******0000",
          "expiration": "10/22"
      }
}
    
    
Transaction status response - pending transaction:

{
    "status": 0,
    "instanceId": "617z4szmbu7ipyarpD4_Ww",
    "created": "2021-02-23T12:36:03.7851749Z",
    "amount": "0.01",
    "currency": "EUR",
    "paymentStatus": "000.200.000",
    "card": {
        "maskedPan": "420000******0000",
        "expiration": "10/22"
    }
}

Transaction status response - error:
    
{
   "status": 0,
   "instanceId": "617z4szmbu7ipyarpD4_Ww",
   "created": "2021-02-23T12:36:03.7851749Z",
   "amount": "0.01",
   "currency": "EUR",
   "paymentStatus": "100.380.401",
   "paymentDescription": "User Authentication Failed",
   "card": {
       "maskedPan": "420000******0000",
       "expiration": "10/22"
    }
}
    
    

Request structures

Request/PaymentType

PaymentType is an enumeration type.

Value Description
Plain Ordinary payment request, implicit
RecurringInitial The first payment of a recurring payment request
RecurringSubsequent Subsequent payment of recurring payment request
CardOnFileInitial The first payment of a recurring CardOnFile payment request
CardOnFileSubsequent Subsequent payment of recurring CardOnFile payment request

Request/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of commonly used currencies

Code ID Name
CZK 348 Czech koruna
EUR 978 Euro
HUF 203 Hungarian forint
USD 840 United States dollar

Request/CardData

Name Description Format Required
PAN Card number Numeric(19) Yes
EXP Card expiration MM/YY Yes
CVV Card CVV Numeric(3) Yes
Cardholder Holder of the credit card account (at least 3 characters) Varchar(128) No

Request/CardSchemeTransactionId

TPGW stores this value for initial payments and if this optional field is not filled in a subsequent request the stored value is used (if present).

Name Description Format Required
CardSchemeTxId Reference to an initial transaction Varchar(32) No

Request/URLs

Name Description Format Required
NotificationURL URL which notifications regarding this payment should be sent to, overrides default NotificationUrl Varchar(256) No
RedirectUrl URL which the payment process should be redirected to, in case of asynchronous workflow (e.g. 3DS challenge) Varchar(256) No

Request/BillingAddress

Billing parameter names are prefixed with Billing.

Name Description Format Required
PostCode Billing postal code Varchar(16) Yes
City Billing city Varchar(48) Yes
Country Billing country Varchar(2), alphabetical ISO 3166-2 code Yes
Street1 Billing street Varchar(100) Yes

Request/CustomerData

Customer parameter names are prefixed with Customer.

Name Description Format Required
IpAddress Customer's IP address (IPv4 / IPv6) Varchar(45) Yes
Email Customer's email address Varchar(128) Yes

Request/BrowserData

Browser parameter names are prefixed with Browser.

Name Description Format Required
AcceptHeader Exact content of the HTTP accept headers from the cardholder's browser Varchar(2048) Yes
Language Value representing the browser language as defined in IETF BCP47 Varchar(8) Yes
ScreenHeight Total height of the cardholder's screen in pixels Numeric(6) Yes
ScreenWidth Total width of the cardholder's screen in pixels Numeric(6) Yes
Timezone Time-zone offset in minutes between UTC and the cardholder browser local time, note that the offset is positive if the local time zone is behind UTC and negative if it is ahead Numeric(5) Yes
UserAgent Exact content of the HTTP user-agent header Varchar(2048) Yes
JavaEnabled Boolean that represents the ability of the cardholder browser to execute Java Bool Yes
JavaScriptEnabled Boolean that represents the ability of the cardholder browser to execute JavaScript Bool Yes
ScreenColorDepth Value representing the bit depth of the colour palette for displaying images, in bits per pixel Varchar(2) Yes
ChallengeWindow Dimensions of the challenge window that has been displayed to the cardholder ChallengeWindow Yes

Request/ChallengeWindow

ChallengeWindow is an enumeration type that represents size of the authentication iframe which will render the ACS authentication front-end to the shopper for interaction.

Value Description
1 250 x 400
2 390 x 400
3 500 x 600
4 600 x 400
5 Full screen

Request/3DsData

3DS parameter names are prefixed with threeDSecure.

Name Description Format Required
EnrollmentStatus The enrollment status for the 3D secure request Varchar (1) Yes
Eci The ECI for the 3D secure request Numeric (2) Yes
AuthenticationStatus The authentication status for the 3D secure request Varchar (1) Yes
VerificationId The 3D secure CAVV or AAV. Must be Base64 encoded Varchar (28) Yes
Xid The 3D secure xid. Must be Base64 encoded Varchar (64) No
Version Version of the 3D Secure that was used for authentication Varchar (5) No
MerchantName Merchant name as defined by the Scheme Directory Server Varchar (100) No
MerchantUrl Merchant URL Varchar (2048) No
MerchantCountry Merchant country Varchar (3), alphabetical ISO 3166-1_alpha-3 code No
V1VisaRequestorId Merchant ID for 3D Secure version 1.0, assigned by Visa Varchar (100) No
V2VisaRequestorId Requestor ID for 3D Secure version 2, assigned by Visa Varchar (100) No
V2VisaRequestorName Requestor Name for 3D Secure version 2, assigned by Visa Varchar (100) No
V1MastercardRequestorId Merchant ID for 3D Secure version 1.0, assigned by Mastercard Varchar (100) No
V2MastercardRequestorId Requestor ID for 3D Secure version 2, assigned by Mastercard Varchar (100) No
V2MastercardRequestorName Requestor Name for 3D Secure version 2, assigned by Mastercard Varchar (100) No
DsTransactionId Transaction ID assigned by the directory server, used when the transaction was already authenticated via 3D Secure version 2 Varchar (100) No
ChallengeIndicator Indicates whether a challenge is requested for this transaction ChallengeIndicator No
ChallengeMandateIndicator Indication of whether a challenge is required for the transaction to be authorized due to local/regional mandates or other variable Varchar (1) (Y/N) No
AuthType The type of authentication that was requested by the ACS AuthType No
ExemptionFlag Flags the transaction as exemption during authorization ExemptionFlag No
TransactionStatusReason Provides information on why the Transaction Status field has the specified value Numeric (2) No
AcsTransactionId This field contains a universally unique transaction identifier assigned by the ACS to identify a single transaction String No

Request/3DsData/ChallengeIndicator

ChallengeIndicator indicates whether a challenge is requested for this transaction. For example: a 3DS Requestor may have concerns about the transaction, and request a challenge. Allows 3DS Requestor to request a challenge such as to follow local/regional mandates or other variables.

Value Description
01 No preference
02 No challenge requested
03 Challenge requested: 3D Secure Requestor Preference
04 Challenge requested: Mandate

Request/3DsData/AuthenticationType

AuthType. The type of authentication that was requested by the ACS.

Value Description
01 Static
02 Dynamic
03 OOB
04 Decoupled

Request/3DsData/ExemptionFlag

ExemptionFlag. Flags the transaction as exemption during authorization. Can be used for 3D Secure version 2.2 or higher.

Value Description
01 Low value exemption
02 TRA exemption
03 Trusted beneficiary exemption
04 Corporate card payment exemption

Response structure

All responses from TPGW are returned as JSON.

Success response example:

 {
   "status": 0,
   "description": "payment intent successfully created",
   "instanceId": "kjy1jYjQHgSVB0XX",
   "paymentStatus": "000.100.110",
   "paymentDescription": "Request successfully processed",
 }

Response structure for succesful requests

Name Description Required
status Result Code Yes
description Textual description of the status No
instanceId Unique operation/transaction identifier No1
cardId Represents a stored card handle, if requested No
redirectUrl RedirectionUrl for completing asynchronous workflow, e.g. for completing a 3DS challenge No2
redirectParams Redirection parameters used together with RedirectUrl No2
preconditions Precondition parameters for completing asynchronous workflow No2
paymentStatus Payment status returned by payment provider No3
paymentDescription Textual representation of payment status No3

1 Field present for successful operations
2 Field present for operations with asynchronous workflow
3 Field present for operations that were sent to payment provider

Pending response example:

 {
   "status": 1,
   "description": "payment intent successfully created",
   "instanceId": "Y5JuHHnGSrrlIKwd",
   "redirectURL": "https://test.trustpay.eu/...",
   "redirectParams": {
       "TermURL": "https://test.trustpay.eu/...",
       "MD": "8ac7ubu4a1...",
       "Pareq": "LT8def12...",
       "connector": "THREEDSECURE"
   },
   "paymentStatus": "000.200.000",
   "paymentDescription": "Transaction pending"
 }

Response structure for failed requests

Name Description
status Result Code
description Textual description of the status
errors List of errors that occurred
Error response example:

 {
   "status": 2,
   "description": "failed to process the purchase",
   "errors": [
   {
     "code": 255,
     "description": "service unavailable"
   }
   ]
 }

Response/ResultCode

Indicates state of current request.

Value Description
0 Request succeeded
1 Request succeeded, pending operation
Otherwise Failure, see errors for more details

Response/PaymentStatus

Indicates state of a financial transaction.

Response/Card

Masked card data.

Name Description
maskedPan Masked card number
expiration Card expiration date
description User-facing message to describe the card*

* In case of Google Pay payments: contains the original card, before tokenization

List of common PaymentStatus codes

Value Description
000.000.000 Transaction succeeded
000.100.110 Request successfully processed in 'Merchant in Integrator Test Mode'
000.200.000 Transaction pending
100.100.600 Empty CVV for VISA, MASTER not allowed
100.350.100 Referenced session is rejected (no action possible)
100.380.401 User authentication failed
100.380.501 Risk management transaction timeout
100.390.103 PARes validation failed - problem with signature
100.390.111 Communication error to VISA/Mastercard Directory Server
100.390.112 Technical error in 3D system
100.390.115 Authentication failed due to invalid message format
100.390.118 Authentication failed due to suspected fraud
100.400.304 Invalid input data
200.300.404 Invalid or missing parameter
300.100.100 Transaction declined (additional customer authentication required)
700.400.200 Cannot refund (refund volume exceeded or tx reversed or invalid workflow)
700.500.001 Referenced session contains too many transactions
700.500.003 Test accounts not allowed in production
800.100.151 Transaction declined (invalid card)
800.100.152 Transaction declined by authorization system
800.100.153 Transaction declined (invalid CVV)
800.100.155 Transaction declined (amount exceeds credit)
800.100.157 Transaction declined (wrong expiry date)
800.100.162 Transaction declined (limit exceeded)
800.100.163 Transaction declined (maximum transaction frequency exceeded)
800.100.168 Transaction declined (restricted card)
800.100.170 Transaction declined (transaction not permitted)
800.100.190 Transaction declined (invalid configuration data)
800.120.100 Rejected by throttling
800.300.401 Bin blacklisted
800.700.100 Transaction for the same session is currently being processed, please try again later
900.100.300 Timeout, uncertain result

List of common Error codes

Value Description
1 Unspecified error
4 Validation failed
5 Validation failed
6 Invalid InstanceId format
7 Invalid InstanceId value
8 Invalid PAN (unexpected characters)
9 Invalid PAN (length)
10Invalid PAN (checksum)
11Invalid CVV format
12Invalid CVV value
13Invalid Card expiration format
14Invalid Card expiration (month)
15Invalid Card expiration (year)
16Invalid Amount format
17Invalid Amount value
18Invalid Currency format
19Invalid Currency value
21Access denied for Instance
22Instance already processed
23Instance already processed
25Failed to create Instance
26Invalid CardId
30Access denied
31Authentication failed
32Invalid API KEY
34Invalid parameter value
35Invalid URL
37Invalid request type
39Invalid parameter length
40Invalid secret
41Invalid secret
45Apple Pay not supported
46Google Pay not supported
48Invalid Apple Pay payment token
49Failed to validate Apple Pay session
50Failed to process Apple Pay
52Invalid Google Pay payment token
56Failed to process Google Pay
59Failed to capture (try again later)
60Failed to capture (amount exceeded)
67Google Pay configuration missing

Handling 3DS workflow

Response with preconditions example:

{
  "status": 1,
  "description": "transaction is in pending state",
  "instanceId": "ZVRVpOkcZa8CW0yPus9dzw",
  "redirectUrl": "https://test.trustpay.eu/...",
  "redirectParams": {
      "MD": "8ac7a4a27a2c1670017a2d7f1b092a22",
      "TermUrl": "https://testtrustpay.eu/...",
      "PaReq": "IT0ubu...",
      "connector": "THREEDSECURE"
  },
 "preconditions": {
     "origin": "iframe#hidden",
     "waitUntil": "iframe#onload",
     "description": "Hidden iframe post for 3D Secure 2.0",
     "method": "POST",
     "url": "https://test.trustpay.eu/...",
     "parameters": {
         "threeDSMethodData": "methodData"
      }
   }
  "paymentStatus": "000.200.000",
  "paymentDescription": "transaction pending"
}

During transaction processing an asynchronous workflow may be required to complete the transaction.

Most pending transactions with an asynchronous workflow contain redirectUlr field together with a set of parameters in redirectParams block. Some transactions might optionally contain also a set of parameters in preconditions block.
















In case of asynchronous workflow, proceed as follows:


1. Open a hidden iframe and post data to the preconditions.url URL. For an example how to format such a request see the "Open a hidden iframe and post data to the methodURL" example.

Open a hidden iframe and post data to the methodURL

<form name="" action="preconditions.url" method="POST">
      <input type="hidden" name="preconditions.parameters[].Name" value="preconditions.parameters[].Value">
</form'>
<script'>
      window.onload=submitForm;
      function submitForm() { downloadForm.submit(); }
</script'>










2. The shopper needs to be redirected to redirectUrl after onLoad event from 1. completes. For an example how to format this request see "Redirect the shopper to the redirect URL within an iframe" example.

Redirect the shopper to the redirect URL within an iframe

<form name="" action="redirect.URL" method="POST">
<input type"hidden" name="redirectParams..." value="redirectParams[...]">
</form'>
<script'>
      window.onload=submitForm;
      function submitForm() { downloadForm.submit(); }
</script'>







After the asynchronous workflow is completed the customer is redirect to redirectUrl which the merchant used as a request parameter.

SEPA Direct Debits

Payment process

Prepare mandate

API endpoints:
Live - https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate

Prepares the mandate and returns the URL of the form in which the customer needs to fill some additional information. After this information is submitted, the mandate will start being processed by TrustPay together with possible payment (if pay now was chosen).

Request

Prepare mandate example:

using System;
using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string PrepareMandate(string token)
{
   string url = "https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PayNow = true,
         ReducedPeriod = 4,
         MerchantIdentification = new
         {
            ProjectId = "1234567",
         },
         PaymentInformation = new
         {
            DueDate = "2017-07-28",
            RemittanceInformation = "test123",
            Amount = new
             {
                Amount = 1.50,
                Currency = "EUR",
             },
            References = new
             {
                MerchantReference = "Order 12345",
                EndToEnd = "e2e",
             },
            SepaDirectDebitInformation = new
             {
                SequenceType = "RCUR",
             },
         },
         CallbackUrls = new
         {
            Notification = "https://somedomain.eu/notification_handler",
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function PrepareMandate($token)
{
   $url = 'https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate';
   $data = array(
      'PayNow' => 'true',
      'ReducedPeriod' => '',
      
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890',
      ),
      'PaymentInformation' => array(
         'DueDate' => '2017-07-28',
         'RemittanceInformation' => 'test123',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
         'References' => array(
            'MerchantReference' => '123456',
            'EndToEnd' => 'test123',
          ),
         'SepaDirectDebitInformation' => array(
            'SequenceType' => 'RCUR',
          ),
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler',
      ),
   );  
   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['PreparedMandateUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String PrepareMandate(String token){
    try{
        URL obj = new URL("https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public boolean PayNow = true;
            public Byte ReducedPeriod = null;
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public String DueDate = "2017-03-27";
                public String RemittanceInformation = "test";
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public String EndToEnd = "e2e";
                };
                public Object SepaDirectDebitInformation = new Object(){
                        public String SequenceType = "RCUR";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };

        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return deserialized.get("PreparedMandateUrl");
    }
    catch(Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PayNow Create first direct debit together with the mandate Boolean Yes
ReducedPeriod Reduces direct debit pre-notification period by up to 13 days. Byte No
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) For paynow
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount For paynow
References Reference (merchant’s payment identification) References For paynow
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format For paynow
Currency Currency of the payment Char(3) For paynow

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) For paynow
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
SequenceType Type of mandate:
RCUR - Recurrent payment
OOFF - One-off payment
Char(4)
en-US format
Yes

Request/CallbackUrls

Name Description Format Required
Notification Url address to which the notifications regarding this payment should be sent (if PayNow was chosen) Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/SepaDirectDebitMandates/input/ba7db67e-7h73-4bt0-880f-7ec0f07b1c4e",
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl Url to site where Debtors credentials can be submited (sent only when call succeeded) Varchar(256)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Cancel mandate

API endpoints:
Live - https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate/[UMR]/Cancel

This function allows you to cancel an active mandate.

Request

Cancel mandate example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public void CancelMandate(string token)
{
   string url = "https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate/[UMR]/Cancel";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         Umr = "12345678901234567890"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = Encoding.UTF8.GetString(responseData);
      if (response == "{}")
      {
         return;
      }
      throw new Exception(serializer.Deserialize<dynamic>(response)["ResultMessage"]);
   }
}

function CancelMandate($token)
{
   $url = 'https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate/[UMR]/Cancel';
   $data = array('Umr' => '12345678901234567890'); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = file_get_contents($url, false, $context);
   if ($response == "{}"){
      return;
   }
   throw new Exception(json_decode($response, true)['ResultMessage']);
}

This code is using external library Jackson to parse text from and to json format
import org.codehaus.jackson.map.ObjectMapper; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Map; public void CancelMandate(String token){ try { URL obj = new URL("https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate/[UMR]/Cancel"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-type", "application/json"); Object request = new Object() { public String Umr = "12345678901234567890"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } if (response == "{}") { return; } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); throw new Exception(deserialized.get("PreparedMandateUrl")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Umr Unique Mandate Reference of mandate that you want to cancel Char(20) Yes

Response

Response example:

{
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Capture payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Creates new direct debit accounted to an already existing mandate based on it's UMR (Unique Mandate Reference).

Request

Capture payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public int CapturePayment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567",
         },
         PaymentInformation = new
         {
             DueDate = "2017-07-28",
             RemittanceInformation = "test123",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR",
             },
             References = new
             {
                 MerchantReference = "Order 12345",
                 EndToEnd = "e2e",
             },
             SepaDirectDebitInformation = new
             {
                 MandateInformation = new
                 {
                     Umr = "12345678901234567890",
                 },
             },
         },
         CallbackUrls = new
         {
             Notification = "https://somedomain.eu/notification_handler",
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["PaymentRequestId"];
   }
}

function CapturePayment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890',
      ),
      'PaymentInformation' => array(
         'DueDate' => '2017-07-28',
         'RemittanceInformation' => 'test123',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
         'References' => array(
            'MerchantReference' => '123456',
            'EndToEnd' => 'test123',
          ),
          'SepaDirectDebitInformation' => array(
            'MandateInformation' => array(
              'Umr' => '12345678901234567890',
            ),
          ),
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler',
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['PaymentRequestId'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaDirectDebit";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public String DueDate = "2017-03-27";
                public String RemittanceInformation = "test";
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public String EndToEnd = "e2e";
                };
                public Object SepaDirectDebitInformation = new Object(){
                        public Object MandateInformation = new Object(){
                            public String Umr = "12345678901234567890";
                        };
                };
            };
            public Object CallbackUrls = new Object(){
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("PaymentRequestId"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Callback URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) Yes
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information Yes

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":1,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment requestId for the direct debit that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Capture payment with external mandate

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Creates new direct debit without previously creating a mandate in TrustPay. This API has the same request and response as Capture payment, with these additional parameters in the request:

Request

Capture payment with external mandate example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public int CapturePayment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567",
         },
         PaymentInformation = new
         {
             DueDate = "2017-07-28",
             RemittanceInformation = "test123",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR",
             },
             References = new
             {
                 MerchantReference = "Order 12345",
                 EndToEnd = "e2e",
             },
             SepaDirectDebitInformation = new
             {
                 SequenceType = "FRST",
                 MandateInformation = new
                 {
                     Umr = "12345678901234567890",
                     SignatureCity = "Bratislava",
                     SignatureDate = "2017-07-28",
                 },
             },
             Debtor = new
             {
                 Name = "John Doe",
                 Email = "client@somedomain.eu",
                 IpAddress = "1.2.3.4",
                 Address = new
                 {
                     PostCode  = "12345",
                     City = "Bratislava",
                     CountryCode = "SK",
                     Lines = new[]
                     {
                         "Street 1/A",
                     },
                 },
             },
             DebtorAccount = new
             {
                 Iban = "SK3112000000198742637541",
             },
             DebtorAgent = new
             {
                 Bic = "TPAYSKBX",
             },
         },
         CallbackUrls = new
         {
             Notification = "https://somedomain.eu/notification_handler",
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["PaymentRequestId"];
   }
}

function CapturePayment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
    $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
          'ProjectId' => '1234567890',
      ),
      'PaymentInformation' => array(
          'DueDate' => '2017-07-28',
          'RemittanceInformation' => 'test123',
          'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
          'References' => array(
            'MerchantReference' => '123456',
            'EndToEnd' => 'test123',
          ),
          'SepaDirectDebitInformation' => array(
            'SequenceType' => 'FRST',
            'MandateInformation' => array(
                'Umr' => '12345678901234567890',
                'SignatureCity' => 'Bratislava',
                'SignatureDate' => '2017-07-28',
             ),
          ),
          'Debtor' => array(
            'Name' => 'John Doe',
            'Email' => 'client@somedomain.eu',
            'IpAddress' => '1.2.3.4',
            'Address' => array(
                'PostCode' => '12345',
                'City' => 'Bratislava',
                'CountryCode' => 'SK',
                'Lines' => array('Street 1/A'),
             ),
          ),
          'DebtorAccount' => array(
            'Iban' => 'SK3112000000198742637541',
          ),
          'DebtorAgent' => array(
            'Bic' => 'TPAYSKBX',
          ),
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler',
      ),
    ); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['PaymentRequestId'];
}

    This code is using external library Jackson to parse text from and to json format

    import org.codehaus.jackson.map.ObjectMapper;
    import javax.net.ssl.HttpsURLConnection;
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.util.Map;

    public String CapturePayment(String token){
    try {
    URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
    HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    con.setRequestProperty("Authorization", "Bearer " + token);
    con.setRequestProperty("Content-type", "application/json");
    Object request = new Object() {
    public String PaymentMethod = "SepaDirectDebit";
    public Object MerchantIdentification = new Object(){
    public long ProjectId = 2107058607;
    public String Currency = "EUR";
    };
    public Object PaymentInformation = new Object(){
    public String DueDate = "2017-03-27";
    public String RemittanceInformation = "test";
    public Object Amount = new Object(){
    public double Amount = 1.50;
    };
    public Object References = new Object(){
    public String MerchantReference = "merch ref. no. #555";
    public String EndToEnd = "e2e";
    };
    public Object SepaDirectDebitInformation = new Object(){
    public String SequenceType = "FRST";
    public Object MandateInformation = new Object(){
    public String Umr = "12345678901234567890";
    public String SignatureDate = "2020-06-01";
    public String SignatureCity = "Bratislava";
    };
    };
    public Object Debtor = new Object(){
    public String Name = "John Doe";
    public String Email = "client@somedomain.eu";
    public String IpAddress = "1.2.3.4";
    public Object Address = new Object(){
    public String PostCode = "12345";
    public String City = "Bratislava";
    public String CountryCode = "SK";
    public String[] Lines  = {"Street 1/A"};
    };
    };
    public Object DebtorAccount = new Object(){
    public String Iban = "SK3112000000198742637541";
    };
    public Object DebtorAgent = new Object(){
    public String Bic = "TPAYSKBX";
    };
    };
    public Object CallbackUrls = new Object(){
    public String Notification = "https://somedomain.eu/notification_handler";
    };
    };
    ObjectMapper JsonParser = new ObjectMapper();
    String jsonrequest = JsonParser.writeValueAsString(request);
    con.setDoOutput(true);

    try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
    wr.writeBytes(jsonrequest);
    wr.flush();
    }

    String response = "";
    try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
    String inputLine;
    while ((inputLine = in.readLine()) != null) {
    response += inputLine;
    }
    }

    Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
    return String.valueOf(deserialized.get("PaymentRequestId"));
    }
    catch (Exception ex){
    throw new RuntimeException(ex.getMessage());
    }
    }
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information Payment Information Yes
CallbackUrls Callback URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) Yes
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Yes
Debtor Debtor information Debtor Information Yes
DebtorAccount Debtor Account information Debtor Account Information Yes
DebtorAgent Debtor Agent information Debtor Agent Information Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
SequenceType Type of direct debit payment:
FRST - First payment
FNAL - Final payment
RCUR - Recurrent payment
OOFF - One-off payment
Char(4) Yes
MandateInformation Mandate Information Mandate Information Yes

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) Yes
SignatureDate Signature date of the mandate Varchar(10) Yes
SignatureCity Signature city of the mandate Varhar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
Name Debtor's name Varchar(70) Yes
Email Debtor's email address Varhar(320) No
IpAddress Debtor's IP address (IPv4 / IPv6) Varhar(15) No
Address Debtor's address Address Yes

Request/PaymentInformation/Debtor/Address

Name Description Format Required
PostCode Debtor's postal code Varchar(16) Yes
City Debtor's city Varchar(35) Yes
CountryCode Debtor's country (ISO 3166-1 alpha-2) Char(2) Yes
Lines Address lines string[] Yes

Request/PaymentInformation/DebtorAccount

Name Description Format Required
Iban Debtor's Iban Varchar(34) Yes

Request/PaymentInformation/DebtorAgent

Name Description Format Required
Bic Debtor's bank Bic Varchar(11) Yes

Request/CallbackUrls

Name Description Format Required
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":1,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment requestId for the direct debit that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Cancel direct debit

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Cancel

This function allows you to reject a direct debit.

Request

Cancel direct debit example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string CancelDirectDebit(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Cancel";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
        
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();
                
      var requestdata = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestdata);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));
      if (Encoding.UTF8.GetString(responseData) == "{}")
      {
         return "DirectDebit was canceled";
      }
      return response["ResultInfo"];
   }
}

function CancelDirectDebit($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Cancel';
   $data = array(
      
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = file_get_contents($url, false, $context);
   if ($response == "{}"){
      return null;
   }
   throw new Exception(json_decode($response, true)['ResultInfo']);
}

This code is using external library Jackson to parse text from and to json format
import org.codehaus.jackson.map.ObjectMapper; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Map; public String CancelDirectDebit(String token){ try { URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Cancel"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-type", "application/json"); Object request = new Object() { }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } System.out.println(response); Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized.get("ResultInfo"); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentRequestId Identification number of direct debit that should be canceled Char(20) Yes

Response

Response example:

{
    "ResultInfo": {
        "ResultCode": 1130000,
        "AdditionalInfo": "Cancel was successful"
    }
}
Name Description Format
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

DirectDebit notifications

DirectDebit URL notification example:
https://example.handler.com/

{
  "PaymentMethod": "SepaDirectDebit",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "StatusReasonInformation": {
      "Reason": {
        "Code": "MD06"
      }
    },
    "References": {
      "MerchantReference": "1234567890",
      "EndToEnd": "e2eReference",
      "PaymentId": "49863043"
    },
    "Debtor": {
      "Name": "John"
    },
    "DebtorAccount": {
      "Iban": "DE75512108001245126199"
    },
    "DebtorAgent": {
      "Bic": "SOGEDEFF"
    },
    "Creditor": {
      "Name": "John"
    },
    "CreditorAccount": {
      "Iban": "DE75512108001245126199"
    },
    "CreditorAgent": {
      "Bic": "SOGEDEFF"
    },
    "SepaDirectDebitInformation": {
      "MandateInformation": {
        "UMR": "31011111110000001234"
      }
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

DirectDebit E-mail notification: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid, Rejected Varchar(50) Always
References Reference (merchant’s payment identification) References Always
StatusReasonInformation If available then Status reason for the Rejected payment StatusReasonInformation Only Rejected
Debtor Debtor details Debtor Only for CRDT
DebtorAccount Debtor's account details DebtorAccount Only for CRDT
DebtorAgent Debtor's agent details DebtorAgent Only for CRDT
Creditor Creditor details Creditor Only for DBIT
CreditorAccount Creditor's account details CreditorAccount Only for DBIT
CreditorAgent Creditor's agent details CreditorAgent Only for DBIT
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
EndToEnd Reference between merchant and client Varchar(35) Always
PaymentId Id of payment Numeric(20) Always

Notification/PaymentInformation/StatusReasonInformation

Name Description Format Included
Reason Reason Reason If reason specified

Notification/PaymentInformation/StatusReasonInformation/Reason

Name Description Format Included
Code Code Varchar(4) If reason specified

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar Always
Address Debtor's address Address Always

Notification/PaymentInformation/Creditor

Name Description Format Included
Name Creditor's name Varchar Always

Notification/PaymentInformation/Debtor/Address

Name Description Format Included
CountryCode Country code ISO 3166-1 alpha-2 Char(2) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's IBAN Char(22) Always

Notification/PaymentInformation/CreditorAccount

Name Description Format Included
Iban Creditor's IBAN Char(22) Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's agent's bank identifier code Varchar(11) Always

Notification/PaymentInformation/CreditorAgent

Name Description Format Included
Bic Creditor's agent's bank identifier code Varchar(11) Always

Notification/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate details Mandate Information Always

Notification/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Always
UMR Unique Mandate Reference Unique Yes

Mandate notifications

Mandate URL notification example:
https://example.handler.com/result.php?AID=4107111111&UMR=12345678901234567890

{
  "PaymentMethod": "SepaDirectDebit",
  "MerchantIdentification": {
    "ProjectId": "4101111111",
    "CID": "12345678"
  },
  "PayNow": "True",
  "ReducedPeriod": "3",
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "References": {
      "MerchantReference": "1234567890"
    },
    "Debtor": {
      "Name": "John",
      "Email": "Smith",
      "Address": {
        "Lines": [
          "221B Baker St"
        ],
        "City": "London",
        "CountryCode": "UK",
        "PostCode": "NW1 6XE"
      }
    },
    "DebtorAccount": {
      "Iban": "DE75512108001245126199"
    },
    "DebtorAgent": {
      "Bic": "SOGEDEFF"
    },
    "DueDate": "2/14/2021",
    "SepaDirectDebitInformation": {
      "SequenceType": "RCUR",
      "MandateInformation": {
        "UMR": "31011111110000001234",
        "SigningCity": "London",
        "SigningDate": "2/14/2021"
      }
    }
  }
}

Mandate E-mail notification: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PayNow Create first direct debit together with the mandate Boolean Always
ReducedPeriod Reduces direct debit pre-notification period by up to 13 days. Byte Always
PaymentInformation Payment information PaymentInformation Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always
CID Company identifier (assigned by TrustPay) Unique Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount For paynow
References Reference (merchant’s payment identification) References For paynow
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account details DebtorAccount Always
DebtorAgent Debtor's agent details DebtorAgent Always
DueDate Date to which the transaction should be carried out Varchar(10) For paynow
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format For paynow
Currency Currency of the payment Char(3) For paynow

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(35) Always
EndToEnd Reference between merchant and client Varchar(35) For paynow

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar Always
Email Debtor's email address Varchar Always
Address Debtor's address Address Always

Notification/PaymentInformation/Debtor/Address

Name Description Format Included
Lines Address lines Array of Varchar Always
City City Varchar Always
CountryCode Country code ISO 3166-1 alpha-2 Char(2) Always
PostCode Postal code Varchar Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's IBAN Char(22) Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's agent's bank identifier code Varchar(11) Always

Notification/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
SequenceType Type of mandate:
RCUR - Recurrent payment
OOFF - One-off payment
Char(4)
en-US format
Yes
MandateInformation Mandate details Mandate Information Always

Notification/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Always
UMR Unique Mandate Reference Unique Yes
SigningCity Place of signature Varchar Yes
SigningDate Date of signature Varchar(10) Yes

SEPA Credit Transfer

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new SepaCreditTransfer (SCT) payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaCreditTransfer",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR",
                 RequireExact = true
             },
             DueDate = "2021-04-27",
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaCreditTransfer',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
            'RequireExact' => 'true'
          ),
         'DueDate' => '2021-04-27',
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaCreditTransfer";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                        public boolean RequireExact = true;
                };
                public String DueDate = "2021-04-27";
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaCreditTransfer Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
DueDate Date to which the transaction should be carried out Varchar(10) No
Localization Language Varchar(2) Yes
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes
RequireExact Decline different amount Boolean No

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Wire notifications v3

Wire URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Wire",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "EndToEnd": "NOTPROVIDED",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "SK9456000000004137132010"
    },
    "DebtorAgent": {
      "Bic": "KOMASK2X"
    }
  },
  "Signature": "747E25237CF813C540343D2F6C0499DE77D76ABC2AA56BEE20585DBDB13583D1"
}

Wire E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
EndToEnd Reference between merchant and client Varchar(35) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Paysafecard

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Paysafecard payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Paysafecard",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Debtor = new
             {
                 Email = "email@example.com"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Paysafecard',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Debtor' => array(
            'Email' => 'email@example.com'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Paysafecard";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object Debtor = new Object(){
                        public String Email = "email@example.com";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Paysafecard Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information Yes
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
AUD 036 Australian Dollar
BGN 975 Bulgarian lev
CAD 124 Canadian Dollar
CHF 756 Swiss Franc
CZK 203 Czech koruna
DKK 208 Danish Krone
EUR 978 Euro
GBP 826 Pound sterling
HRK 191 Croatian kuna
HUF 348 Hungarian forint
PLN 985 Polish zloty
RON 946 Romanian leu
SEK 752 Swedish Krona
USD 840 United States dollar

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar Yes

Request/CallbackUrls

Name Description Format Required
Success Url address to which the customer is redirected after successful payment Varchar(256) No
Cancel Url address to which the customer is redirected after payment is canceled Varchar(256) No
Error Url address to which the customer is redirected after payment processing failed Varchar(256) No
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Paysafecard notifications

Paysafecard URL notification example:
https://example.handler.com/

{
  "PaymentMethod": "Paysafecard",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "EndToEnd": "e2eReference",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Address": {
        "CountryCode": "SK"
      }
    },
    "DebtorAccount": {
      "Other": "8219820508456139"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Paysafecard E-mail notification: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
EndToEnd Reference between merchant and client Varchar(35) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always

Notification/PaymentInformation/Debtor

Name Description Format Included
Address Debtor's address Address Always

Notification/PaymentInformation/Debtor/Address

Name Description Format Included
CountryCode Country code ISO 3166-1 alpha-2 Char(2) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Other Card Serial Number Varchar Always

Giropay

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Giropay payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Giropay",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Giropay',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Giropay";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Giropay Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ErrorCode Id of error that occurred during service call (sent only when call failed) Numeric(10)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Payment (recurring)

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Giropay recurring payment request using direct debit. The debtor's name and IBAN from the original Giropay payment request will be used to initiate the direct debit.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             DueDate = "2022-05-25",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345",
                 OriginalPaymentRequestId = 73807
             }
             Debtor = new
             {
                 Email = "example@example.org",
                 IpAddress = "1.2.3.4",
             },
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'DueDate' => '2022-05-25',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
            'OriginalPaymentRequestId' => '73807'
          ),
         'Debtor' => array(
            'Email' => 'example@example.org'
            'IpAddress' => '1.2.3.4'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaDirectDebit";
            public String DueDate = "2022-05-25";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public long OriginalPaymentRequestId = 73807;
                };
                public Object Debtor = new Object(){
                        public String Email = "example@example.org";
                        public String IpAddress = "1.2.3.4";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) No
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information No
Debtor Debtor information Debtor No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId PaymentRequestId of the original Giropay payment request Numeric(20) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) No

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No
IpAddress Debtor's IP address IPv4 address No

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ErrorCode Id of error that occurred during service call (sent only when call failed) Numeric(10)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Giropay notifications v3

Giropay URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Giropay",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "DE35940594210032507931"
    }
    "DebtorAgent": {
      "Bic": "TESTDETT421"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Giropay E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

EPS

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new EPS (Electronic Payment Standard) payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "EPS",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'EPS',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "EPS";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod EPS Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Payment (recurring)

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new EPS recurring payment request using direct debit. The debtor's name and IBAN from the original EPS payment request will be used to initiate the direct debit.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             DueDate = "2022-05-25",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345",
                 OriginalPaymentRequestId = 73807
             }
             Debtor = new
             {
                 Email = "example@example.org",
                 IpAddress = "1.2.3.4",
             },
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'DueDate' => '2022-05-25',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
            'OriginalPaymentRequestId' => '73807'
          ),
         'Debtor' => array(
            'Email' => 'example@example.org'
            'IpAddress' => '1.2.3.4'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaDirectDebit";
            public String DueDate = "2022-05-25";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public long OriginalPaymentRequestId = 73807;
                };
                public Object Debtor = new Object(){
                        public String Email = "example@example.org";
                        public String IpAddress = "1.2.3.4";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) No
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information No
Debtor Debtor information Debtor No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId PaymentRequestId of the original EPS payment request Numeric(20) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) No

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No
IpAddress Debtor's IP address IPv4 address No

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ErrorCode Id of error that occurred during service call (sent only when call failed) Numeric(10)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

EPS notifications v3

EPS URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "EPS",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "AT483200000012345864"
    }
    "DebtorAgent": {
      "Bic": "TESTATTT421"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

EPS E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

iDEAL

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new iDEAL payment request.

When no Issuer's BIC is specified in the Payment request the default Issuer selection form can be displayed as a popup overlaid over the merchant's site using IFrame. The Merchant's site has to include link to Merchant API JavaScript popup.js on it's page and load the TrustPay payment gateway url inside an IFrame. The included JavaScript will style the IFrame so that it is hidden. It also contains the code necessary to show the Issuer selection form from the hidden IFrame as a popup overlaid over the merchant's e-shop. To allow users to show the Issuer selection popup, the merchant needs to include some link/button/etc. with CSS class "show-popup" somewhere on the page. Onclick event handler that shows the popup will be automatically added to this element. Please see the HTML code example to the right.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "IDeal",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             DebtorAgent = new
             {
                 Bic = "TPAYSKBX"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'IDeal',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'DebtorAgent' => array(
            'Bic' => 'TPAYSKBX'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "IDeal";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object DebtorAgent = new Object(){
                        public String Bic = "TPAYSKBX";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
        "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod IDeal Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
DebtorAgent Debtor's agent details DebtorAgent No
Localization Language Varchar(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/DebtorAgent

Name Description Format Required
BIC IDeal Issuer BIC Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ErrorCode Id of error that occurred during service call (sent only when call failed) Numeric(10)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Payment (recurring)

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new iDEAL recurring payment request using direct debit. The debtor's name and IBAN from the original iDEAL payment request will be used to initiate the direct debit.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             DueDate = "2022-05-25",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345",
                 OriginalPaymentRequestId = 73807
             }
             Debtor = new
             {
                 Email = "example@example.org",
                 IpAddress = "1.2.3.4",
             },
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'DueDate' => '2022-05-25',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
            'OriginalPaymentRequestId' => '73807'
          ),
         'Debtor' => array(
            'Email' => 'example@example.org'
            'IpAddress' => '1.2.3.4'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaDirectDebit";
            public String DueDate = "2022-05-25";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public long OriginalPaymentRequestId = 73807;
                };
                public Object Debtor = new Object(){
                        public String Email = "example@example.org";
                        public String IpAddress = "1.2.3.4";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) No
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information No
Debtor Debtor information Debtor No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId PaymentRequestId of the original iDEAL payment request Numeric(20) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) No

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No
IpAddress Debtor's IP address IPv4 address No

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ErrorCode Id of error that occurred during service call (sent only when call failed) Numeric(10)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Issuers

API endpoints:
Live - https://aapi.trustpay.eu/api/Issuers/Issuers/iDeal

Retrieve iDeal Issuers list using GET request.

Request

Request example:

using System.Net;
using System.Text;

public string ListIssuers()
{
   string url = "https://aapi.trustpay.eu/api/Issuers/Issuers/iDeal";
   using (var client = new WebClient())
   {
      return client.DownloadString(url);
   }
}

function ListIssuers()
{
   $url = 'https://aapi.trustpay.eu/api/Issuers/Issuers/iDeal';

   $options = array('http' => array(
         'method' => 'GET'
      )
   );
   $context = stream_context_create($options);
   return file_get_contents($url, false, $context);
}


import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String ListIssuers(){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Issuers/Issuers/iDeal");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("GET");
        con.setDoOutput(false);

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        return response;
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Response

Response example:
{
    "Issuers": [
    {
        "BIC":"TPAYSKBX",
        "Country":"nl",
        "PaymentMethod":"iDeal",
        "Aliases":[{"Alias":"ABN AMRO","Language":"En"}]
    },
    {
        "BIC":"TPAYSKBX",
        "Country":"nl",
        "PaymentMethod":"iDeal",
        "Aliases":[{"Alias":"ASN Bank","Language":"En"}]
    }]
}
Name Description Format
Issuers Issuers list Array of iDeal Issuer

Response/iDeal Issuer

Name Description Format
BIC Issuer's BIC Varchar(11)
Country Issuer's country Varchar(2)
PaymentMethod iDeal Varchar
Aliases Issuer's aliases Array of iDeal Issuer Alias

Response/iDeal Issuer Alias

Name Description Format
Alias Issuer's alias Varchar
Language Issuer's alias's language Varchar(2)

iDEAL notifications v3

IDeal URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "IDeal",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "DE35940594210032507931"
    }
    "DebtorAgent": {
      "Bic": "TPAYSKBX"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

IDeal E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

MyBank

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new MyBank payment request.

When no Issuer's ProprietaryId is specified in the Payment request the default Issuer selection form can be displayed as a popup overlaid over the merchant's site using IFrame. The Merchant's site has to include link to Merchant API JavaScript popup.js on it's page and load the TrustPay payment gateway url inside an IFrame. The included JavaScript will style the IFrame so that it is hidden. It also contains the code necessary to show the Issuer selection form from the hidden IFrame as a popup overlaid over the merchant's e-shop. To allow users to show the Issuer selection popup, the merchant needs to include some link/button/etc. with CSS class "show-popup" somewhere on the page. Onclick event handler that shows the popup will be automatically added to this element. Please see the HTML code example to the right.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "MyBank",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             DebtorAgent = new
             {
                 ProprietaryId = "CT000052"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'MyBank',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'DebtorAgent' => array(
            'ProprietaryId' => 'CT000052'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "MyBank";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object DebtorAgent = new Object(){
                        public String ProprietaryId = "CT000052";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod MyBank Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
DebtorAgent Debtor's agent details DebtorAgent No
Localization Language Varchar(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/DebtorAgent

Name Description Format Required
ProprietaryId MyBank Issuer identifier Varchar Yes

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Payment (recurring)

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new MyBank recurring payment request using direct debit. The debtor's name and IBAN from the original MyBank payment request will be used to initiate the direct debit.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             DueDate = "2022-05-25",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345",
                 OriginalPaymentRequestId = 73807
             }
             Debtor = new
             {
                 Email = "example@example.org",
                 IpAddress = "1.2.3.4",
             },
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'DueDate' => '2022-05-25',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
            'OriginalPaymentRequestId' => '73807'
          ),
         'Debtor' => array(
            'Email' => 'example@example.org'
            'IpAddress' => '1.2.3.4'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaDirectDebit";
            public String DueDate = "2022-05-25";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public long OriginalPaymentRequestId = 73807;
                };
                public Object Debtor = new Object(){
                        public String Email = "example@example.org";
                        public String IpAddress = "1.2.3.4";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) No
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information No
Debtor Debtor information Debtor No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId PaymentRequestId of the original MyBank payment request Numeric(20) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) No

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No
IpAddress Debtor's IP address IPv4 address No

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ErrorCode Id of error that occurred during service call (sent only when call failed) Numeric(10)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Issuers

API endpoints:
Live - https://aapi.trustpay.eu/api/Issuers/Issuers/MyBank

Retrieve MyBank Issuers list using GET request.

Request

Request example:

using System.Net;
using System.Text;

public string ListIssuers()
{
   string url = "https://aapi.trustpay.eu/api/Issuers/Issuers/MyBank";
   using (var client = new WebClient())
   {
      return client.DownloadString(url);
   }
}

function ListIssuers()
{
   $url = 'https://aapi.trustpay.eu/api/Issuers/Issuers/MyBank';

   $options = array('http' => array(
         'method' => 'GET'
      )
   );
   $context = stream_context_create($options);
   return file_get_contents($url, false, $context);
}


import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String ListIssuers(){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Issuers/Issuers/MyBank");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("GET");
        con.setDoOutput(false);

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        return response;
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Response

Response example:
{
    "Issuers": [
    {
        "ProprietaryId":"CT000052",
        "Country":"IT",
        "PaymentMethod":"MyBank",
        "Aliases":[{"Alias":"CODICE WEB","Language":"en"}]
    },
    {
        "ProprietaryId":"CT000094",
        "Country":"IT",
        "PaymentMethod":"MyBank",
        "Aliases":[{"Alias":"VOLKSBANK - BANCA POPOLARE","Language":"de"}]
    }]
}
Name Description Format
Issuers Issuers list Array of MyBank Issuer

Response/MyBank Issuer

Name Description Format
ProprietaryId Issuer's identifier Varchar
Country Issuer's country Varchar(2)
PaymentMethod MyBank Varchar
Aliases Issuer's aliases Array of MyBank Issuer Alias

Response/MyBank Issuer Alias

Name Description Format
Alias Issuer's alias Varchar
Language Issuer's alias's language Varchar(2)

MyBank notifications v3

MyBank URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "MyBank",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "DE35940594210032507931"
    }
    "DebtorAgent": {
      "Bic": "TESTDETT421"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

MyBank E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Bancontact

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Bancontact payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Bancontact",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en-GB",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Bancontact',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en-GB',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Bancontact";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en-GB";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Bancontact Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Language Varchar(5) No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:
{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Bancontact notifications v3

Bancontact URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Bancontact",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "EndToEnd":
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "DE35940594210032507931"
    },
    "DebtorAgent": {
      "Bic": "TESTDETT421"
    },
    "CardTransaction": {
      "Card": {
        "MaskedPan": "420000******0000",
        "ExpiryDate": "2021-12"
      }
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Bancontact E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always
CardTransaction Card Transaction Details Card Transaction Information Yes

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Notification/PaymentInformation/CardTransaction

Name Description Format Included
Card Card Details Card Details Always

Notification/PaymentInformation/CardTransaction/Card

Name Description Format Included
MaskedPan Masked Card Number Varchar(16) Always
ExpiryDate Card Expiration Date Varchar(7) Always

Blik

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Blik payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Blik",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 12.50,
                 Currency = "PLN"
             },
             Debtor = new
             {
                 Name = "John Doe",
                 Email = "email@example.com"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Blik',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '12.50',
            'Currency' => 'PLN'
          ),
         'Debtor' => array(
            'Name' => 'John Doe',
            'Email' => 'email@example.com'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Blik";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 12.50;
                        public String Currency = "PLN";
                };
                public Object Debtor = new Object(){
                        public String Name = "John Doe";
                        public String Email = "email@example.com";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Blik Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information Yes
Localization Language Varchar(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
PLN 985 Polish zloty

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
Name Debtor's name Varchar Yes
Email Debtor's email Varchar Yes

Request/CallbackUrls

Name Description Format Required
Success Url address to which the customer is redirected after successful payment Varchar(135) No
Cancel Url address to which the customer is redirected after payment is canceled Varchar(135) No
Error Url address to which the customer is redirected after payment processing failed Varchar(135) No
Notification Url address to which the notifications regarding this payment should be sent Varchar(135) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(135)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Blik notifications v3

Blik URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Blik",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "12.50",
      "Currency": "PLN"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49873043",
      "PaymentRequestId": "12345"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Blik E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Instant Bank Transfer

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Merchant's implementation has to include link to Merchant API JavaScript on it's page and load the TrustPay payment gateway inside an IFrame. Url to payment gateway is filled in response on initiate request. (Initiate request is json object, sent on API endpoint, as you can see in Payment example) The included JavaScript will style the IFrame so that it is hidden. It also contains the code necessary to show the payment gateway from the hidden IFrame as a popup overlaid over the merchant's e-shop. To allow users to show the payment gateway popup, the merchant needs to include some link/button/etc. with CSS class "show-popup" somewhere on the page. Onclick event handler that shows the popup will be automatically added to this element. Please see the example to the right.

Initiates new bank transfer payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Wire",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR",
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Wire',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaCreditTransfer";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

        
HTML code:

        <script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
        <iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
        <a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Wire Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Country Format defined in ISO3166-1Alpha-2 Char(2) No
Localization Language Varchar(2) Yes
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
CZK 203 Czech koruna
EUR 978 Euro
GBP 826 Pound sterling

Request/PaymentInformation/Debtor

Name Description Format Required
Email Customer email Varchar(254) No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No
Cancel Cancel URL (overrides default Cancel Return URL) Varchar(256) No
Error Error URL (overrides default Error Return URL) Varchar(256) No

Bank transfer notifications v3

Bank Transfer URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Wire",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234",
      "EndToEnd": "NOTPROVIDED"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Bank Transfer E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
EndToEnd Reference between merchant and client Varchar(35) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Instant Bank Transfers (PL)

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Instant Bank Transfers (PL) payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "InstantBankTransferPL",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 12.50,
                 Currency = "PLN"
             },
             Debtor = new
             {
                 Name = "John Doe",
                 Email = "email@example.com"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'InstantBankTransferPL',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '12.50',
            'Currency' => 'PLN'
          ),
         'Debtor' => array(
            'Name' => 'John Doe',
            'Email' => 'email@example.com'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "InstantBankTransferPL";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 12.50;
                        public String Currency = "PLN";
                };
                public Object Debtor = new Object(){
                        public String Name = "John Doe";
                        public String Email = "email@example.com";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod InstantBankTransferPL Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information Yes
Localization Language Varchar(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
PLN 985 Polish zloty

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
Name Debtor's name Varchar Yes
Email Debtor's email Varchar Yes

Request/CallbackUrls

Name Description Format Required
Success Url address to which the customer is redirected after successful payment Varchar(256) No
Cancel Url address to which the customer is redirected after payment is canceled Varchar(256) No
Error Url address to which the customer is redirected after payment processing failed Varchar(256) No
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Instant Bank Transfers (PL) notifications v3

Instant Bank Transfers (PL) URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "InstantBankTransferPL",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "12.50",
      "Currency": "PLN"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49873043",
      "PaymentRequestId": "12345"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Instant Bank Transfers (PL) E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod InstantBankTransferPL Varchar Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Satispay

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Satispay payment request.

Recurring payment

To initiate recurring payment set Recurring as True and do not set OriginalPaymentRequestId value.

For recurring subsequent payment Recurring must be set as True and OriginalPaymentRequestId must contain the PaymentRequestId obtained from recurring initiate payment response.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Satispay",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Satispay',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Satispay";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public String Localization = "en";
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:
{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
    
   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Satispay Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
DebtorAgent Debtor's agent details DebtorAgent No
Localization Language Varchar(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes
SatispayTransaction Satispay transaction details SatispayTransaction No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId Payment request identifier of recurring initial payment Numeric(20) No

Request/PaymentInformation/SatispayTransaction

Name Description Format Required
Recurring Recurring payment Boolean No

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Satispay notifications v3

Satispay URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Satispay",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Satispay E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Direct Banking

Payment process

At first the GetBankList API request is made. After receiving the bank list, the customer can choose a bank. After that the merchant sends a SetupPayment request. After receiving the SetupPayment result, the merchant/customer chooses between an online or offline payment. For an online payment an additional ExecutePayment redirect has to be made. After redirection, the standart payment process flow follows.

Get bank list

API endpoints:
Live - https://aapi.trustpay.eu/api/gateway/gateways

The GetBankList request is used to aquire a list of currently supported banks. If the country and/or merchant account ID parameter is specified, only banks available for that country/merchant account are returned.

Request

Name Description Format Required
MerchantIdentification Identification of merchant Merchant Identification Yes
Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public dynamcic Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Gateway/Gateways";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "4107123456"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response;
   }
}

Response

Response example:

{
  "Gateways": [
    {
      "Country": "SK",
      "Gateways": [
        {
          "Id": 1000000,
          "Name": "TestBank",
          "Currency": "EUR",
          "Url": "https://testbank.sk/",
          "OnlinePayments": true,
          "OfflinePayments": false
        },
        {
          "Id": 1000001,
          "Name": "TestBank2",
          "Currency": "EUR",
          "Url": "https://testbank2.eu/",
          "OnlinePayments": false,
          "OfflinePayments": true
        }
      ]
    },
    {
      "Country": "CZ",
      "Gateways": [
        {
          "Id": 1000002,
          "Name": "TestBank3",
          "Currency": "EUR",
          "Url": "https://testbank3.eu/",
          "OnlinePayments": true,
          "OfflinePayments": false
        },
        {
          "Id": 1000003,
          "Name": "TestBank4",
          "Currency": "CZK",
          "Url": "https://testbank2.cz/",
          "OnlinePayments": false,
          "OfflinePayments": true
        }
      ]
    }
  ],
    "ResultInfo": {
            "ResultCode": 1001000,
            "AdditionalInfo": "Success"
        }
}

Name Description Format
Gateways List of gateways grouped by countries Array of Gateways
ResultInfo Contains result information. ResultInfo

Response/Gateways

Name Description Format
Country Format defined in ISO3166-1Alpha-2 Char(2)
Gateways List of gateways grouped by country Array of Gateway

Response/Gateways/Gateway

Name Description Format
Id This Id you have to fill into request as ProprietaryId Numeric
Name Name of bank's gateway Varchar(50)
Url Url to bank's internet banking Varchar(50)
Currency Currency of the payment Char(3)
OnlinePayments If true, gateway is able to do online payments Bool
OfflinePayments If true, gateway is able to do offline payments Bool
OnlineNotice Online notice Varchar(255)
OfflineNotice Offline notice Varchar(255)

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Setup payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Request

Parameters are same as for Wire payment but this additional parameter have to be added to the request

Request/PaymentInformation/DebtorAgent

Name Description Format Required
ProprietaryId Selected gateway's Id from response Numeric Yes
Setup example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Wire",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR",
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             DebtorAgent = new
             {
                 ProprietaryId = 1000001
             }
         },
         CallbackUrls = new
         {
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Wire',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'DebtorAgent' => array(
            'ProprietaryId' => '1000001'
        )
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaCreditTransfer";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public Object DebtorAgent = new Object(){
                        public long ProprietaryId = 1000001;
                };
            };
            public Object CallbackUrls = new Object(){
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Response

Setup response:

{
  "OfflineInstructions": [
    {
      "Language": "sk-SK",
      "Instructions": [
        {
          "Value": "SK123456789123456",
          "Label": "Číslo účtu"
        }
      ]
    },
    {
      "Language": "en-GB",
      "Instructions": [
        {
          "Value": "SK123456789123456",
          "Label": "Account number"
        }
      ]
    }
  ],
  "PaymentRequestId": 12345,
  "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
  "ResultInfo": {
         "ResultCode": 1001000,
         "AdditionalInfo": "Success"
    }
}
    
    
Name Description Format
OfflineInstructions Offline instruction grouped by language Array of OfflineInstructions
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Response/OfflineInstructions

Name Description Format
Language Language of instructions Varchar(5)
Instructions Array of instructions Array of Instruction

Response/OfflineInstructions/Instructions

Name Format
Value Varchar(50)
Label Varchar(50)

Sofort

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Sofort payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Sofort",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Sofort',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Sofort";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "SK";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Sofort Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Localization Char(2) No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Payment (recurring)

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Sofort recurring payment request using direct debit. The debtor's name and IBAN from the original Sofort payment request will be used to initiate the direct debit.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             DueDate = "2022-05-25",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345",
                 OriginalPaymentRequestId = 73807
             }
             Debtor = new
             {
                 Email = "example@example.org",
                 IpAddress = "1.2.3.4",
             },
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'DueDate' => '2022-05-25',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
            'OriginalPaymentRequestId' => '73807'
          ),
         'Debtor' => array(
            'Email' => 'example@example.org'
            'IpAddress' => '1.2.3.4'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaDirectDebit";
            public String DueDate = "2022-05-25";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public long OriginalPaymentRequestId = 73807;
                };
                public Object Debtor = new Object(){
                        public String Email = "example@example.org";
                        public String IpAddress = "1.2.3.4";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) No
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information No
Debtor Debtor information Debtor No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId PaymentRequestId of the original Sofort payment request Numeric(20) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) No

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No
IpAddress Debtor's IP address IPv4 address No

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ErrorCode Id of error that occurred during service call (sent only when call failed) Numeric(10)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Sofort notifications v3

Sofort URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Sofort",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "DE35940594210032507931"
    }
    "DebtorAgent": {
      "Bic": "TESTDETT421"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Sofort E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

AircashPay

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new AircashPay payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "AircashPay",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'AircashPay',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "AircashPay";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod AircashPay Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Localization Char(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro
HRK 191 Croatian kuna

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

AircashPay notifications v3

AircashPay URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "AircashPay",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

AircashPay E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

WeChatPay

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new WeChatPay payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "WeChatPay",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'WeChatPay',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "WeChatPay";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod WeChatPay Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Localization Char(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

WeChatPay notifications v3

WeChatPay URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "WeChatPay",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

WeChatPay E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

PayPal

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new PayPal payment request.

Request

Payment example (for tangible goods):

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "PayPal",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en-GB",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             RemittanceInformation: "Some description"
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'PayPal',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en-GB',
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'RemittanceInformation' => 'Some description'
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "PayPal";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en-GB";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public String RemittanceInformation = "Some description";
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2&issuerId=AbwCEe8zJYkLtIAMZ-s-jB"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="PayPalFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2&issuerId=AbwCEe8zJYkLtIAMZ-s-jB"></iframe>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod PayPal Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls Yes

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Localization Localization - BCP 47 format (for example: "en-GB") Char(5) No
References Reference (merchant’s payment identification) References Yes
RemittanceInformation Description of payment Char(127) Yes
Debtor Debtor information Debtor Yes*

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro
AUD 5 Australian Dollar
CAD 4 Canadian Dollar
CHF 143 Swiss Franc
CZK 7 Ceske koruny
DKK 76 Danish Krone
GBP 3 British Pound
HKD 116 Hong Kong Dollar
HUF 117 Forint
ILS 124 Shekel
JPY 128 Yen
NOK 27 Norwegian Krone
PLN 191 New Zloty
SEK 225 Swedish Krona
USD 1 American Dollar

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
FirstName Debtor's first name Varchar Yes
LastName Debtor's last name Varchar Yes
Email Debtor's email Varchar Yes
Phone Debtor's phone Varchar Yes
Address Debtor's address Address Yes
Identification Debtor's identification on the merchant platform Identification Yes

Request/PaymentInformation/Debtor/Address

Name Description Format Required
CountryCode Debtor's country code (ISO 3166-2 format) Varchar(2) Yes

Request/PaymentInformation/Debtor/Identification

Name Description Format Required
Id Identifier of the buyer account on the merchant platform Varchar Yes
Created Date of creation of the debtor’s account on the merchant platform (format: YYYY-MM-DD) Varchar(10) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) Yes*
Error URL address to which the customer is redirected after payment processing failed Varchar(256) Yes*
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to the HTML page with PayPal button (only) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

PayPal notifications v3

PayPal URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "PayPal",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

PayPal E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Paytrail

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Paytrail payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Paytrail",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Debtor = new
             {
                 Email = "email@example.com"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Paytrail',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Debtor' => array(
            'Email' => 'email@example.com'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Paytrail";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object Debtor = new Object(){
                        public String Email = "email@example.com";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Paytrail Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information Yes
Localization Localization (supported: EN, FI, SV) Char(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email Varchar Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Paytrail notifications v3

Paytrail URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Paytrail",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Paytrail E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Data signature calculated from concatenated values of all values (in ASCII sorted order) in the notification. Slash character ('/') is used as separator. Not empty values are sorted in ascending order and then concatenated using the separator. Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Trustly

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Trustly payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Trustly",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "SK",
             Country = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             Debtor = new
             {
                FirstName = "John",
                LastName = "Brown",
                Identification = new
                {
                    Id = "123456"
                }
            }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Trustly',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'Country' => 'SK'
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'Debtor' => array(
            'FirstName' => 'John',
            'LastName' => 'Brown',
            'Identification' => array(
                'Id' => '123456'
            )
         )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Trustly";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 2107058607;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "SK";
                public String Country = "SK"
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public Object Debtor = new Object(){
                        public String FirstName = "John";
                        public String LastName = "Brown";
                        public Object Identification = new Object(){
                            public String Id = "123456";
                        };
                };                   
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Trustly Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Localization Used to pre-select the language on the Trustly page. (ISO 639-1 format) Char(2) Yes
Country Used for pre-selecting the country for the end-user on the Trustly page. (ISO 3166-2 format) Char(2) Yes
References Reference (merchant’s payment identification) References Yes
RemittanceInformation Description of payment Char(127) Yes
Debtor Debtor information Debtor Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro
DKK 76 Danish Krone
NOK 27 Norwegian Krone
SEK 225 Swedish Krona

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
FirstName Debtor's first name Varchar Yes
LastName Debtor's last name Varchar Yes
Identification Debtor's identification on the merchant platform Identification Yes
Email Debtor's email address Varchar No

Request/PaymentInformation/Debtor/Identification

Name Description Format Required
Id Identifier of the buyer account on the merchant platform Varchar Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) Yes*
Error URL address to which the customer is redirected after payment processing failed Varchar(256) Yes*
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to the Trustly payment page Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Trustly notifications v3

Trustly URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Trustly",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Trustly E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Payment State

Get Payment State

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment/{paymentRequestId}

Lets you check the state of any payment you have made.

Request

Obtain payment state example:

using System;
using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string GetPaymentState(long paymentRequestId, string token)
{
   using (var client = new WebClient())
   {
      string url = FormattableString.Invariant($"https://aapi.trustpay.eu/api/Payments/Payment/{paymentRequestId}")
      client.Headers = new WebHeaderCollection
      {
          "Authorization: Bearer " + token,
          "Content-Type: application/json"
      }

      JavaScriptSerializer serializer = new JavaScriptSerializer();
      var responseData = client.DownloadData(url);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));
      return response["PaymentInformation"];
   }
}

$baseUrl = 'https://aapi.trustpay.eu/api/Payments/Payment/';
$paymentRequestId = '0';
$url = $baseUrl.$paymentRequestId
$data = array();

$token = GetToken("abcdef", "123abc");

$options = array(
   'http' => array(
      'header'  => array(
         "Authorization: Bearer $token",
         'Content-type: application/json',
      ),
      'method'  => 'GET',            
      'content' => json_encode($data)
   ),
);
$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$response = json_decode(file_get_contents($url, false, $context), true);
return $response['State'];

This code is using external library Jackson to parse text from and to json format
import org.codehaus.jackson.map.ObjectMapper; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Map; public String PaymentState(long paymentRequestId, String token){ try { URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment/" + paymentRequestId); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-type", "application/json"); Object request = new Object() {}; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return String.valueOf(deserialized.get("State")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }

Response

Response is notifications V3 format of payment method used to make the payment. Additionally, RefundedAmount is present in PaymentInformation.

PaymentInformation/RefundedAmount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) that is already refunded Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always
Response example:

    {
        "PaymentMethod": "Card",
        "MerchantIdentification": {
            "ProjectId": "41071234"
        },
        "PaymentInformation": {
            "Amount": {
                "Amount": 123.45,
                "Currency": "EUR"
            },
            "CreditDebitIndicator": "CRDT",
            "Status": "Rejected",
            "StatusReasonInformation": {
                "Reason": {
                    "Code": "TooManyInvalidTries"
                }
            },
            "References": {
                "MerchantReference": "merchant reference",
                "PaymentId": "12345678",
                "PaymentRequestId": "12345",
                "ClearingSystemReference": "6640.2103.6494"
            },
            "Debtor": {
                "Name": "John Debtor"
            },
            "CardTransaction": {
                "Card": {
                    "MaskedPan": "420000******0000",
                    "ExpiryDate": "12/21",
                    "SubType": "GooglePay"
                }
            },
            "RefundedAmount": {
                "Amount": 10.00,
                "Currency": "EUR"
            }
        }
    }

Statements

Daily Statements

API endpoints:
Live - https://aapi.trustpay.eu/api/Statements/Statement

Retrieves daily statement based on currency and date range.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] Statement(string token)
{
   string url = "https://aapi.trustpay.eu/api/Statements/Statement";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Transactions",
         Format = "PDF",
         FilterInformation = new
         {
            Currency = "EUR",
            DateFrom = "2021-07-10",
            DateTo = "2021-07-20"
         },
         Localization = "sk"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function Statement($token)
{
   $url = 'https://aapi.trustpay.eu/api/Statements/Statement';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Transactions',
      'Format' => 'PDF',
      'FilterInformation' => array(
         'Currency' => 'EUR',
         'DateFrom' => '2021-07-10',
         'DateTo' => '2021-07-20'
      ),
      'Localization' => 'sk'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] Statement(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Statements/Statement");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Transaction";
            public String Format = "PDF";
            public Object FilterInformation = new Object(){
                public String Currency = "EUR";
                public String DateFrom = "2021-07-10";
                public String DateTo = "2021-07-20";
            };
            public String Localization = "sk";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Daily statement type StatementType Yes
Format Statement format StatementFormat Yes
FilterInformation Statement filter information FilterInformation Yes
Localization Language Varchar(2) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
Currency Currency Char(3) Yes
DateFrom Date from Char(10) Yes
DateTo Date to Char(10) Yes

Response

The statement in the requested format (CSV, PDF, XML) or JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1122006,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code AccountCurrencyNotAllowed occurred. AccountCurrencyNotAllowed\r\nReturning result code AccountCurrencyNotAllowed"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Daily statement Types

Value
Transactions
Fees
RollingReserves

Statement Formats

Value Supported types
CSV Transactions, Fees, RollingReserves, Payout, Autorefunds, Frauds
PDF Transactions, Fees, RollingReserves, Payout
XML Transactions

Payout Statements

API endpoints:
Live - https://aapi.trustpay.eu/api/Statements/Statement

Retrieves payout statement based on currency and payout date or payout reference.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] Statement(string token)
{
   string url = "https://aapi.trustpay.eu/api/Statements/Statement";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Payout",
         Format = "PDF",
         FilterInformation = new
         {
            Currency = "EUR",
            PayoutDate = "2021-07-10"
         },
         Localization = "sk"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function Statement($token)
{
   $url = 'https://aapi.trustpay.eu/api/Statements/Statement';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Payout',
      'Format' => 'PDF',
      'FilterInformation' => array(
         'Currency' => 'EUR',
         'PayoutDate' => '2021-07-10'
      ),
      'Localization' => 'sk'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] Statement(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Statements/Statement");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Payout";
            public String Format = "PDF";
            public Object FilterInformation = new Object(){
                public String Currency = "EUR";
                public String PayoutDate = "2021-07-10";
            };
            public String Localization = "sk";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Payout Varchar Yes
Format Statement format StatementFormat Yes
FilterInformation Statement filter information FilterInformation Yes
Localization Language Varchar(2) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
Currency Currency Char(3) Yes
PayoutDate Date of payout Char(10) No*
PayoutReference Reference of payout Varchar No*

* Either PayoutDate or PayoutReference is mandatory.

Response

The statement in the requested format (CSV, PDF) or JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1122006,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code AccountCurrencyNotAllowed occurred. AccountCurrencyNotAllowed\r\nReturning result code AccountCurrencyNotAllowed"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Autorefunds Statements

API endpoints:
Live - https://aapi.trustpay.eu/api/Statements/Statement

Retrieves autorefunds statement based on date range.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] Statement(string token)
{
   string url = "https://aapi.trustpay.eu/api/Statements/Statement";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Autorefunds",
         Format = "CSV",
         FilterInformation = new
         {
            DateFrom = "2021-07-10",
            DateTo = "2021-07-20"
         },
         Localization = "sk"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function Statement($token)
{
   $url = 'https://aapi.trustpay.eu/api/Statements/Statement';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Autorefunds',
      'Format' => 'CSV',
      'FilterInformation' => array(
         'DateFrom' => '2021-07-10',
         'DateTo' => '2021-07-20'
      ),
      'Localization' => 'sk'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] Statement(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Statements/Statement");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Autorefunds";
            public String Format = "CSV";
            public Object FilterInformation = new Object(){
                public String DateFrom = "2021-07-10";
                public String DateTo = "2021-07-20";
            };
            public String Localization = "sk";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Autorefunds Varchar Yes
Format Statement format StatementFormat Yes
FilterInformation Statement filter information FilterInformation Yes
Localization Language Varchar(2) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
DateFrom Date from Char(10) Yes
DateTo Date to Char(10) Yes

Response

The statement in the requested format (CSV) or JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1042012,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code StatementNotAvailable occurred. StatementNotAvailable\r\nReturning result code StatementNotAvailable"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Frauds Statements

API endpoints:
Live - https://aapi.trustpay.eu/api/Statements/Statement

Retrieves frauds statement based on date range.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] Statement(string token)
{
   string url = "https://aapi.trustpay.eu/api/Statements/Statement";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Frauds",
         Format = "CSV",
         FilterInformation = new
         {
            Currency = "EUR",
            DateFrom = "2021-07-10",
            DateTo = "2021-07-20"
         },
         Localization = "sk"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function Statement($token)
{
   $url = 'https://aapi.trustpay.eu/api/Statements/Statement';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Frauds',
      'Format' => 'CSV',
      'FilterInformation' => array(
         'DateFrom' => '2021-07-10',
         'DateTo' => '2021-07-20'
      ),
      'Localization' => 'sk'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] Statement(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Statements/Statement");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Frauds";
            public String Format = "CSV";
            public Object FilterInformation = new Object(){
                public String DateFrom = "2021-07-10";
                public String DateTo = "2021-07-20";
            };
            public String Localization = "sk";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Frauds Varchar Yes
Format Statement format StatementFormat Yes
FilterInformation Statement filter information FilterInformation Yes
Localization Language Varchar(2) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
DateFrom Date from Char(10) Yes
DateTo Date to Char(10) Yes

Response

The statement in the requested format (CSV) or JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1042012,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code StatementNotAvailable occurred. StatementNotAvailable\r\nReturning result code StatementNotAvailable"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Exports

Export transactions

API endpoints:
Live - https://aapi.trustpay.eu/api/Exports/ExportTransactions

Retrieves transactions export based on the filter criteria. Timestamps are UTC by default. Optionally, when TimeZone parameter is used, the timestamps are converted to the requested timezone.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] ExportTransactions(string token)
{
   string url = "https://aapi.trustpay.eu/api/Exports/ExportTransactions";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Card",
         State = new[] { "Processed", "Refunded", "Pending", "Rejected", "Chargebacked", "Expired", "Preauthorized" },
         Format = "CSV",
         FilterInformation = new
         {
            Currency = "EUR",
            From = "2021-07-10",
            To = "2021-07-20",
            SearchText = "order",
            AmountFrom = 10m,
            AmountTo = 100m,
         },
         Localization = "en",
         TimeZone = "Central Europe Standard Time"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function ExportTransactions($token)
{
   $url = 'https://aapi.trustpay.eu/api/Exports/ExportTransactions';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Card',
      'State' => array('Processed', 'Refunded', 'Pending', 'Rejected', 'Chargebacked', 'Expired', 'Preauthorized'),
      'Format' => 'CSV',
      'FilterInformation' => array(
         'Currency' => 'EUR',
         'From' => '2021-07-10',
         'To' => '2021-07-20'
         'SearchText' => 'order',
         'AmountFrom' = '10.00',
         'AmountTo' = '100.00',
      ),
      'Localization' => 'en'
      'TimeZone' => 'Central Europe Standard Time'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] ExportTransactions(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Exports/ExportTransactions");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Card";
            public String[] State = new String[] {"Processed", "Refunded", "Pending", "Rejected", "Chargebacked", "Expired", "Preauthorized"};
            public String Format = "CSV";
            public Object FilterInformation = new Object(){
                public String Currency = "EUR";
                public String DateFrom = "2021-07-10";
                public String DateTo = "2021-07-20";
                public String SearchText = "order";
                public double AmountFrom = 10.00;
                public double AmountTo = 100.00;
            };
            public String Localization = "en";
            public String TimeZone = "Central Europe Standard Time";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Transaction type TransactionType No
State Transaction state Array of TransactionState No
Format Export format ExportFormat Yes
FilterInformation Export filter information FilterInformation Yes
Localization Language Varchar(2) No
TimeZone Language Time zone name (e.g. Central Europe Standard Time) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
Currency Currency Char(3) No
From Date from Char(10) Yes
To Date to Char(10) Yes
SearchText String to search in transaction references Varchar(35) No
AmountFrom Amount from Numeric(13,2) en-US format No
AmountTo Amount to Numeric(13,2) en-US format No

Response

Successful response includes a Transaction export in the requested format (CSV) with all the columns that are also available on the Merchant Portal. Failed response contains a JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1122006,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code AccountCurrencyNotAllowed occurred. AccountCurrencyNotAllowed\r\nReturning result code AccountCurrencyNotAllowed"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Transaction Types

Value
Wire
Card
SDD
Paysafecard
Giropay
EPS
IDeal
MyBank
Blik
Bancontact
Satispay
InstantBankTransferPL
WeChatPay
AircashPay
Sofort
PayPal
Paytrail

Transaction States

Value
Processed
Refunded
Pending
Rejected
Chargebacked
Expired
Preauthorized

Export Formats

Value Supported types
CSV Transactions, Disputes

Export disputes

API endpoints:
Live - https://aapi.trustpay.eu/api/Exports/ExportDisputes

Retrieves disputes export based on the filter criteria. Timestamps are UTC by default. Optionally, when TimeZone parameter is used, the timestamps are converted to the requested timezone.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] ExportDisputes(string token)
{
   string url = "https://aapi.trustpay.eu/api/Exports/ExportDisputes";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Visa",
         ChargebackType = new[] { "Chargeback", "ChargebackRefund", "ChargebackAdjustment", "Representment", "RepresentmentRefund", "RapidDisputeResolutionPredispute", "RapidDisputeResolutionReversal" },
         Format = "CSV",
         FilterInformation = new
         {
            Currency = "EUR",
            From = "2021-07-10",
            To = "2021-07-20",
            SearchText = "order",
            AmountFrom = 10m,
            AmountTo = 100m,
         },
         Localization = "en",
         TimeZone = "Central Europe Standard Time"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function ExportDisputes($token)
{
   $url = 'https://aapi.trustpay.eu/api/Exports/ExportDisputes';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Visa',
      'ChargebackType' => array('Chargeback', 'ChargebackRefund', 'ChargebackAdjustment', 'Representment', 'RepresentmentRefund', 'RapidDisputeResolutionPredispute', 'RapidDisputeResolutionReversal'),
      'Format' => 'CSV',
      'FilterInformation' => array(
         'Currency' => 'EUR',
         'From' => '2021-07-10',
         'To' => '2021-07-20'
         'SearchText' => 'order',
         'AmountFrom' = '10.00',
         'AmountTo' = '100.00',
      ),
      'Localization' => 'en'
      'TimeZone' => 'Central Europe Standard Time'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] ExportDisputes(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Exports/ExportDisputes");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Visa";
            public String[] ChargebackType = new String[] {"Chargeback", "ChargebackRefund", "ChargebackAdjustment", "Representment", "RepresentmentRefund", "RapidDisputeResolutionPredispute", "RapidDisputeResolutionReversal"};
            public String Format = "CSV";
            public Object FilterInformation = new Object(){
                public String Currency = "EUR";
                public String DateFrom = "2021-07-10";
                public String DateTo = "2021-07-20";
                public String SearchText = "order";
                public double AmountFrom = 10.00;
                public double AmountTo = 100.00;
            };
            public String Localization = "en";
            public String TimeZone = "Central Europe Standard Time";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Dispute type DisputeType No
ChargebackType Chargeback type Array of ChargebackType No
Format Export format ExportFormat Yes
FilterInformation Export filter information FilterInformation Yes
Localization Language Varchar(2) No
TimeZone Language Time zone name (e.g. Central Europe Standard Time) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
Currency Currency Char(3) No
From Date from Char(10) Yes
To Date to Char(10) Yes
SearchText String to search in dispute references Varchar(35) No
AmountFrom Amount from Numeric(13,2) en-US format No
AmountTo Amount to Numeric(13,2) en-US format No

Response

Successful response includes a Dispute export in the requested format (CSV) with all the columns that are also available on the Merchant Portal. Failed response contains a JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1122006,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code AccountCurrencyNotAllowed occurred. AccountCurrencyNotAllowed\r\nReturning result code AccountCurrencyNotAllowed"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Dispute Types

Value
Visa
MasterCard
SDD

Chargeback Types

Value
Chargeback
ChargebackRefund
ChargebackAdjustment
Representment
RepresentmentRefund
RapidDisputeResolutionPredispute
RapidDisputeResolutionReversal
This site uses cookies to provide you with a better browsing experience. By browsing TrustPay websites, you agree with using cookies. Find out more on how we use cookies here.