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
CNY 156 Yuan Renminbi
CZK 203 Czech koruna
DKK 208 Danish Krone
EUR 978 Euro
GBP 826 Pound sterling
HKD 344 Hong Kong Dollar
HUF 348 Hungarian forint
ILS 376 Israeli new shekel
JPY 392 Japanese yen
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 Supported Payment Methods
enEnglishAll payment methods
skSlovakCard Payments, Instant Bank Transfer, Instant Bank Transfer(PL), SEPA Direct Debit, SEPA Credit Transfer, IDeal, MyBank, Blik, Satispay, AircashPay, WeChatPay, Payconiq, OpenBanking
bgBulgarianCard Payments
csCzechCard Payments, Instant Bank Transfer, SEPA Direct Debit, IDeal, MyBank, SEPA Credit Transfer
hrCroatianCard Payments, Aircash
daDanishCard Payments
nlDutchCard Payments, SEPA Direct Debit, IDeal
etEstonianCard Payments
fiFinnishCard Payments, PayTrail
frFrenchCard Payments, SEPA Direct Debit, IDeal, MyBank
deGermanCard Payments, SEPA Direct Debit, IDeal, MyBank, OpenBanking
elGreekCard Payments
huHungarianCard Payments
itItalianCard Payments, SEPA Direct Debit, MyBank
jaJapaneseCard Payments
lvLatvianCard Payments
ltLithuanianCard Payments
nbNorwegian, BokmålCard Payments
plPolishCard Payments, Instant Bank Transfer(PL), Blik
ptPortugueseCard Payments, Multibanco, MbWay
roRomanianCard Payments
ruRussianCard Payments
slSloveneCard Payments
esSpanishCard Payments, SEPA Direct Debit, MyBank
svSwedishCard Payments, PayTrail
ukUkrainianCard Payments

Result codes

The Result code provides the result of the payment request's processing. Its value is returned in response of all APIs for creating/refunding a payment of any method and in error response of any our API.

The list of Result codes

ResultCode Description
1001000Success
1092002TooManyTransactions. Change the request to select less transactions.
1112002AlreadyCanceledReversed
1112003CancelReversalAlreadyProcessing
1112004CutoffTimeExceeded
1112005CancelReversalNotAllowed
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
1133005ApiDomainNotAllowed
1152000RiskDecline

Reason codes

Value of the Reason code specifies why the payment request was rejected. Its value is available for unsuccessful payment requests in Notifications and via Get Payment State API.

The list of Reason codes

ReasonCode Description
400.100.003Timeout
400.100.004Transaction Rejected
400.100.005Canceled by Customer
400.100.006Canceled by Merchant
400.100.007Bank Offline
400.100.008General error
400.200.004Payment too old to be refunded
400.200.005The refund has already been processed
400.200.006The payment to be refunded does not exist
400.200.007Refund exceed deposit volume
400.200.008General refund error
400.300.001Cross-site request forgery
400.300.004Invalid payment state
400.300.005Refund rejected
400.300.006Account currency not allowed
400.300.007Merchant account disabled
400.300.008Disposable balance
400.300.009Transaction not found
400.300.010Unsupported transaction
400.300.011General mapi error
400.300.012Unsupported currency conversion
400.300.013Unknown mandate
400.300.014Canceled mandate
400.300.015Missing CID
400.300.016Mandate already paid
400.300.017Account is testing
400.300.019Service not allowed
400.300.020Payment request not found
400.300.021Unexpected gateway
400.300.022Missing external ID
400.300.023Risk decline
400.300.024Processing ID Used
400.300.025Api domain not allowed
400.300.035General config error
400.900.001Technical error

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, authorized 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
Chargebacked
RapidDisputeResolution
Authorized
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 = 4107123456;
            };
            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.

Recurring Initial Preauthorization

Recurring Initial Preauthorization allows Recurring Subsequent or later Capture of card payments. For instance, this allows merchant to implement auto-recharge payments or scheduled payments.

Note that 0.00 Amount is acceptable for Recurring Initial Preauthorization so that only recurring subsequent payments are available for later processing.

Merchants responsibilities:

Recurring Initial 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",
            "Recurring": true
        }
    },
    "CallbackUrls": {
        "Notification": "https://somedomain.eu/notification_handler"
    }
}
Name Description Format Required
PaymentType In CardTransaction parameter set PaymentType to Preauthorization Varchar Yes
Recurring In CardTransaction parameter set Recurring to True Boolean 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
Debtor Debtor information Debtor Information Yes
Country Format defined in ISO3166-1Alpha-2 Char(2) 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
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
HUF 348 Hungarian forint
ILS 376 Israeli new shekel
JPY 392 Japanese yen
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, Recurring Initial Preauthorization
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 Included
PaymentMethod Card Varchar(4) In case of Capture, Recurring subsequent and Card on File payment types
MerchantIdentification Identification of merchant Merchant Identification In case of Capture, Recurring subsequent and Card on File payment types
PaymentInformation Payment information PaymentInformation In case of Capture, Recurring subsequent and Card on File payment types
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256) In case of any payment type other than Capture, Recurring subsequent and Card on File
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20) Always
ResultInfo Contains result information. ResultInfo Always

Response/MerchantIdentification

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

Response/PaymentInformation

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

Response/PaymentInformation/Amount

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

Response/PaymentInformation/References

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

1 Field present for status Paid

Response/PaymentInformation/Debtor

Name Description Format
Name Debtor Name Varchar(512)

Response/PaymentInformation/DebtorAccount

Name Description Format
Iban Debtor Iban Varchar(512)

Response/PaymentInformation/CardTransaction

Name Description Format
Card Card Details Card Details

Response/PaymentInformation/CardTransaction/Card

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

Response/ResultInfo

Name Description Format
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 NoTD1
Customer Data Additional customer data Customer Data NoTD1
Browser Data Customer's browser information Browser Data NoTD1
Cardholder Holder of the credit card account Varchar(128) 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("cardNumber", {
    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

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:

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: YOUR_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

Use the same parameters as you would with 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

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.

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

Use the same parameters as you would with standard Create Intent, but there is one additional parameter PaymentType required:

Name Description Format Required
PaymentType Must be set to CardOnFileInitial PaymentType Yes
2.
Let the customer execute the initial payment
3.
Make payments with stored card data with our backend S2S Subsequent Card on File 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
CardOnFileInitial The first payment of a card on file payment request
CardOnFileSubsequent Subsequent payment of a card on file 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 203 Czech koruna
EUR 978 Euro
HUF 348 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 NoTD1
Customer Data Additional customer data Customer Data NoTD1
Browser Data Customer's browser information Browser Data NoTD1
Cardholder Holder of the credit card account Varchar(128) No
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 NoTD1
Customer Data Additional customer data Customer Data NoTD1
Browser Data Customer's browser information Browser Data NoTD1
Cardholder Holder of the credit card account Varchar(128) No
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 NoTD1
Customer Data Additional customer data Customer Data NoTD1
Browser Data Customer's browser information Browser Data NoTD1
Cardholder Holder of the credit card account Varchar(128) No
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 NoTD1
Customer Data Additional customer data Customer Data NoTD1
Browser Data Customer's browser information Browser Data NoTD1
Cardholder Holder of the credit card account Varchar(128) No
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"
}

Merchant Advice Codes (MAC)

In response to a recurring request a Merchant Advice Code can be present. These codes offer guidance to merchants on action that can be taken.

MAC can be as follows:
Response Code Description
00 Others
01 New/ Updated Account Information is available
02 Try again later
03 Do not try again
21 Recurring Payment Cancellation Service

Scheme Response Code

In response to a recurring request a Scheme Response Code can be present. This code indicates an issuer’s reason for approving or declining a transaction.

Scheme Response Code can be as follows:
Scheme Response Code Description
00 Approved or completed successfully
01 Refer to card issuer
03 Invalid merchant
04 Capture card
05 Do not honor
08 Honor with ID
10 Partial Approval
12 Invalid transaction
13 Invalid amount
14 Invalid card number
15 Invalid issuer
30 Format error
41 Lost card
43 Stolen card
51 Insufficient funds/over credit limit
54 Expired card
55 Invalid PIN
57 Transaction not permitted to issuer/cardholder
58 Transaction not permitted to acquirer/terminal
61 Exceeds withdrawal amount limit
62 Restricted card
63 Security violation
65 Exceeds withdrawal count limit
70 Contact Card Issuer
71 PIN Not Changed
75 Allowable number of PIN tries exceeded
76 Invalid/nonexistent “To Account” specified
77 Invalid/nonexistent “From Account” specified
78 Invalid/nonexistent account specified (general)
79 Life cycle (Mastercard use only)
80 System not available
81 Domestic Debit Transaction Not Allowed (Regional use only)
82 Policy (Mastercard use only)
83 Fraud/Security (Mastercard use only)
84 Invalid Authorization Life Cycle
85 Not declined
86 PIN Validation not possible
87 Purchase Amount Only, No Cash Back Allowed
88 Cryptographic failure
89 Unacceptable PIN—Transaction Declined—Retry
90 Cutoff is in progress
91 Authorization System or issuer system inoperative
92 Unable to route transaction
94 Duplication transaction detected
96 System error
1Z Authorization System or issuer system inoperative

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 NoTD1
Customer Data Additional customer data Customer Data NoTD1
Browser Data Customer's browser information Browser Data NoTD1
Cardholder Holder of the credit card account Varchar(128) No
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 NoTD1
Customer Data Additional customer data Customer Data NoTD1
Browser Data Customer's browser information Browser Data NoTD1
Cardholder Holder of the credit card account Varchar(128) No
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=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 NoTD1
Customer Data Additional customer data Customer Data NoTD1
Browser Data Customer's browser information Browser Data NoTD1
Cardholder Holder of the credit card account Varchar(128) No
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: YOUR_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: YOUR_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: YOUR_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": "2022-09-19T09:36:03.7851749Z",
    "amount": "0.01",
    "currency": "EUR",
    "reference": "20220919_15",
    "paymentStatus": "000.100.110",
    "paymentDescription": "Request successfully processed in 'Merchant in Integrator Test Mode'",
    "paymentStatusDetails": {
        "extendedDescription": "Approved",
        "schemeResponseCode": "00"
    },
    "threeDSecure": {
        "eci": "05"
    },
    "card": {
        "maskedPan": "420000******0000",
        "expiration": "10/22",
        "description": "Visa •••• 0000"
    }
}

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": "5.00",
    "currency": "EUR",
    "reference": "20220919_15",,
    "paymentStatus": "800.100.203",
    "paymentDescription": "Insufficient Funds",
    "paymentStatusDetails": {
        "additionalResponseReasonCode": "2",
        "extendedDescription": "Not sufficient funds",
        "schemeResponseCode": "51",
        "merchantAdviceCode": "2"
    },
    "card": {
        "maskedPan": "520488******0222",
        "expiration": "01/25",
        "description": "Mastercard •••• 0222"
    }
}
     

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 203 Czech koruna
EUR 978 Euro
HUF 348 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 process (e.g. 3DS challenge) Varchar(256) No1

1 Required for asynchronous operations (e.g. 3DS challenge)

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
Surname Customer's last name or surname Varchar(48) No1
Birthdate Customer's birth day in ISO 8601 YYYY-MM-DD format Varchar(10) No1

1 Required for some risk checks and payment providers

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

TD1 Top-level parameters (Billing.*, Customer.*, Browser.*, ...) are not required, but all structure's sub-parameters are required if any of the sub-parameters are present.

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 successful 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 process, e.g. for completing a 3DS challenge No2
redirectParams Redirection parameters used together with RedirectUrl No2
preconditions Precondition parameters for completing asynchronous process No2
paymentStatus Payment status returned by payment provider No3
paymentDescription Textual representation of payment status No3
paymentStatusDetails Extended payment status details No

1 Field present for successful operations
2 Field present for operations with asynchronous process
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/PaymentStatusDetails

Indicates bank-specific state of a financial transaction, all fields are optional.

Name Description
additionalResponseReasonCode The value of the code is specific for each brand
extendedDescription Textual description of the status
schemeResponseCode Original response code
merchantAdviceCodeCode Merchant Advice Codes (MAC)

Response/Card

Masked card data.

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

1 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.105 Transaction rejected because of technical error in 3DSecure system
100.390.107 Transaction rejected because cardholder authentication unavailable
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)
400.001.002 Transaction is currently being processed, try again later (3DS auth. approved)
400.001.003 Transaction is currently being processed, try again later (3DS auth. waiting for confirmation)
400.001.301 Card not enrolled in 3DS
400.001.302 Transaction is currently being processed, try again later
400.001.600 Authentication error
400.001.601 Transaction declined (auth. declined)
400.001.602 Invalid transaction
400.001.603 Invalid transaction
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.600.100 Transaction is being already processed
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
81Invalid Apple Pay configuration
82Transaction amount exceeded
83Transactions volume exceeded
84Transactions count exceeded
85Card not enrolled for 3DS
86BIN blacklisted
87IP country blacklisted
87External 3DS disabled

Handling 3DS process

Response with preconditions example:

{
  "status": 1,
  "description": "transaction is in pending state",
  "instanceId": "ZVRVpOkcZa8CW0yPus9dzw",
  "redirectUrl": "https://test.trustpay.eu/...",
  "redirectParams": {
      "MD": "8ac7a4a27a2c1670017a2d7f1b09WYXZ",
      "TermUrl": "https://test.trustpay.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 process may be required to complete the transaction.

Most pending transactions with an asynchronous process contain a redirectUrl field together with a set of parameters in redirectParams parameter block.

Optionally, some transactions might contain also a set of parameters in preconditions parameter block.

In case of asynchronous process proceed as follows:

  1. Open a hidden iframe and post data to the preconditions.url URL.
    This applies only if preconditions parameters block is present in the response.
    This should not redirect the shopper. Data is posted on the background.
  2. Redirect the shopper to redirectUrl with redirectParams posted as a form.

If preconditions block is present in the response, the redirect step should take place after onLoad event from step 1. completes. If the onLoad event is not triggered within 10 seconds of submitting - continue with the redirect step.

After the asynchronous process is completed, the customer is redirected to RedirectUrl that the merchant used as a request parameter.

Open a hidden iframe and post data to the Preconditions URL

<form name="methodForm" action="preconditions.url" method="POST" target="preconditions_frame">
    <!-- iterate through all 'preconditions.parameters': (key,value) => name = key, value = value -->
    <input type="hidden" name="threeDSMethodData" value="methodData">
</form>

<!-- hidden iframe for preconditions -->
<iframe name="preconditions_frame" style="display:none;"></iframe>

<script>
    window.onload=methodForm;
    function submitForm() { methodForm.submit(); }
</script>
Redirect the shopper to the Redirect URL using a form to submit data

<form name="redirectForm" action="redirectUrl" method="POST">
    <!-- iterate through all 'redirectParams': (key,value) => name = key, value = value -->    
    <input type="hidden" name="MD" value="8ac7a4a27a2c1670017a2d7f1b09WYXZ">
    <input type="hidden" name="TermUrl" value="https://test.trustpay.eu/..">
    <input type="hidden" name="PaReq" value="IT0ubu...">
    <input type="hidden" name="connector" value="THREEDSECURE">
</form>

<script>
      // if preconditions are present, wait for them to load (via onload event, wait at most 10 seconds)
      window.onload=redirectForm;
      function submitForm() { redirectForm.submit(); }
</script>

Wallet Payments EmbeddedFields

Embedded fields for wallet payments

Embedded fields are convenience components that the merchant can easily include in his solution.

Currently supported components are designed for Apple Pay, Google Pay and MobilePay.

Different embedded fields may have different prerequisites, please refer to below sections.

Apple Pay

For this embedded field to be available, you need to register all of your domains where the component will be placed with Apple.

When configuring button appearance always respect Apple's guidelines.

GooglePay

If you set up this embedded field by either omitting the placement parameter, or by setting placement: trustpay no further prerequisites apply.

If you would like to use your own Google merchant id, you need to:

When configuring button appearance always respect Google's guidelines.

MobilePay

For this embedded field to be available, you need to register your project. Please refer to the relevant documentation or reach out to our support team.

When configuring button appearance always respect MobilePay's guidelines.

How to register for MobilePay

Every Merchant that wants to integrate MobilePay payments with our platform needs to provide:

Please contact our support to assist you with the onboarding process.

Setup

Before you set up the components, you should issue a CreateIntent request if you have not done so yet. To minimize the amount of background calls, it is preferable that you use parts of the response during the setup of the components.

After receiving the response, you need to initialize an instance of the TrustPayApi class.

Initialize TP.js object:

var trustpayApi = new TrustPayApi(createIntentResponse.secrets, {});

All of the embedded fields follow the same scheme:

  1. Add a place holder to your page
  2. Create an instance of the field
  3. Check if the customer's environment supports the relevant payment method and mount the component
  4. Handle the payment result

Setup Apple Pay

1. Add a place holder

Example of an Apple Pay placeholder:

<div id="apple-pay-element"></div>

2. Create an instance of the component

Create an instance of the component:

interface IPaymentResult {
    status:number;
    description:string;
}
apButton = trustpayApi.createComponent("applePay", {
initiativeContext: "my.lovely.site.co.uk",
style: {
    "--apple-pay-button-width": "140px;",
    "--apple-pay-button-height": "30px;"
    "--apple-pay-button-border-radius": "5px;",
    "--apple-pay-button-padding": "5px 0px;",
},
buttonStyle: "black",
buttonType: "buy",
buttonType: "en-US",
onPaymentProcessed: (result: IPaymentResult) => { console.log(result); } 
    // define your callback function
    // - this will be called after the transaction is resolved (either synchronously or asynchronously)
paymentRequest: createIntentResponse.appleInitResultData,  
    // if this is not supplied the component will fetch it from the server 
    // - supplying the parameter is however encouraged since it saves a backend call
});

Parameter Required Value
initiativeContext yes For this required parameter provide the fully qualified domain name of your website from which the payment is initiated. In the case a payment is initiated from a subdomain it is not enough to provide only the top-level domain.
If you initiate payments from multiple subdomains then each one has to be registered and verified under your account in the Merchant Portal.
style no For possible values, please refer to Apple's documentation
buttonStyle no For possible values, please refer to Apple's documentation
If you omit this parameter, the component will try to infer the value based on the placeholder component
buttonType no For possible values, please refer to Apple's documentation
buttonLocale no For possible values, please refer to Apple's documentation
onPaymentProcessed recommended The supplied handler function will trigger once the payment process is completed
paymentRequest recommended It is strongly recommended you supply this parameter with the value of createIntentResponse.appleInitResultData to prevent unnecessary backend calls

3. Check availability and mount

Mount the component:

apButton.isSupported()
  .then(result => {
  if (result) {
     console.log("[Integration] Apple Pay Supported");
     // mount the embedded field to it's place holder
     apButton.mount("#apple-pay-element");
  }
  else {
     console.log("[Integration] Apple Pay NOT supported");
  }
})
  .catch(error => {
     console.log("[Integration] Apple Pay NOT supported", error);
})

4. Handle the result

If you attached a handler function via setting the onPaymentProcessed parameter, it will receive an IPaymentResult object with a specific status code.

Setup Google Pay

1. Add a place holder

Example of a Google Pay placeholder:

<div id="google-pay-element"></div>

2. Create an instance of the component

Create an instance of the component:
    
        interface IPaymentResult {
        status:number;
        description:string;
        }
        var gpButton = trustpayApi.createComponent("googlePay", {
        buttonColor: "black",
        buttonType: "plain",
        buttonLocale: "en",
        buttonSizeMode: "static",
        onPaymentProcessed: (result: IPaymentResult) => { console.log(result); }
        // define your callback function -
        // this will be called after the transaction is resolved (either synchronously or asynchronously)
        paymentRequest: createIntentResponse.googleInitResultData,
        // if this is not supplied the component will fetch it from the server
        // - supplying the parameter is however encouraged since it saves a backend call
        placement: "trustpay",
        });
    
Parameter Required Value
buttonColor no For possible values, please refer to Google's documentation
If you omit this parameter, the component will try to infer the value based on the placeholder component
buttonType no For possible values, please refer to Google's documentation
buttonLocale no For possible values, please refer to Google's documentation
buttonSizeMode no For possible values, please refer to Google's documentation
onPaymentProcessed recommended The supplied handler function will trigger once the payment process is completed
paymentRequest recommended It is strongly recommended you supply this parameter with the value of createIntentResponse.googleInitResultData to prevent unnecessary backend calls
placement no The default value is trustpay, which is suitable for most use cases. If you would like to use your own Google Pay merchant ID with it's registered domain, the value should be set to merchant. Please contact our support team to make sure if this option is available for you

3. Check availability and mount

Mount the component:

gpButton.isSupported()
  .then(result => {
  if (result) {
     console.log("[Integration] Google Pay Supported");
     // mount the embedded field to it's place holder
     gpButton.mount("#google-pay-element");
  }
  else {
     console.log("[Integration] Google Pay NOT supported");
  })
     .catch(error => {
  },
     console.log("[Integration] Google Pay NOT supported", error);
})

4. Handle the result

If you attached a handler function via setting the onPaymentProcessed parameter, it will receive an IPaymentResult object with a specific status code.

Setup MobilePay

1. Add a place holder

Example of a MobilePay placeholder:

<div id="mobile-pay-element"></div>

2. Create an instance of the component

Create an instance of the component:

interface IPaymentResult {
    status:number;
    description:string;
}

enum MobilePayButtonType {
  Standard = "std",
  Checkout = "checkout",
  PayWith = "paywith",
}

enum MobilePayButtonTheme {
  MpBlue = "mpblue",
  DarkBlue = "darkblue",
  White = "white",
  WhiteStroke = "whitestroke"
}

enum MobilePayButtonSize {
  Small = "small",
  Medium = "medium",
  Large = "large"
}

var mpButton = trustpayApi.createComponent("mobilePay", {
  buttonType: MobilePayButtonType.Standard,
  buttonTheme: MobilePayButtonTheme.MpBlue,
  buttonSize: MobilePayButtonSize.Medium,
  buttonLanguage: "en-uk",
  onPaymentProcessed: (result: IPaymentResult) => { console.log(result); },
  // define your callback function - 
  // this will be called after the transaction is resolved (either synchronously or asynchronously)
});

Parameter Required Value
buttonType no MobilePayButtonType.Standard is the default
buttonTheme no f you omit this parameter, the component will try to infer the value based on the placeholder component
buttonSize no MobilePayButtonSize.Medium is the default
buttonLanguage no en-uk is the default. Possible values are: en-uk, da-dk, fi-fi, sv-se, nb-no - these apply to MobilePayButtonType.PayWith
onPaymentProcessed recommended The supplied handler function will trigger once the payment process is completed

3. Check availability and mount

Mount the component:

mpButton.isSupported()
    .then(result => {
    if (result) {
        console.log("[Integration] MobilePay Supported");
        // mount the embedded field to it's place holder
        mpButton.mount("#mobile-pay-element");
    }
    else {
        console.log("[Integration] MobilePay NOT supported");
    })
        .catch(error => {
    },
        console.log("[Integration] MobilePay NOT supported", error);
})

4. Handle the result

If you attached a handler function via setting the onPaymentProcessed parameter, it will receive an IPaymentResult object with a specific status code.

The possible codes are listed below:

Value Explanation
0 Success
1 Pending
-1 Expired
-2 Error
-3 Server call failed
-4 Aborted by user
-255 Failure

The result code will be accompanied by a user readable description.

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 = 4107123456;
            };
            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

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

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 = 4107123456;
            };
            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 = 4107123456;
            };
            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

CashToCode

Payment process

Payment

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

Initiates new CashtoCode 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 = "CashtoCode",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "SK",
             Country = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             Debtor = new
             {
                Address = new
                {
                    CountryCode = "DE"
                },
                Identification = new
                {
                    Id = "123456"
                }
            }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             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' => 'CashtoCode',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'Country' => 'SK'
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'Debtor' => array(
            'Address':{
                'CountryCode':'DE'
            },
            'Identification' => array(
                'Id' => '123456'
            )
         )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         '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 = "CashtoCode";
            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 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 Object Address = new Object(){
                            public String CountryCode = "DE";
                        },
                        public Object Identification = new Object(){
                            public String Id = "123456";
                        };
                };                   
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                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 CashtoCode 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 CashtoCode page. (ISO 639-1 format) Char(2) No
Country Used for pre-selecting the country for the end-user on the CashtoCode 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

Request/PaymentInformation/References

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

Request/PaymentInformation/Debtor

Name Description Format Required
Address Debtor's address Address Yes
Identification Debtor's identification on the merchant platform Identification Yes
Email Debtor's email address Varchar No

Request/PaymentInformation/Debtor/Address

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

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 CashtoCode 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)

Pricepoints

The payment request Amount is validated per requested CountryCode by the following pricepoints.

CountryAmount
AT9.99; 10.00; 12.99; 14.99; 17.99; 19.99; 22.99; 24.99; 25.00; 27.99; 29.99; 34.99; 39.99; 44.99; 49.99; 50.00; 54.99; 59.99; 64.99; 69.99; 74.99; 79.99; 84.99; 89.99; 94.99; 99.99; 100.00; 200.00; 300.00; 400.00; 500.00
DE9.99; 10.00; 12.99; 14.99; 17.99; 19.99; 22.99; 24.99; 25.00; 27.99; 29.99; 34.99; 39.99; 44.99; 49.99; 50.00; 54.99; 59.99; 64.99; 69.99; 74.99; 79.99; 84.99; 89.99; 94.99; 99.99; 100.00; 200.00; 400.00
10.00 - 500.00 range(s) may be applied with a limited number of CashtoCode partners
IT9.99; 10.00; 12.99; 14.99; 17.99; 19.99; 22.99; 24.99; 25.00; 27.99; 29.99; 34.99; 39.99; 44.99; 49.99; 50.00; 54.99; 59.99; 64.99; 69.99; 74.99; 79.99; 84.99; 89.99; 94.99; 99.99; 100.00; 150.00; 200.00; 300.00; 400.00; 500.00
IE9.99; 10.00; 12.99; 14.99; 17.99; 19.99; 22.99; 24.99; 25.00; 27.99; 29.99; 34.99; 39.99; 44.99; 49.99; 50.00; 54.99; 59.99; 64.99; 69.99; 74.99; 79.99; 84.99; 89.99; 94.99; 99.99; 100.00; 150.00; 200.00; 300.00; 400.00; 500.00
10.00 - 800.00 range(s) may be applied with a limited number of CashtoCode partners

CashtoCode notifications v3

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

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

CashtoCode 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 = 4107123456;
            };
            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)

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 = 4107123456;
            };
            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 = 4107123456;
            };
            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

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 = 4107123456;
            };
            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
ShippingInformation Shipping data ShippingInformation 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/PaymentInformation/ShippingInformation

Name Description Format Required
Addressee Addressee data Addressee Yes

Request/PaymentInformation/ShippingInformation/Addressee

Name Description Format Required
FirstName First name Varchar(100) Yes
LastName Last name Varchar(100) Yes
Email Email address Varchar(256) 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 = 4107123456;
            };
            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

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 = 4107123456;
            };
            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/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 = 4107123456;
            };
            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)

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

Instant Bank Transfers

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 = "Wire";
            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 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) 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
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 (FI)

Payment process

Payment

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

Initiates new Instant Bank Transfers (FI) 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 = "InstantBankTransferFI",
         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' => 'InstantBankTransferFI',
      '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 = "InstantBankTransferFI";
            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 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)

Instant Bank Transfers (FI) notifications v3

Instant Bank Transfers (FI) URL notification v3 example:
https://example.handler.com/

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

Instant Bank Transfers (FI) 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

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 = 4107123456;
            };
            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

MbWay

Payment process

Payment

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

Initiates new MbWay 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 = "MbWayId",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Debtor = new
             {
                 Phone = "+421 XXXXXXXXX"
             },
             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' => 'MbWayId',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
          'Debtor' => array (
            'Phone' => '+421 XXXXXXXXX'
          ),
         '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 = "MbWayId";
            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 Debtor = new Object(){
                        public String Phone = "+421 XXXXXXXXX";
                };
                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 MbWayId 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 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
Phone Debtor's phone Varchar (e.g.+countrycode phonenumber, +421 XXXXXXXXX ) 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)

MbWay notifications v3

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

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

MbWay 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

Multibanco

Payment process

Payment

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

Initiates new Multibanco 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 = "Multibanco",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             DueDate = "2023-04-28",
         },
         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' => 'Multibanco',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'DueDate' => '2023-04-28',
      ),
      '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 = "Multibanco";
            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 String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public String DueDate = "2023-04-28";
            };
            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 Multibanco 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
DueDate Date to which the transaction should be carried out, YYYY-MM-DD format. Max current date + 30 days. Varchar(10) 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

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)

Multibanco notifications v3

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

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

Multibanco 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 = "CT000005:it"
             },
             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' => 'CT000005:it'
          ),
         '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 = 4107123456;
            };
            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 = "CT000005:it";
                };
                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 participant bank identifier and aliasLanguage, format ParticipantBankId:aliasLanguage, e.g. CT000005:it 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 = 4107123456;
            };
            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

Na splátky Tatra banka

Payment process

Payment

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

Initiates new NasplatkyTB 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 = "NasplatkyTB",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             Debtor = new 
             {
                 FirstName = "John",
                 LastName = "Doe",
                 Email = "email@example.com"
             },
             OrderedItems = new []
             {    
                 new 
                 {
                     Name = "Item1",
                     Quantity = 1,
                     Price = 1.50
                 }
             },
         }
         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' => 'NasplatkyTB',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'Debtor' => array(
            'FirstName' => 'John',
            'LastName' => 'Doe',
            'Email' => 'email@example.com'
          ),
          'OrderedItems' => array(
            array(
              'Name' => 'Item1',
              'Quantity' => '1',
              'Price' => '1.50'
            )
          )
      ),
      '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 = "NasplatkyTB";
            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 String Localization = "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 = "Doe";
                    public String Email = "email@example.com";
                };
                public Object[] OrderedItems = new Object[]{
                    new Object(){
                        public String Name = "Item1";
                        public int Quantity = 1;
                        public double Price = 1.50;
                    };
                };
            };
            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 NasplatkyTB 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 Localization Char(2) No
References Reference (merchant’s payment identification) References Yes
Debtor Debtor Debtor Yes
OrderedItems Array of ordered items OrderedItem 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
FirstName FirstName Varchar(50) Yes
LastName LastName Varchar(50) Yes
Email Email Varchar(320) Yes
Phone Phone Varchar(30) No

Request/PaymentInformation/OrderedItem

Name Description Format Required
Name Name Varchar(255) Yes
Quantity Quantity Numeric Yes
Price Price Numeric(13,2) en-US format 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)

Na splátky Tatra banka notifications v3

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

    {
    "PaymentMethod": "NasplatkyTB",
    "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"
    }

NasplatkyTB 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

OpenBanking

Payment process

Payment

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

Initiates new OpenBanking 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 = "OpenBanking",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "SK",
             Country = "DE",
             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' => 'OpenBanking',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'Country' => 'DE'
         '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 = "OpenBanking";
            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 String Localization = "SK";
                public String Country = "DE"
                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"
    }
}

   
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod OpenBanking 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 OpenBanking page. (ISO 639-1 format) Char(2) No
Country Used for pre-selecting the country for the end-user on the OpenBanking page. (ISO 3166-2 format) 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/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 OpenBanking 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)

OpenBanking notifications v3

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

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

OpenBanking 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: Authorized, 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

Payconiq

Payment process

Payment

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

Initiates new Payconiq 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 = "Payconiq",
         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' => 'Payconiq',
      '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 = "Payconiq";
            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 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 Payconiq 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)

Payconiq notifications v3

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

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

Payconiq 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 = 4107123456;
            };
            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
AUD 036 Australian Dollar
CAD 124 Canadian Dollar
CHF 756 Swiss Franc
CNY 156 Yuan Renminbi
CZK 203 Czech koruna
DKK 208 Danish Krone
EUR 978 Euro
GBP 826 Pound sterling
HKD 344 Hong Kong Dollar
HUF 348 Hungarian forint
ILS 376 Israeli new shekel
JPY 392 Japanese yen
NOK 578 Norwegian Krone
PLN 985 Polish zloty
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
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

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 = 4107123456;
            };
            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
EUR 978 Euro
GBP 826 Pound sterling
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

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 = 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 = "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
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

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 = 4107123456;
            };
            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) 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
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

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 = 4107123456;
            };
            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
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 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
Success Url address to which the customer is redirected after successful payment (if PayNow was chosen) Varchar(256) No
Notification Url address to which the notifications regarding this payment should be sent (if PayNow was chosen) 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

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 = 4107123456;
            };
            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 = 4107123456;
    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 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/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) No

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

SkipPay

Payment process

Payment

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

Initiates new SkipPay 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 = "SkipPay",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "CZK"
             },
             Localization = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             Debtor = new 
             {
                 FirstName = "John",
                 LastName = "Doe",
                 Email = "email@example.com",
                 Phone = "+420123456789"
             },
             OrderedItems = new []
             {    
                 new 
                 {
                     Code = "1",
                     Name = "Item1",
                     Price = 1.50,
                     Vat = 0.15,
                     VatRate = 10
                 }
             },
            FinancingType = "DEFERRED_PAYMENT"
         },
         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' => 'SkipPay',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'CZK'
          ),
         'Localization' => 'SK',
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'Debtor' => array(
            'FirstName' => 'John',
            'LastName' => 'Doe',
            'Email' => 'email@example.com',
            'Phone' => '+420123456789'
          ),
          'OrderedItems' => array(
            array(
              'Code' => '1',
              'Name' => 'Item1',
              'Price' => '1.50',
              'Vat' => '0.15',
              'VatRate' => '10'
            )
          ),
          'FinancingType' => 'DEFERRED_PAYMENT'
      ),
      '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 = "SkipPay";
            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 = "CZK";
                };
                public String Localization = "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 = "Doe";
                    public String Email = "email@example.com";
                    public String Phone = "+420123456789";
                };
                public Object[] OrderedItems = new Object[]{
                    new Object(){
                        public String Code = "1";
                        public String Name = "Item1";
                        public double Price = 1.50;
                        public double Vat = 0.15;
                        public int VatRate = 10;
                    };
                };
                public String FinancingType = "DEFERRED_PAYMENT";
            };
            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 SkipPay 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 Localization Char(2) No
References Reference (merchant’s payment identification) References Yes
Debtor Debtor Debtor Yes
OrderedItems Array of ordered items OrderedItem Yes
FinancingType Financing type Varchar Yes

Request/PaymentInformation/FinancingType

FinancingType
DEFERRED_PAYMENT
PAY_IN_THREE

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places)
DEFERRED_PAYMENT Min: 3000.00 Max: 60000.00
PAY_IN_THREE Max: 10000.00
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. CZK.

List of currencies

Code ID Name
CZK 203 Czech koruna

Request/PaymentInformation/References

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

Request/PaymentInformation/Debtor

Name Description Format Required
FirstName FirstName Varchar(50) Yes
LastName LastName Varchar(50) Yes
Email Email Varchar(254) Yes
Phone Phone Varchar(13) Yes

Request/PaymentInformation/OrderedItem

Name Description Format Required
Code Code Varchar(200) Yes
Name Name Varchar(255) Yes
Price Price Numeric(13,2) en-US format Yes
Vat VAT Numeric(13,2) en-US format Yes
VatRate VAT rate Numeric 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)

SkipPay notifications v3

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

    {
    "PaymentMethod": "SkipPay",
    "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"
    }

SkipPay 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

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 = 4107123456;
            };
            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 = 4107123456;
            };
            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

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 = 4107123456;
            };
            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
DKK 208 Danish Krone
EUR 978 Euro
NOK 578 Norwegian Krone
SEK 752 Swedish Krona
GBP 826 Pound sterling

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

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 = 4107123456;
            };
            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
CNY 156 Yuan Renminbi
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

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": "400.100.008",
                    "RejectReason": "General error"
                }
            },
            "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
Payout
Autorefunds
Frauds
PayPalTransactions
Disputes

Statement Formats

Value Supported types
CSV Transactions, Fees, RollingReserves, Payout, Autorefunds, Frauds, PayPalTransactions, Disputes
PDF Transactions, Fees, RollingReserves, Payout, PayPalTransactions, Disputes
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", "Authorized", "Canceled" },
    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', 'Authorized', 'Canceled'),
    '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", "Authorized", "Canceled"};
    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
Trustly
CashToCode
Payconiq
Multibanco
MbWay

Transaction States

Value
Processed
Refunded
Pending
Rejected
Chargebacked
Expired
Preauthorized
Authorized
Canceled

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

MobileSDK

Overview

Our MobileSDK provides a straightforward solution for integrating payment functionalities into mobile applications. This SDK is available for both Android and iOS platforms, allowing developers to incorporate these payment options into their apps. Currently it supports the following payment methods:

Features

Getting Started

To start using our MobileSDKs, follow the installation instructions provided in the respective SDK documentation. For Android, you will need to add the necessary Gradle dependency to your project, and for iOS, you can install the SDK as Github repository dependency.

Support

For further assistance and support, please refer to our detailed documentation for each platform or contact our support team.



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.