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

Overview of payment process

Intro

The Trust Pay Merchant API (payment service) is an internet based payment tool that merchants can use to receive payments from clients. By integrating this service, merchants are able to process both instant bank transfer and card payments.

API endpoints:
Test - https://playground.trustpay.eu/
Live - https://ib.trustpay.eu/

Payment process

Instant Bank transfers

Payment setup

API endpoints:
Test - https://playground.trustpay.eu/mapi/pay.aspx
Live - https://ib.trustpay.eu/mapi/pay.aspx

Merchant's implementation has to redirect the client to the Merchant API with the following parameters:

Payment setup example:

string baseUrl = "https://playground.trustpay.eu/pay.aspx";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
string NURL = "https://example.handler.com/result.php";
        
string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&NURL={5}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), HttpUtility.UrlEncode(NURL));

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/pay.aspx";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$NURL = "https://example.handler.com/result.php";

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&NURL=%s", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, 
    urlencode($REF), urlencode($NURL));
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/pay.aspx";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";
String  NURL = "https://example.handler.com/result.php";

try
{
    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&NURL=%s", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), 
        URLEncoder.encode(NURL, "UTF-8"));
    response.sendRedirect(url);
}catch(Exception ex){}

curl https://playground.trustpay.eu/pay.aspx \
-d "AID=2107111111" \
-d "AMT=1.50" \
-d "CUR=EUR" \
-d "REF=123456789" \
-d "NURL=https%3A%2F%2Fexample.handler.com%2Fresult.php"

<form method="GET" action="https://playground.trustpay.eu/pay.aspx">
    <input type="hidden" name="AID" value="2107111111" />
    <input type="hidden" name="AMT" value="1.50" />
    <input type="hidden" name="CUR" value="EUR" />
    <input type="hidden" name="REF" value="123456789" />
    <input type="hidden" name="NURL" value="https%3A%2F%2Fexample.handler.com%2Fresult.php" />
    <input type="submit" value="pay" />
</form>
Name Description Format Required
AID Merchant account ID (ID of account assigned by Trust Pay) Numeric(10) Yes
AMT Amount of the payment (exactly 2 decimal places) Numeric(13,2)
en-US format
For secure requests
CUR Currency of the payment (same as currency of merchant account) Char(3) Yes
REF Reference (merchant’s payment identification) Varchar(500)1 For secure requests
URL Return URL (overrides any default Return URL, can be overridden further by RURL, CURL, EURL) Varchar(256) No
RURL Return URL (overrides default Success Return URL) Varchar(256) No
CURL Cancel URL (overrides default Cancel Return URL) Varchar(256) No
EURL Error URL (overrides default Error Return URL) Varchar(256) No
NURL Notification URL (overrides default Notification URL) Varchar(256) No
SIG Data signature calculated from concatenated values of AID, AMT, CUR, and REF parameters Char(64) For secure requests
LNG Default language for Trust Pay site Char(2) No
CNT Default country of client Char(2) No
DSC Description (payment description text that will be displayed to the user) Varchar(256) No
EMA Customer email Varchar(254) No
GW Gateway Varchar(256) No

1 The reference can not contain characters < and >

Payment result

After paying, the customer is redirected to one of the return URLs provided by the Merchant:

The following parameters are always being sent with the redirects:

Payment result example:
https://example.handler.com/result.php?&REF=1234567890&RES=0&PID=4337417657
Name Description Format
REF Reference (merchant’s payment identification) Varchar(500)
RES Result code Numeric(4)
PID Processing ID (sent when available, can be used for inquiries regarding failed payments) Numeric(10)

Payment notification

For each announced, authorized, or successfully finished payment on the merchant’s account, Trust Pay sends the result of the payment to the Merchant in notification URL and/or e-mail using the following parameters:

Payment URL notification example:
https://example.handler.com/result.php?AID=2107111111&TYP=CRDT&AMT=6.00&CUR=EUR&REF=1234567890&RES=0&TID=177561&OID=19553&TSS=Y&SIG=C4FFA5F7B57A0F5E6DD105197C8B7D7B9214509F3618CDC0F527C9B4E57F0334
Payment E-mail notification example:
MerchantAccountID: 2107111111
Type: CRDT
Amount: 6.00
Currency: EUR
Reference: 1234567890
ResultCode: 0
TransactionID: 177561
OrderID: 19553
TransactionSigned: Y
SIGN: C4FFA5F7B57A0F5E6DD105197C8B7D7B9214509F3618CDC0F527C9B4E57F0334
Name Description Format
AID Merchant account ID (ID of account assigned by Trust Pay) Numeric(10)
TYP Type of transaction (CRDT or DBIT) Char(4)
AMT Amount of the payment (exactly 2 decimal places) Numeric(13,2), en-US format
CUR Currency of the payment (same as currency of merchant account) Char(3)
REF Reference (merchant’s payment identification) Varchar(500)
RES Result code Numeric(4)
TID Trust Pay Payment ID Numeric(10)
OID Trust Pay Order ID (ID of payment order - 0 if no order available) Numeric(10)
TSS Transaction signed (if request from merchant was signed, this value determines whether the payment was done with same signed values as specified by merchant) Char(1)
SIG Data signature calculated from concatenated values of AID, TYP, AMT, CUR, REF, RES, TID, OID and TSS parameters Char(64)

Notifications can be sent to the Merchant using the following channels:

Direct banking

Intro

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:
Test - https://playground.trustpay.eu/mapi/GetBankList.aspx
Live - https://ib.trustpay.eu/mapi/GetBankList.aspx

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.

Get bank list example:
        
string baseUrl = "https://playground.trustpay.eu/mapi/GetBankList.aspx";
string CNT = "SK"
       
string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?CNT={1}", baseUrl, CNT);

Response.Redirect(url);
            
        

$baseUrl = "https://playground.trustpay.eu/mapi/GetBankList.aspx";
$CNT = "SK";

$url = sprintf("%s?CNT=%s", $baseUrl, $CNT);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi/GetBankList.aspx";
String  CNT = "SK";

try
{
    String url = String.format(Locale.ROOT,
        "%s?CNT=%s", baseUrl, CNT);
    response.sendRedirect(url);
}catch(Exception ex){}

curl https://playground.trustpay.eu/mapi/GetBankList.aspx \
-d "CNT=SK" \

<form method="GET" action="https://playground.trustpay.eu/mapi/GetBankList.aspx">
    <input type="hidden" name="CNT" value="SK" />
    <input type="submit" value="pay" />
</form>
Name Description Format Required
CNT Country of client Char(2) No
AID Merchant account ID (ID of account assigned by Trust Pay) Numeric(10) No

Result

Returned list of banks should be presented to the customer with the aim to select his bank. His bank would be the one, in which the account he will be executing the payment from is held. It is essential for the customer to understand this, as choosing an incorrect bank will hinder him from executing an online payment or might delay an offline payment.

Get bank list response example:

<MapiGwListResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<MapiGwList>
		<MapiGw>
			<OnlinePayment>true</OnlinePayment>
			<OfflinePayment>true</OfflinePayment>
			<IsOnline>true</IsOnline>
			<GwKey>TatraPay</GwKey>
			<Name>Tatra banka</Name>
			<IBUrl>https://moja.tatrabanka.sk/ib-beta/ibanking.html</IBUrl>
			<Country>SK</Country>
			<Currency>EUR</Currency>
			<OnlineNotice/>
			<OfflineNotice/>
		</MapiGw>
		<MapiGw>
			<OnlinePayment>true</OnlinePayment>
			<OfflinePayment>true</OfflinePayment>
			<IsOnline>true</IsOnline>
			<GwKey>SporoPay</GwKey>
			<Name>Slovenska sporitelna2</Name>
			<IBUrl>https://ib.slsp.sk/main/start.do</IBUrl>
			<Country>SK</Country>
			<Currency>EUR</Currency>
			<OnlineNotice/>
			<OfflineNotice/>
		</MapiGw>
		<MapiGw>
			<OnlinePayment>false</OnlinePayment>
			<OfflinePayment>true</OfflinePayment>
			<IsOnline>false</IsOnline>
			<GwKey>EPlatby</GwKey>
			<Name>VUB</Name>
			<IBUrl>https://ib.vub.sk/</IBUrl>
			<Country>SK</Country>
			<Currency>EUR</Currency>
			<OnlineNotice/>
			<OfflineNotice/>
		</MapiGw>
	</MapiGwList>
</MapiGwListResponse>
    

MapiGwListResponse

Name Description Format
MapiGwList List of gateways. MapiGwListResponse/XmlMapiGateway

MapiGwListResponse/XmlMapiGateway

Name Description Format
OnlinePayment “true” when online payment service is available. Customer can be redirect to gateway (using processing ID) and process online payment. boolean
OfflinePayment “true” when offline payment service is available. Customer can be instructed to pay using payment instructions. boolean
GwKey Gateway key, used in subsequent calls. string
Name Bank name. string
IBUrl Link to bank’s internet banking. Used for offline payment. string
Country Bank’s country. Char(2)
Currency Bank’s currency. Char(3)
OnlineNotice Contains a notice regarding the online payment gateway status. string
OfflineNotice Contains a notice regarding the offline payment gateway status. string

Setup payment

API endpoints:
Test - https://playground.trustpay.eu/mapi/SetupPayment.aspx
Live - https://ib.trustpay.eu/mapi/SetupPayment.aspx

Used when merchant needs to setup payment – in case when gateway or currency is not know or gate is available only for offline payment or merchant has other reason (e.g. multicurrency). Merchant sends request with parameters. Result is XML with payment details.

Payment setup example:

string baseUrl = "https://playground.trustpay.eu/mapi/SetupPayment.aspx";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
string GW = "TatraPay";
string NURL = "https://example.handler.com/result.php";
        
string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&GW={5}&NURL={6}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), GW, HttpUtility.UrlEncode(NURL));

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi/SetupPayment.aspx";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$GW = "TatraPay";
$NURL = "https://example.handler.com/result.php";

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&GW=%s&NURL=%s", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, 
    urlencode($REF), GW, urlencode($NURL));
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String baseUrl = "https://playground.trustpay.eu/mapi/SetupPayment.aspx";
long AID = 2107111111;
double AMT = 1.5d;
String CUR = "EUR";
String REF = "123456789";
String GW = "TatraPay";
String NURL = "https://example.handler.com/result.php";

try
{
    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&GW=%s&NURL=%s", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), 
        GW, URLEncoder.encode(NURL, "UTF-8"));
    response.sendRedirect(url);
}catch(Exception ex){}

curl https://playground.trustpay.eu/mapi/SetupPayment.aspx \
-d "AID=2107111111" \
-d "AMT=1.50" \
-d "CUR=EUR" \
-d "REF=123456789" \
-d "GW=TatraPay" \
-d "NURL=https%3A%2F%2Fexample.handler.com%2Fresult.php"

<form method="GET" action="https://playground.trustpay.eu/mapi/SetupPayment.aspx">
    <input type="hidden" name="AID" value="2107111111" />
    <input type="hidden" name="AMT" value="1.50" />
    <input type="hidden" name="CUR" value="EUR" />
    <input type="hidden" name="REF" value="123456789" />
    <input type="hidden" name="GW" value="TatraPay" />
    <input type="hidden" name="NURL" value="https%3A%2F%2Fexample.handler.com%2Fresult.php" />
    <input type="submit" value="pay" />
</form>
Name Description Format Required
AID Merchant account ID (ID of account assigned by Trust Pay) Numeric(10) Yes
AMT Amount of the payment (exactly 2 decimal places) Numeric(13,2)
en-US format
For secure requests
CUR Currency of the payment (same as currency of merchant account) Char(3) Yes
REF Reference (merchant’s payment identification) Varchar(500)1 For secure requests
SIG Data signature calculated from concatenated values of AID, AMT, CUR, and REF parameters Char(64) For secure requests
GW Gateway GWKey of bank returned in GetBankList string No2
CNT Country of client Char(2) No2
NURL Notification URL (overrides default Notification URL) Varchar(256) No

1 The reference can not contain characters < and >

2 In the case of multicurrency requests with currency in the request different from the account currency, at least one of the parameters GW or CNT is required.

Result

Setup payment call results in XML containing payment data, gateway details and payment instructions.

Payment setup response example:

<SetupPaymentResultXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<Data>
		<InvoiceId>4391305825</InvoiceId>
		<OrderedAmount Currency="EUR">100</OrderedAmount>
		<InstructedAmount Currency="EUR">100</InstructedAmount>
	</Data>
	<GatewayDetails>
		<GatewayName>Tatra banka</GatewayName>
		<OnlineAvailable>true</OnlineAvailable>
		<OfflineAvailable>true</OfflineAvailable>
		<OnlineNotice>Online notice test: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ac neque lorem. Integer malesuada sollicitudin viverra. Aenean in urna eu arcu hendrerit aliquam vitae sit amet metus. Maecenas porta sollicitudin imperdiet. Aenean scelerisque turpis in leo condimentum ultricies. Duis et odio et nulla dignissim interdum.</OnlineNotice>
		<BankProcessingTimes>
			<WorkDaysFrom>00:00</WorkDaysFrom>
			<WorkDaysTo>00:00</WorkDaysTo>
			<WeekendsFrom>00:00</WeekendsFrom>
			<WeekendsTo>00:00</WeekendsTo>
		</BankProcessingTimes>
	</GatewayDetails>
	<OfflinePaymentInstructions>
		<Item Language="EN" Key="recipient_account" Label="The beneficiary’s account">test 2625225129</Item>
		<Item Language="EN" Key="bank_code" Label="Bank code">1100</Item>
		<Item Language="EN" Key="constant_symbol" Label="Constant symbol">do not fill out</Item>
		<Item Language="EN" Key="variable_symbol" Label="Variable symbol">do not fill out</Item>
		<Item Language="EN" Key="amount" Label="Amount">100.00 EUR</Item>
		<Item Language="EN" Key="payment_description" Label="Payment description">4391305825</Item>
		<Item Language="SK" Key="recipient_account" Label="Účet príjemcu">test 2625225129</Item>
		<Item Language="SK" Key="bank_code" Label="Kód banky">1100</Item>
		<Item Language="SK" Key="constant_symbol" Label="Konštantný symbol">nevypĺňate</Item>
		<Item Language="SK" Key="variable_symbol" Label="Variabilný symbol">nevypĺňate</Item>
		<Item Language="SK" Key="amount" Label="Suma">100.00 EUR</Item>
		<Item Language="SK" Key="payment_description" Label="Popis platby">4391305825</Item>
	</OfflinePaymentInstructions>
</SetupPaymentResultXml>
    

SetupPaymentResultXml

Name Description Format
Data Basic payment data SetupPaymentResultXml/Data
GatewayDetails Gateway details SetupPaymentResultXml/GatewayDetails
OfflinePaymentInstructions Payment instructions for offline payment or international payment in languages supported for countries. Format depends on specified country. SetupPaymentResultXml/OfflinePaymentInstructionItemXml

SetupPaymentResultXml/Data

Name Description Format
InvoiceId Invoice ID (processing ID). Unique parameter for identification of payment transaction. Required parameter for ExecutePayment string
OrderedAmount Amount which will be received by recipient SetupPaymentResultXml/Data/OrderedAmountXml
InstructedAmount Amount to be paid by customer SetupPaymentResultXml/Data/InstructedAmountXml
DueDate Only for multicurrency payment. Date till is needed to process payment. If TrustPay receives payment later, the recipient may receive a different sum. UTC, ISO 8601 standart, sortable format - "yyyy'-'MM'-'dd'T'HH':'mm':'ss"

SetupPaymentResultXml/GatewayDetails

Name Description Format
GatewayName Name of gateway. string
OnlineAvailable Indicates if the gateway is available for online payments. boolean
OfflineAvailable Indicates if the gateway is available for offline payments. boolean
OnlineNotice Info about temporary/permanent unavailability of gateway for online payment (reason, term etc). string
OfflineNotice Info about temporary/permanent unavailability of gateway for offline payment (reason, term etc). string
BankProcessingTimes Bank processing times. In case that order is submitted out of bank processing times, it will not be processed instantly. SetupPaymentResultXml/GatewayDetails/BankProcessingTimesXml

SetupPaymentResultXml/OfflinePaymentInstructionItemXml

Name Description Format
Language Payment instruction language Char(2)
Key Payment instruction key string
Label Payment instruction label string
Value Payment instruction value string

SetupPaymentResultXml/Data/OrderedAmountXml or SetupPaymentResultXml/Data/InstructedAmountXml

Name Description Format
Currency Currency string
Amount Amount decimal

SetupPaymentResultXml/GatewayDetails/BankProcessingTimesXml

Name Description Format
WorkDaysFrom Start bank processing time during workdays. time1
WorkDaysTo End bank processing time during workdays. time1
WeekendsFrom Start bank processing time during holidays. time1
WeekendsTo End bank processing time during holidays. time1

124-hour clock time from 00:00 to 23:59

Execute payment

API endpoints:
Test - https://playground.trustpay.eu/mapi/RedirectToBank.aspx
Live - https://ib.trustpay.eu/mapi/RedirectToBank.aspx

Used when SetupPayment was used before. Merchant redirects customer to Merchant API. Payment transaction is identified by processing ID (which is required redirection parameter) and customer is redirected to particular gateway to process online payment.

Payment setup example:

string baseUrl = "https://playground.trustpay.eu/mapi/RedirectToBank.aspx";
string PID = "4312345678";
string EURL = "https://example.handler.com/error.php";
        
string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?PID={1}&EURL={2}",
    baseUrl, PID, HttpUtility.UrlEncode(EURL));

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi/RedirectToBank.aspx";
$PID = "4312345678";
$EURL = "https://example.handler.com/error.php";

$url = sprintf(
    "%s?PID=%d&EURL=%s", 
    $baseUrl, $PID, urlencode($EURL));
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String baseUrl = "https://playground.trustpay.eu/mapi/RedirectToBank.aspx";
String PID = "4312345678";
String EURL = "https://example.handler.com/error.php";

try
{
    String url = String.format(
        Locale.ROOT,"%s?PID=%s&EURL=%s", 
        baseUrl, PID, URLEncoder.encode(EURL, "UTF-8"));
    response.sendRedirect(url);
}catch(Exception ex){}

curl https://playground.trustpay.eu/mapi/RedirectToBank.aspx \
-d "PID=4312345678" \
-d "EURL=https%3A%2F%2Fexample.handler.com%2Ferror.php"

<form method="GET" action="https://playground.trustpay.eu/mapi/RedirectToBank.aspx">
    <input type="hidden" name="PID" value="4312345678" />
    <input type="hidden" name="EURL" value="https%3A%2F%2Fexample.handler.com%2Ferror.php" />
    <input type="submit" value="pay" />
</form>
Name Description Format Required
PID Processing ID Include InvoiceID (unique parameter needed for indetification of payment transaction) Char(35) Yes
URL Return URL (overrides any default Return URL, can be overridden further by RURL, CURL, EURL) Varchar(256) No
RURL Return URL (overrides default Success Return URL) Varchar(256) No
CURL Cancel URL (overrides default Cancel Return URL) Varchar(256) No
EURL Error URL (overrides default Error Return URL) Varchar(256) No
NURL Notification URL (overrides default Notification URL) Varchar(256) No
LNG Default language1 Char(2) No

1Applying of requested language depends on particular redirect bank.

Signature

Creating a secret key

For test purposes, you can create a test account with a secret key in the playground. This secret key can not be changed.

For live environment, a different secret key is automatically generated for every merchant account. You can view this secret key in your TrustPay Internet Banking under Account Details – 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 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 signature is created using secret key and message data. Message data is obtained by concatenating request parameters and details are explained in documentation for specific operations. 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 Trust Pay.

Verification of a signature

Here you can verify your implementation of Trust Pay signature. Just enter your parameters and the signature you calculated and our tool will check whether the signature is valid or not.















Card payments

Visa and MasterCard card payments work in a similar way to instant bank transfers, with the differences described in this chapter.

Successful notifications are sent with result code 3 – authorized, which also means that the payment has been captured. All payments in an agreed period will be settled to your Trust Pay account later in a single transaction. You will not receive any further notifications for the individual card transactions.

Test cards

When you are testing your implementation on the playground, 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

Purchase

API endpoints:
Test - https://playground.trustpay.eu/mapi5/Card/Pay
Live - https://ib.trustpay.eu/mapi5/Card/Pay

Merchant's implementation has to redirect the client to the Merchant API with the following parameters:

Payment setup example:

string baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}", AID, AMT, CUR, REF);
string SIG = GetSignature(secretKey, sigData);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&SIG={5}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), SIG);

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
        
$secretKey = "123456";
$sigData = sprintf("%d%s%s%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF);
$SIG = GetSignature($secretKey, $sigData);

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&SIG=%s", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, urlencode($REF), $SIG);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d%.2f%s%s", AID, AMT, CUR, REF);
    String SIG = GetSignature(secretKey, sigData);

    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&SIG=%s", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), SIG);
    response.sendRedirect(url);
}catch(Exception ex){}
Name Description Format Required
AID Merchant account ID (ID of account assigned by Trust Pay) Numeric(10) Yes
AMT Amount of the payment (exactly 2 decimal places) Numeric(6,2)
en-US format
For secure requests
CUR Currency of the payment Char(3) Yes
REF Reference (merchant’s payment identification) Varchar(19)1 For secure requests
URL Return URL (overrides any default Return URL, can be overridden further by RURL, CURL, EURL) Varchar(256) No
RURL Return URL (overrides default Success Return URL) Varchar(256) No
CURL Cancel URL (overrides default Cancel Return URL) Varchar(256) No
EURL Error URL (overrides default Error Return URL) Varchar(256) No
NURL Notification URL (overrides default Notification URL) Varchar(256) No
SIG Data signature calculated from concatenated values of AID, AMT, CUR, and REF parameters Char(64) Yes
LNG Default language for Trust Pay site Char(2) No
CNT Default country of client Char(2) No
DSC Description (payment description text that will be displayed to the user) Varchar(256)2 No
EMA Customer email Varchar(32) No

1 Only alphanumeric characters are allowed. Other characters may be lost or changed during payment process.
2 Only alphanumeric and space characters are allowed. Other characters may not be displayed correctly.

Card on file

API endpoints:
Test - https://playground.trustpay.eu/mapi5/Card/Pay
Live - https://ib.trustpay.eu/mapi5/Card/Pay

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.

Register

Card on file registration example:

string baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
int CTY = 1;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}", AID, AMT, CUR, REF);
string SIG = GetSignature(secretKey, sigData);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&SIG={5}&CTY={6}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), SIG, CTY);

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$CTY = 1;
        
$secretKey = "123456";
$sigData = sprintf("%d%s%s%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF);
$SIG = GetSignature($secretKey, $sigData);

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&SIG=%s&CTY=%d", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, urlencode($REF), $SIG, $CTY);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";
int CTY = 1;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d%.2f%s%s", AID, AMT, CUR, REF);
    String SIG = GetSignature(secretKey, sigData);

    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&SIG=%s&CTY=%d", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), SIG, CTY);
    response.sendRedirect(url);
}catch(Exception ex){}

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:

Name Description Format Required
CTY Card transaction type
For card on file registration must be set to 1
Numeric(1) Yes

CardID parameter will be present in notification after client completes a purchase. Value of this parameter needs to be used to make subsequent card on file purchases.

Card on file purchase

Card on file purchase example:

string baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
int CTY = 2;
string CardID = "8a8394855cfd3692015d0dc3f793355b";
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}", AID, AMT, CUR, REF);
string sig2Data = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}{4}{5}", AID, AMT, CUR, REF, CTY, CardID);
string SIG = GetSignature(secretKey, sigData);
string SIG2 = GetSignature(secretKey, sig2Data);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&SIG={5}&CTY={6}&CardID={7}&SIG2={8}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), SIG, CTY, CardID, SIG2);

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$CTY = 2;
$CardID = "8a8394855cfd3692015d0dc3f793355b";
        
$secretKey = "123456";
$sigData = sprintf("%d%s%s%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF);
$sig2Data = sprintf("%d%s%s%s%d%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF, $CTY, $CardID);
$SIG = GetSignature($secretKey, $sigData);
$SIG2 = GetSignature($secretKey, $sig2Data);

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&SIG=%s&CTY=%d&CardID=%s&SIG2=%s", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, urlencode($REF), $SIG, $CTY, $CardID, $SIG2);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";
int CTY = 2;
String CardID = "8a8394855cfd3692015d0dc3f793355b";

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d%.2f%s%s", AID, AMT, CUR, REF);
    String sig2Data = String.format(Locale.ROOT, "%d%.2f%s%s%d%s", AID, AMT, CUR, REF, CTY, CardID);
    String SIG = GetSignature(secretKey, sigData);
    String SIG2 = GetSignature(secretKey, sig2Data);

    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&SIG=%s&CTY=%d&CardID=%s&SIG2=%s", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), SIG, CTY, CardID, SIG2);
    response.sendRedirect(url);
}catch(Exception ex){}

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

Name Description Format Required
CTY Card transaction type
For card on file purchase must be set to 2
Numeric(1) Yes
CardID Card ID from notification Varchar(64) No
SIG2 Data signature calculated from concatenated values of AID, AMT, CUR, REF, CTY and CardID parameters Char(64) Yes

Card on file preauthorization

Card on file preauthorization example:

string baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
int CTY = 9;
string CardID = "8a8394855cfd3692015d0dc3f793355b";
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}", AID, AMT, CUR, REF);
string sig2Data = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}{4}{5}", AID, AMT, CUR, REF, CTY, CardID);
string SIG = GetSignature(secretKey, sigData);
string SIG2 = GetSignature(secretKey, sig2Data);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&SIG={5}&CTY={6}&CardID={7}&SIG2={8}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), SIG, CTY, CardID, SIG2);

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$CTY = 9;
$CardID = "8a8394855cfd3692015d0dc3f793355b";
        
$secretKey = "123456";
$sigData = sprintf("%d%s%s%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF);
$sig2Data = sprintf("%d%s%s%s%d%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF, $CTY, $CardID);
$SIG = GetSignature($secretKey, $sigData);
$SIG2 = GetSignature($secretKey, $sig2Data);

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&SIG=%s&CTY=%d&CardID=%s&SIG2=%s", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, urlencode($REF), $SIG, $CTY, $CardID, $SIG2);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";
int CTY = 9;
String CardID = "8a8394855cfd3692015d0dc3f793355b";

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d%.2f%s%s", AID, AMT, CUR, REF);
    String sig2Data = String.format(Locale.ROOT, "%d%.2f%s%s%d%s", AID, AMT, CUR, REF, CTY, CardID);
    String SIG = GetSignature(secretKey, sigData);
    String SIG2 = GetSignature(secretKey, sig2Data);

    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&SIG=%s&CTY=%d&CardID=%s&SIG2=%s", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), SIG, CTY, CardID, SIG2);
    response.sendRedirect(url);
}catch(Exception ex){}

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

Name Description Format Required
CTY Card transaction type
For card on file preauthorization must be set to 9
Numeric(1) Yes
CardID Card ID from notification Varchar(64) No
SIG2 Data signature calculated from concatenated values of AID, AMT, CUR, REF, CTY and CardID parameters Char(64) Yes

Recurring

API endpoints:
Test - https://playground.trustpay.eu/mapi5/Card/Pay
Live - https://ib.trustpay.eu/mapi5/Card/Pay

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

Merchants responsibilities:

Initial payment

Initial payment example:

string baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
int CTY = 3;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}", AID, AMT, CUR, REF);
string SIG = GetSignature(secretKey, sigData);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&SIG={5}&CTY={6}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), SIG, CTY);

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$CTY = 3;
        
$secretKey = "123456";
$sigData = sprintf("%d%s%s%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF);
$SIG = GetSignature($secretKey, $sigData);

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&SIG=%s&CTY=%d", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, urlencode($REF), $SIG, $CTY);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";
int CTY = 3;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d%.2f%s%s", AID, AMT, CUR, REF);
    String SIG = GetSignature(secretKey, sigData);

    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&SIG=%s&CTY=%d", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), SIG, CTY);
    response.sendRedirect(url);
}catch(Exception ex){}

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

Name Description Format Required
CTY Card transaction type
For initial recurring payment must be set to 3
Numeric(1) Yes

Subsequent payment

Subsequent payment example:

string baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
int CTY = 4;
int TID = 555;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}", AID, AMT, CUR, REF);
string sig2Data = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}{4}{5}", AID, AMT, CUR, REF, CTY, TID);
string SIG = GetSignature(secretKey, sigData);
string SIG2 = GetSignature(secretKey, sig2Data);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&SIG={5}&CTY={6}&TID={7}&SIG2={8}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), SIG, CTY, TID, SIG2);

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$CTY = 4;
$TID = 555;
        
$secretKey = "123456";
$sigData = sprintf("%d%s%s%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF);
$sig2Data = sprintf("%d%s%s%s%d%d", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF, $CTY, $TID);
$SIG = GetSignature($secretKey, $sigData);
$SIG2 = GetSignature($secretKey, $sig2Data);

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&SIG=%s&CTY=%d&TID=%s&SIG2=%s", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, urlencode($REF), $SIG, $CTY, $TID, $SIG2);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";
int CTY = 4;
int TID = 555;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d%.2f%s%s", AID, AMT, CUR, REF);
    String sig2Data = String.format(Locale.ROOT, "%d%.2f%s%s%d%d", AID, AMT, CUR, REF, CTY, TID);
    String SIG = GetSignature(secretKey, sigData);
    String SIG2 = GetSignature(secretKey, sig2Data);

    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&SIG=%s&CTY=%d&TID=%s&SIG2=%s", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), SIG, CTY, TID, SIG2);
    response.sendRedirect(url);
}catch(Exception ex){}

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.

Parameters are the same as for standard Purchase, but these additional parameters have to be added to the request:

Name Description Format Required
CTY Card transaction type
For subsequent recurring payments must be set to 4
Numeric(1) Yes
TID Payment ID from notification Numeric(10) Yes
SIG2 Data signature calculated from concatenated values of AID, AMT, CUR, REF, CTY and TID parameters Char(64) Yes

Body of HTTP response will contain a result code, e.g.: result=3&AcqResId=000.000.000

Preauthorization

API endpoints:
Test - https://playground.trustpay.eu/mapi5/Card/Pay
Live - https://ib.trustpay.eu/mapi5/Card/Pay

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.

Setup

Preauthorization setup example:

string baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
int CTY = 5;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}", AID, AMT, CUR, REF);
string SIG = GetSignature(secretKey, sigData);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&SIG={5}&CTY={6}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), SIG, CTY);

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$CTY = 5;
        
$secretKey = "123456";
$sigData = sprintf("%d%s%s%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF);
$SIG = GetSignature($secretKey, $sigData);

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&SIG=%s&CTY=%d", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, urlencode($REF), $SIG, $CTY);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";
int CTY = 5;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d%.2f%s%s", AID, AMT, CUR, REF);
    String SIG = GetSignature(secretKey, sigData);

    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&SIG=%s&CTY=%d", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), SIG, CTY);
    response.sendRedirect(url);
}catch(Exception ex){}

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

Name Description Format Required
CTY Card transaction type
For preauthorization of standard purchase must be set to 5
Numeric(1) Yes

Capture

Capture example:

string baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
int CTY = 6;
int TID = 555;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}", AID, AMT, CUR, REF);
string sig2Data = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}{4}{5}", AID, AMT, CUR, REF, CTY, TID);
string SIG = GetSignature(secretKey, sigData);
string SIG2 = GetSignature(secretKey, sig2Data);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&SIG={5}&CTY={6}&TID={7}&SIG2={8}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), SIG, CTY, TID, SIG2);

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$CTY = 6;
$TID = 555;
        
$secretKey = "123456";
$sigData = sprintf("%d%s%s%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF);
$sig2Data = sprintf("%d%s%s%s%d%d", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF, $CTY, $TID);
$SIG = GetSignature($secretKey, $sigData);
$SIG2 = GetSignature($secretKey, $sig2Data);

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&SIG=%s&CTY=%d&TID=%s&SIG2=%s", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, urlencode($REF), $SIG, $CTY, $TID, $SIG2);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";
int CTY = 6;
int TID = 555;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d%.2f%s%s", AID, AMT, CUR, REF);
    String sig2Data = String.format(Locale.ROOT, "%d%.2f%s%s%d%d", AID, AMT, CUR, REF, CTY, TID);
    String SIG = GetSignature(secretKey, sigData);
    String SIG2 = GetSignature(secretKey, sig2Data);

    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&SIG=%s&CTY=%d&TID=%s&SIG2=%s", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), SIG, CTY, TID, SIG2);
    response.sendRedirect(url);
}catch(Exception ex){}

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.

Parameters are the same as for standard Purchase, but these additional parameters have to be added to the request:

Name Description Format Required
CTY Card transaction type
For capture must be set to 6
Numeric(1) Yes
TID Payment ID from notification Numeric(10) Yes
SIG2 Data signature calculated from concatenated values of AID, AMT, CUR, REF, CTY and TID parameters Char(64) Yes

Body of HTTP response will contain a result code, e.g.: result=3&AcqResId=000.000.000

Refund

API endpoints:
Test - https://playground.trustpay.eu/mapi5/Card/Pay
Live - https://ib.trustpay.eu/mapi5/Card/Pay
Capture example:

string baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
decimal AMT = 1.5M;
string CUR = "EUR";
string REF = "123456789";
int CTY = 8;
int TID = 555;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}", AID, AMT, CUR, REF);
string sig2Data = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1:0.00}{2}{3}{4}{5}", AID, AMT, CUR, REF, CTY, TID);
string SIG = GetSignature(secretKey, sigData);
string SIG2 = GetSignature(secretKey, sig2Data);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&AMT={2:0.00}&CUR={3}&REF={4}&SIG={5}&CTY={6}&TID={7}&SIG2={8}",
    baseUrl, AID, AMT, CUR, HttpUtility.UrlEncode(REF), SIG, CTY, TID, SIG2);

Response.Redirect(url);

$baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
$AID = 2107111111;
$AMT = 1.5;
$CUR = "EUR";
$REF = "123456789";
$CTY = 8;
$TID = 555;
        
$secretKey = "123456";
$sigData = sprintf("%d%s%s%s", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF);
$sig2Data = sprintf("%d%s%s%s%d%d", $AID, number_format($AMT, 2, '.', ''), $CUR, $REF, $CTY, $TID);
$SIG = GetSignature($secretKey, $sigData);
$SIG2 = GetSignature($secretKey, $sig2Data);

$url = sprintf(
    "%s?AID=%d&AMT=%s&CUR=%s&REF=%s&SIG=%s&CTY=%d&TID=%s&SIG2=%s", 
    $baseUrl, $AID, number_format($AMT, 2, '.', ''), $CUR, urlencode($REF), $SIG, $CTY, $TID, $SIG2);
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://playground.trustpay.eu/mapi5/Card/Pay";
long AID = 2107111111;
double AMT = 1.5d;
String  CUR = "EUR";
String  REF = "123456789";
int CTY = 8;
int TID = 555;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d%.2f%s%s", AID, AMT, CUR, REF);
    String sig2Data = String.format(Locale.ROOT, "%d%.2f%s%s%d%d", AID, AMT, CUR, REF, CTY, TID);
    String SIG = GetSignature(secretKey, sigData);
    String SIG2 = GetSignature(secretKey, sig2Data);

    String url = String.format(
        Locale.ROOT,"%s?AID=%d&AMT=%.2f&CUR=%s&REF=%s&SIG=%s&CTY=%d&TID=%s&SIG2=%s", 
        baseUrl, AID, AMT, CUR, URLEncoder.encode(REF, "UTF-8"), SIG, CTY, TID, SIG2);
    response.sendRedirect(url);
}catch(Exception ex){}

This function allows refunding or cancelling a transaction that was authorized or preauthorized.

Parameters are the same as for standard Purchase, but these additional parameters have to be added to the request:

Name Description Format Required
CTY Card transaction type
For refund must be set to 8
Numeric(1) Yes
TID Payment ID from notification Numeric(10) Yes
SIG2 Data signature calculated from concatenated values of AID, AMT, CUR, REF, CTY and TID parameters Char(64) Yes

Body of HTTP response will contain a result code, e.g.: result=0&AcqResId=000.000.000

Payment result

After paying, the customer is redirected to one of the return URLs provided by the Merchant:

The following parameters are always being sent with the redirects:

Payment result example:
https://example.handler.com/result.php?&REF=1234567890&RES=0&ARC=000.100.110&TID=4337417657
Name Description Format
REF Reference (merchant’s payment identification) Varchar(500)
RES Result code Numeric(4)
AcqResId Card acquirer result code Varchar(128)
TID Payment ID (sent when available, can be used for inquiries regarding failed payments) Numeric(10)

Payment notification

Payment URL notification example:
https://example.handler.com/result.php?AID=2107111111&TYP=CRDT&AMT=6.00&CUR=EUR&REF=1234567890&RES=0&TID=177561&OID=19553&TSS=Y&SIG=C4FFA5F7B57A0F5E6DD105197C8B7D7B9214509F3618CDC0F527C9B4E57F0334&CardID&CardMask=0162&CardExp=1020&AuthNumber=198159&CardRecTxSec&AcqResId=000.000.000&SIGN2=4AB3A1B90D45F7BE4D31CABC83698A2DE63DD74D7078169CD2C4249DEC9125B2
Payment E-mail notification example:
MerchantAccountID: 2107111111
Type: CRDT
Amount: 6.00
Currency: EUR
Reference: 1234567890
ResultCode: 3
TransactionID: 177561
OrderID: 0
TransactionSigned: Y
SIGN: 51541600BDED4230304D5E20DB96730181E7C34886DF00D82650C6F0C28424A2
CardID:
CardMask: 0162
CardExp: 1020
AuthNumber: 198159
CardRecTxSec:
AcqResId: 000.000.000
SIGN2: 4AB3A1B90D45F7BE4D31CABC83698A2DE63DD74D7078169CD2C4249DEC9125B2

Please first read how the instant bank transfer notifications work, because card notifications are very similar to the instant bank transfer notifications. Only the differences are described in this section.

Card notifications contain all the parameters of instant bank transfer notifications with the following parameters specific to card payments:

Name Description Format
CardID Card ID. This can be used to make card-on-file payments Varchar(64)
CardMask Masked card number or last 4 digits of the card Varchar(19)
CardExp Card expiration in MMYY format Number(4)
AuthNumber Authorization number Varchar(7)
CardRecTxSec Blank, reserved for future versions Char(1)
AcqResId Card acquirer result code Varchar(128)
SIG2 Data signature calculated from concatenated values of AID, TYP, AMT, CUR, REF, RES, TID, OID, TSS, CardID, CardMask, CardExp, AuthNumber, CardRecTxSec and AcqResId parameters Char(64)

Get transaction origin

API endpoints:
Test - https://ib.test.trustpay.eu/mapi/GetTransactionOrigin.aspx
Live - https://ib.trustpay.eu/mapi/GetTransactionOrigin.aspx

Service GetTransactionOrigin returns evidences of transaction country of origin by TransferID. Service is available only for incoming transactions.

Request

Request example:

string baseUrl = "https://ib.test.trustpay.eu/mapi/GetTransactionOrigin.aspx";
long AID = 2107111111;
long TID = 555;

string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}{1}", AID, TID);
string SIG = GetSignature(secretKey, sigData);
              
string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AID={1}&TID={2}&SIG={3}",
    baseUrl, AID, TID, SIG);
              
Response.Redirect(url);

$baseUrl = "https://ib.test.trustpay.eu/mapi/GetTransactionOrigin.aspx";
$AID = 2107111111;
$TID = 555;
            
$secretKey = "123456";
$sigData = sprintf("%d%d", $AID, $TID);
$SIG = GetSignature($secretKey, $sigData);
            
$url = sprintf(
    "%s?AID=%d&TID=%d&SIG=%s", 
    $baseUrl, $AID, $TID, $SIG));
header("Location: $url");
exit();

import java.util.Locale;
import java.net.URLEncoder;

String  baseUrl = "https://ib.test.trustpay.eu/mapi/GetTransactionOrigin.aspx";
long AID = 2107111111;
long TID = 555;

String secretKey = "123456";
String sigData = String.format(Locale.ROOT, "%d%d", AID, TID);
String SIG = GetSignature(secretKey, sigData);

try
{
    String url = String.format(
        Locale.ROOT,"%s?AID=%d&TID=%d&SIG=%s", 
        baseUrl, AID, TID, SIG);
    
    response.sendRedirect(url);
}catch(Exception ex){}

curl https://ib.test.trustpay.eu/mapi/GetTransactionOrigin.aspx \
-d "AID=2107111111" \
-d "TID=555" \
-d "SIG=%PRECOMPUTED_SIGNATURE%"

<form method="GET" action="https://ib.test.trustpay.eu/mapi/GetTransactionOrigin.aspx">
    <input type="hidden" name="AID" value="2107111111" />
    <input type="hidden" name="TID" value="555" />
    <input type="hidden" name="SIG" value="%PRECOMPUTED_SIGNATURE%" />
    <input type="submit" value="get" />
</form>

Parameters for request are sent via method GET or POST.

Name Description Format Required
AID Merchant account ID (ID of account assigned by Trust Pay) Numeric(10) Yes
TID Trust Pay Payment ID Numeric(10) Yes
SIG Data signature calculated from concatenated values of AID and TID parameters Char(64) Yes

Response

Response example:
        
<GetTransactionOriginResponse>
	<TransferID>171215</TransferID>
	<ResultCode>0</ResultCode>
	<Items>
		<ItemOfEvidence>
			<Name>CustomerIP</Name>
			<Evidences>
				<Evidence>
					<Name>CustomerIPCountry</Name>
					<Priority>1</Priority>
					<Country>POL</Country>
				</Evidence>
			</Evidences>
		</ItemOfEvidence>
		<ItemOfEvidence>
			<Name>AccountCountries</Name>
			<Evidences>
				<Evidence>
					<Name>PayerAccountCountry</Name>
					<Priority>1</Priority>
					<Country>CZE</Country>
				</Evidence>
				<Evidence>
					<Name>PayeeAccountCountry</Name>
					<Priority>10</Priority>
					<Country>SVK</Country>
				</Evidence>
			</Evidences>
		</ItemOfEvidence>
	</Items>
	<Signature>
		DF174E635DABBFF7897A82822521DD739AE8CC2F83D65F6448DD2FF991481EA3
	</Signature>
</GetTransactionOriginResponse>
        
    

Response is XML document with structure specified below. It contains following evidences about transaction country of payment origin:

Name Description Format
TransferID ID of transaction, same as TID from request. Numeric(10)
ResultCode Result code Numeric(4)
Items Contains collection of ItemOfEvidence Response/Items
Signature Computed from whole xml without Signature tag with redundant white-spaces removed. Provided only with ResultCode 0 and 1011.

Response/Items

Name Description Format
ItemOfEvidence Item/ItemOfEvidence

Item/ItemOfEvidence

Name Description Format
Name Following values available: CustomerIP, AccountCountries Varchar
Evidences Contains collection of Evidence ItemOfEvidence/Evidences

ItemOfEvidence/Evidences

Name Description Format
Evidence Evidences/Evidence

Evidences/Evidence

Name Description Format
Name Following values available: CustomerIPCountry, PayerAccountCountry, PayeeAccountCountry Varchar
Priority Priority of evidence. The lower value - the higher priority Numeric(10)
Country Format defined in ISO3166-1Alpha-3 Char(3)

OAuth

Getting access token

Direct debit API endpoints:
Live - https://ib.trustpay.eu/mapi5service/api/oauth2/token
API banking endpoints:
Live - https://api.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://ib.trustpay.eu/mapi5service/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();
      UTF8Encoding encoding = new UTF8Encoding();
      var request = encoding.GetBytes("grant_type=client_credentials");
      var responseData = client.UploadData(url, request);
      var response = serializer.Deserialize<dynamic>(encoding.GetString(responseData));
      return response["access_token"];
   }
}

$url = 'https://ib.trustpay.eu/mapi5service/api/oauth2/token';
$data = array('grant_type' => 'client_credentials');

$username = "abcdef";
$password = "123abc";
$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(){ try { URL obj = new URL("https://ib.trustpay.eu/mapi5service/api/oauth2/token"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); String username = "abcdef"; String password = "123abc"; String encoded = "Basic " + Base64.getEncoder().withoutPadding().encodeToString((username + ":" + password).getBytes()); con.setRequestProperty("Authorization", encoded); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes("grant_type=client_credentials"); wr.flush(); wr.close(); 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()); } }
Name Description Format Required
username Merchants username Varchar(256) Yes
password Merchants password Varchar(256) Yes

Returned value will be your authorization token.

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

SEPA Direct Debits

Prepare mandate

API endpoints:
Live - https://ib.trustpay.eu/mapi5/api/DirectDebit/PrepareMandate

Prepares the mandate and redirects the caller to site where the client needs to fill some aditional information. After this information is submited, 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://ib.trustpay.eu/mapi5/api/DirectDebit/PrepareMandate";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         PayNow = true,
         SequenceType = "RCUR",
         RequestedDueDate = "2017-07-28",
         Amount = 1.50,
         Currency = "EUR",
         Reference = "Order #12345",
         Merchant = new
         {
            Account = "1234567890"
         },
         ReducedPeriod = 4,
         EndToEnd = "e2e",
         RemittanceInformation = "Pyment description",
         ReturnUrls = new
         {
            MandateNotificationUrl = "Mandate@Notification.url",
            Notification = "Normal@Notification.url"
         }
      };

      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["PreparedMandateUrl"];
   }
}

function PrepareMandate($token)
{
   $url = 'https://ib.trustpay.eu/mapi5/api/DirectDebit/PrepareMandate';
   $data = array(
      'PayNow' => 'true',
      'SequenceType' => 'RCUR',
      'Merchant' => array(
         'Account' => '1234567890',
      ),
      'RequestedDueDate' => '2017-07-28',
      'Amount' => '1.50',
      'Currency' => 'EUR',
      'Reference' => '123456',
        
      'ReducedPeriod' => '',
      'EndToEnd' => 'test123',
      'RemittanceInformation' => 'test123',
      'ReturnUrls' => array(
         'MandateNotificationUrl' => 'mandate.notif',
         'Notification' => 'payment.notif',
      ),
   );  
   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization:bearer $Token",
            'Content-type: text/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://ib.trustpay.eu/mapi5/api/DirectDebit/PrepareMandate"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public boolean PayNow = true; public String SequenceType = "RCUR"; public String RequestedDueDate = "2017-03-27"; public double Amount = 1.50; public String Currency = "EUR"; public String Reference = "merch ref. no. #555"; public Object Merchant = new Object(){ public long Account = 2107058607; }; public Byte ReducedPeriod = null; public String EndToEnd = "test"; public String RemittanceInfo = "test"; public Object ReturnURLs = new Object(){ public String MandateNotificationUrl = "mandate.notif"; public String NotificationUrl = "payment.notif"; }; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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
SequenceType Type of mandate:
RCUR - Recurrent payment
OOFF - One-off payment
Char(4)
en-US format
Yes
Merchant Identification of merchant Request/Merchant Yes
RequestedDueDate Date to which the transaction should be carried out Varchar(10) For paynow
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
Reference Reference (merchant’s payment identification) Varchar(35) For paynow
ReducedPeriod Reduces direct debit pre-notification period by up to 13 days. Byte No
EndToEnd Reference between merchant and client Varchar(35) No
RemittanceInfo Remittance advice Varchar(35) No
ReturnUrls Return URLs Request/ReturnUrls No

Request/Merchant

Name Description Format Required
Account Merchant account ID (ID of account assigned by Trust Pay) Numeric(10) Yes

Request/ReturnUrls

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

Response

Response example:
{
    "PrepareMandateUrl":"https://ib.trustpay.eu/mapi5/api/directdebit/mandate/ba7db67e-7h73-4bt0-880f-7ec0f07b1c4e"
}
Name Description Format
PrepareMandateUrl Url to site where Debtors credentials can be submited (sent only when call succeeded) Varchar(256)
ErrorCode Id of error that ocurred durring service call (sent only when call failed) Numeric(10)
ErrorMessage Description of error that ocurred durring service call (sent only when call failed) Varchar(235)

Cancel mandate

API endpoints:
Live - https://ib.trustpay.eu/mapi5/api/DirectDebit/CancelMandate

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://ib.trustpay.eu/mapi5/api/DirectDebit/CancelMandate";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/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://ib.trustpay.eu/mapi5/api/DirectDebit/CancelMandate';
   $data = array('Umr' => '12345678901234567890'); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization:bearer $Token",
            'Content-type: text/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://ib.trustpay.eu/mapi5/api/DirectDebit/CancelMandate"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public String Umr = "12345678901234567890"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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:
{}
Name Description Format
ResultCode Id of the response returned by service (sent only when call succeeded) Varchar(256)
ResultMessage Description of the outcome of your call (sent only when call succeeded) Varchar(256)

Capture payment

API endpoints:
Live - https://ib.trustpay.eu/mapi5/api/DirectDebit/CapturePayment

Creates new direct debit accounted to an already existing mandate based on it's 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://ib.trustpay.eu/mapi5/api/DirectDebit/CapturePayment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         Umr = "12345678901234567890",
         RequestedDueDate = "2017-07-28",
         Amount = 1.50,
         Currency = "EUR",
         Reference = "Order #12345",
         Merchant = new
         {
            Account = "1234567890"
         },
         ReducedPeriod = 4,
         EndToEnd = "e2e",
         RemittanceInformation = "Pyment description",
         ReturnUrls = new
         {
            Notification = "Normal@Notification.url"
         }
      };

      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["DirectDebitId"];
   }
}

function CapturePayment($token)
{
   $url = 'https://ib.trustpay.eu/mapi5/api/DirectDebit/CapturePayment';
   $data = array(
      'Umr' => '12345678901234567890',
      'RequestedDueDate' => '2017-07-28',
      'Amount' => '1.50',
      'Currency' => 'EUR',
      'Reference' => '123456',
      'Merchant' => array(
         'Account' => '1234567890',
      ),
        
      'EndToEnd' => 'test123',
      'RemittanceInformation' => 'test123',
      'ReturnUrls' => array(
         'Notification' => 'payment.notif',
      ),
      );  

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

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://ib.trustpay.eu/mapi5/api/DirectDebit/CapturePayment"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public String Umr = "12345678901234567890"; public String RequestedDueDate = "2017-07-28"; public Double Amount = 1.50; public String Currency = "EUR"; public String Reference = "Hello"; public Object Merchant = new Object() { public long Account = 1234567890; }; public String EndToEnd = "test"; public String RemittanceInfo = "test"; public Object ReturnURLs = new Object() { public String NotificationUrl = "payment.notif"; }; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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("DirectDebitId")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Umr Unique Mandate Reference of mandate to which should this payment be assigned Char(20) Yes
RequestedDueDate Date to which the transaction should be carried out Varchar(10) Yes
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes
Reference Reference (merchant’s payment identification) Varchar(35) Yes
Merchant Identification of merchant Request/Merchant Yes
EndToEnd Reference between merchant and client Varchar(35) No
RemittanceInfo Remittance advice Varchar(35) No
ReturnUrls Return URLs Request/ReturnUrls No

Request/Merchant

Name Description Format Required
Account Merchant account ID (ID of account assigned by Trust Pay) Numeric(10) Yes

Request/ReturnUrls

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

Response

Response example:
{
    "DirectDebitId":1
}
Name Description Format
DirectDebitId Id of direct debit that was just created (sent only when call succeeded) Numeric(10)
ErrorCode Id of error that ocurred durring service call (sent only when call failed) Numeric(10)
ErrorMessage Description of error that ocurred durring service call (sent only when call failed) Varchar(235)

Cancel direct debit

API endpoints:
Live - https://ib.trustpay.eu/mapi5/api/DirectDebit/CancelDirectDebit

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://ib.trustpay.eu/mapi5/api/DirectDebit/CancelDirectDebit";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         Umr = "12345678901234567890",
         DirectDebitId = 1
      };

      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["ErrorMessage"];
   }
}

function CancelDirectDebit($token)
{
   $url = 'https://ib.trustpay.eu/mapi5/api/DirectDebit/CancelDirectDebit';
   $data = array(
      'Umr' => '12345678901234567890',
      'DirectDebitId' => '1',
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization:bearer $Token",
            'Content-type: text/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)['ErrorMessage']);
}

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://ib.trustpay.eu/mapi5/api/DirectDebit/CancelDirectDebit"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public String Umr = "12345678901234567890"; public String DirectDebitId = "1"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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("ErrorMessage"); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Umr Unique Mandate Reference of mandate to which the direct debit is assigned Char(20) Yes
DirectDebitId Identification number of direct debit that should be canceled Char(20) Yes

Response

Response example:
{}
Name Description Format
ErrorCode Id of error that ocurred durring service call (sent only when call failed) Numeric(10)
ErrorMessage Description of error that ocurred durring service call (sent only when call failed) Varchar(235)

API Banking

Get account list

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/GetAccountList

Gets list of accounts of currently authenticated user.

Request

Name Description Format Required
Token Authorization token Varchar(235) Yes
Get account list example:

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

public dynamic GetAccountList(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/GetAccountList";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      
      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var responseData = client.UploadData(url, new byte[0]);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response;
   }
}

function GetAccountList($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/GetAccountList';
   $data = array();  
   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization:bearer $Token",
            'Content-type: text/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response;
}

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 Map<String,String> GetAccountList(String token){ try{ URL obj = new URL("https://api.trustpay.eu/ApiBanking/GetAccountList"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object(); ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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; } catch(Exception ex){ throw new RuntimeException(ex.getMessage()); } }

Response

Response example:
{
    "AccountList": [
        {
            "AccountId": 2107347927,
            "IBAN": "SK1099520000002107347927",
            "AccountName": "John Doe EUR",
            "AccountOwnerName": "John Doe",
            "AccountType": "Merchant",
            "CanCreateInternalOrder": false,
            "CanCreateBankWireOrder": true,
            "CurrencyCode": "EUR",
            "AccountingBalance": "15684.05",    
            "DisposableBalance": "15654.05",
            "FeeBalance": "0.00",
            "MinimalBalance": "30.00"
        },
        {
            "AccountId": 2107138076,
            "IBAN": "",
            "AccountName": "John Doe USD",
            "AccountOwnerName": "John Doe",
            "AccountType": "Individual",
            "CanCreateInternalOrder": false,
            "CanCreateBankWireOrder": true,
            "CurrencyCode": "USD",
            "AccountingBalance": "121696.89",
            "DisposableBalance": "121410.89",
            "FeeBalance": "256.00",
            "MinimalBalance": "30.00"
        }
    ]
}
Name Description Format
AccountList List of accounts of currently authenticated user Response/AccountDetails

Response/AccountDetails

Name Description Format
AccountId ID of account assigned by Trust Pay Numeric(10)
IBAN IBAN (empty if account is not ibanized) Varchar(34)
AccountName Account name Varchar(35)
AccountOwnerName Account owner name Varchar(70)
AccountType Account type AccountDetails/AccountType
CanCreateInternalOrder Indicates whether it is possible for current disponent to create internal orders on this account Boolean
CanCreateBankWireOrder Indicates whether it is possible for current disponent to create bank wire orders on this account Boolean
CurrencyCode Currency of the account Char(3)
AccountingBalance Accounting balance Numeric(13,2) en-US format
DisposableBalance Disposable balance (empty if unlimited) Numeric(13,2) en-US format
FeeBalance Fee balance Numeric(13,2) en-US format
MinimalBalance Minimal balance Numeric(13,2) en-US format

AccountDetails/AccountType

Value Description
Individual Individual account
Merchant Merchant account

Get account details

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/GetAccountDetails

Gets details of account identified by its ID.

Request

Get account details example:

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

public dynamic GetAccountDetails(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/GetAccountDetails";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         AccountId = "2107000000"
      };

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

function GetAccountDetails($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/GetAccountDetails';
   $data = array('AccountId' => '2107000000'); 

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

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 Map<String,String> GetAccountDetails(String token){ try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/GetAccountDetails"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public long AccountId = "2107000000"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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; } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
AccountId Desired account ID (ID of account assigned by Trust Pay) Numeric(10) Yes

Response

Response example:
{
    "AccountDetails": {
        "AccountId": 2107347927,
        "IBAN": "SK1099520000002107347927",
        "AccountName": "John Doe EUR",
        "AccountOwnerName": "John Doe",
        "AccountType": "Merchant",
        "CanCreateInternalOrder": false,
        "CanCreateBankWireOrder": true,
        "CurrencyCode": "EUR",
        "AccountingBalance": "15684.05",
        "DisposableBalance": "15654.05",
        "FeeBalance": "0.00",
        "MinimalBalance": "30.00"
    }
}
Name Description Format
AccountDetails Details of requested account Response/AccountDetails

Get transaction history

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/GetTransactionHistory

Gets transaction history page for selected account within given date range with option to filter data and set amount of returned items.

Request

Get transaction history example:

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

public dynamic GetTransactionHistory(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/GetTransactionHistory";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
          Filter = new
          {
              AccountId = 2107000000,
              DateFrom = "2017-08-01",
              DateTo = "2017-09-01",
          },
          Paging = new
          {
              Page = 0,
              PageSize = 10
          }
      };

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

function GetTransactionHistory($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/GetTransactionHistory';
   $data = array(
            'Filter' => array(
                'AccountId' = 2107000000,
                'DateFrom' = '2017-08-01',
                'DateTo' = '2017-09-01'
            ),
            'Paging' => array(
                'Page' = 0,
                'PageSize' = 10
            )
        ); 

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

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 Map<String,String> GetTransactionHistory(String token){ try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/GetTransactionHistory"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public Object Filter = new Object() { public long AccountId = 2107000000; public String DateFrom = "2017-08-01"; public String DateTo = "2017-09-01"; }; public Object Paging = new Object() { public int Page = 0; public int PageSize = 10; } }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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; } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Filter Transaction history filter Request/Filter Yes
Paging Paging information Request/Paging Yes

Request/Filter

Name Description Format Required
AccountId Account ID (ID of account assigned by Trust Pay) Numeric(10) Yes
DateFrom Date from Varchar(10) Yes
DateTo Date to Varchar(10) Yes
Type Statement type Request/Filter/Type No
Direction Transaction direction Request/Filter/Direction No
CounterAccount Counter account Varchar(34) No
AmountFrom Amount from Numeric(13,2) en-US format No
AmountTo Amount to Numeric(13,2) en-US format No
ClientReference Client reference Varchar(256) No
TransactionId Trust Pay Transaction ID Numeric(10) No
PaymentId Trust Pay Payment ID Numeric(10) No
OrderId Trust Pay Order ID Numeric(10) No

Request/Filter/Type

Value Description
Any Any transaction (default value)
Internal Internal TrustPay transactions
External Bank wire transactions

Request/Filter/Direction

Value Description
Any Any transaction (default value)
Credit Credit transactions
Debit Debit transactions

Request/Paging or Response/Paging

Name Description Format Required
Page Number of page to show (starts from zero) Numeric(10) Yes
PageSize Number of results on the page Numeric(5) Yes

Response

Response example:
{
    "Transactions": [
        {
            "TransactionId": 652804,
            "PaymentId": 325843,
            "OrderId": 125897,
            "Date": "2017-08-17",
            "CounterAccount": "SK3699520000002107842741",                                    
            "CounterAccountName": "Account name",
            "Description": "description",
            "PayerReference": "e2e",
            "ClientReference": "1234567890",
            "Amount": 123.45,
            "Currency": "EUR",
            "RefundedAmount": 0.00
        },
        {
            "TransactionId": 652773,
            "PaymentId": 325831,
            "OrderId": 110876,
            "Date": "2017-08-14",
            "CounterAccount": "0002725006",                                    
            "CounterAccountName": "Account name",
            "Description": "interesting description",
            "PayerReference": "TP002517042",
            "ClientReference": null,
            "Amount": -13.37,
            "Currency": "EUR",
            "RefundedAmount": 0.00
        }
    ],
    "TotalCount": 306,
    "Paging": {
        "Page": 50,
        "PageSize": 2
    }
}
Name Description Format
Transactions Details of selected transactions Response/TransactionDetails
TotalCount Count of all transactions on the account Numeric(10)
Paging Paging info Response/Paging

Response/TransactionDetails

Name Description Format
TransactionId Transaction ID Trust Pay Transaction ID (unique ID used for any enquiries)
PaymentId Payment ID Trust Pay Payment ID
OrderId Order ID Trust Pay Order ID
Date Transaction date Varchar(10)
CounterAccount Counter account Varchar(34)
CounterAccountName Counter account name Varchar(70)
Description Transaction description Varchar(140)
PayerReference Payer's reference Varchar(140)
ClientReference Client's reference Varchar(500)
Amount Transaction amount Numeric(13,2) en-US format
Currency Transaction currency Char(3)
RefundedAmount Refunded amount Numeric(13,2) en-US format

Get transaction details

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/GetTransactionDetails

Gets details of transaction identified by its ID.

Request

Get transaction details example:

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

public dynamic GetTransactionDetails(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/GetTransactionDetails";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         TransactionId = "123456789"
      };

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

function GetTransactionDetails($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/GetTransactionDetails';
   $data = array('TransactionId' => '123456789'); 

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

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 Map<String,String> GetTransactionDetails(String token){ try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/GetTransactionDetails"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public long TransactionId = "123456789"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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; } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
TransactionId Trust Pay Transaction ID (unique ID used for any enquiries) Numeric(10) No1
PaymentId Trust Pay Paymnet ID Numeric(10) No1
OrderId Trust Pay Order ID Numeric(10) No1

1 At least one of the fields must be provided. If multiple fields are provided status 400 (Bad Request) will be returned.

Response

Response example:
{
    "TransactionDetails": {
        "TransactionId": 654731,
        "PaymentId": 326219,
        "OrderId": 125897,
        "Date": "2017-08-28",
        "CounterAccount": "SK4699520000002107553501",
        "CounterAccountName": "Account name",
        "Description": "description",
        "PayerReference": "NOTPROVIDED",
        "ClientReference": null,
        "Amount": 4328717.29,
        "Currency": "EUR",
        "RefundedAmount": 0.00
    },
    "Xml": "<Document xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
                      xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
                      xmlns=\"urn:iso:std:iso:20022:tech:xsd:pain.001.001.05\">...</Document>"
}
Name Description Format
TransactionDetails Details of requested transaction Response/TransactionDetails
Xml Xml order (urn:iso:std:iso:20022:tech:xsd:pain.001.001.05) Varchar(MAX)

Get statement

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/GetStatement

Gets statement for selected account within given date range in desired format returned as Base64 binary data.

Request

Get statement example:

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

public byte[] GetStatement(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/GetStatement";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         Filter = new {
            AccountId = 2107000000,
            DateFrom = "2017-08-01",
            DateTo = "2017-09-01",
            FileFormat = "Csv"
         }
      };

      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["StatementBytes"];
   }
}

function GetStatement($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/GetStatement';
   $data = array('Filter' => array(
                'AccountId' = 2107000000,
                'DateFrom' = '2017-08-01',
                'DateTo' = '2017-09-01',
                'FileFormat' = 'Csv'
            )); 

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

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 GetStatement(String token){ try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/GetStatement"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public Object Filter = new Object() { public long AccountId = 2107000000; public String DateFrom = "2017-08-01"; public String DateTo = "2017-09-01"; public String FileFormat = "Csv"; }; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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("StatementBytes")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Filter Statement filter Request/Filter Yes

Request/Filter

Name Description Format Required
AccountId Account ID (ID of account assigned by Trust Pay) Numeric(10) Yes
DateFrom Date from Varchar(10) Yes
DateTo Date to Varchar(10) Yes
FileFormat Statement file format Request/Filter/FileFormat Yes

Request/Filter/FileFormat

Value Description
Csv Csv statement
Html Html statement
Camt53V2 Camt53 version 2 statement
Camt53V4 Camt53 version 4 statement

Response

Response example:
{
    "StatementBytes":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48RG9jdW1lbnQgeG1sbnM..."
}
Name Description Format
StatementBytes Requested statement as Base64 binary data Base64 binary data

Create order

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/CreateOrder

Creates order in accordance with provided pain.001.001.03 order.

Request

Create order example:

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

public long CreateOrder(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/CreateOrder";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         Xml = "..."
      };

      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["OrderId"];
   }
}

function CreateOrder($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/CreateOrder';
   $data = array('Xml' => '...'); 

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

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 CreateOrder(String token){ try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/CreateOrder"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public String Xml = "..."; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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("OrderId")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Xml Xml order (urn:iso:std:iso:20022:tech:xsd:pain.001.001.03) Varchar(MAX) Yes

Xml order examples

Name Description Format Required
AbaCode ABA routing number Numeric(9) For US orders
Address Address Varchar(60) No
Amount Ordered amount (exactly 2 decimal places) Numeric(13,2)
en-US format
Yes
BsbCode Bank State Branch code Numeric(6) For Australian orders
CityCode City code Varchar(35) Yes
ClientReference Client reference enclosed with '<Strd><AddtlRmtInf>CREF:' and '</AddtlRmtInf></Strd>'. If not filled, also omit the XML tags. Varchar(30) excluding XML tags No
CorrespondentBank Correspondent bank Varchar(35) No
CreationDateTime Order creation date time UTC, ISO 8601 format, sortable format - 'yyyy-MM-ddTHH:mm:ss' Yes
CreditorAccount Creditor account IBAN for <IBAN></IBAN> tag and other for <Othr><Id></Id></Othr> Varchar(34) excluding XML tags Yes
CreditorAccountWithTags Creditor account including either <IBAN></IBAN> or <Othr><Id></Id></Othr> tags Varchar(34) excluding XML tags Yes
CreditorAddress Creditor address Other country: Varchar(35) / SEPA: Varchar(70) Other country: Yes / SEPA: No
CreditorBankAddress Creditor bank street Varchar(35) Yes
CreditorBankBic Creditor bank Varchar(11) Yes
CreditorBankCity Creditor bank city Varchar(35) Yes
CreditorBankCountry Creditor bank country Char(2) Yes
CreditorBankName Creditor bank name Varchar(35) Yes
CreditorCity Creditor city Varchar(35) Other country: Yes / SEPA: No
CreditorCountry Creditor country Char(2) Other country: Yes / SEPA: No
CreditorName Creditor name Varchar(35) Yes
Currency Currency code Char(3) Yes
DebtorAccount Debtor account Numeric(10) Yes
DebtorName Debtor name Varchar(35) Yes
Description Description Varchar(140) No
EndToEndReference End to end reference Varchar(35) Yes1
MessageId Message ID Varchar(35) Yes
RequestedExecutionDate Requested execution date (must be today or greater) Varchar(10) Yes
SymbolConstant Constant symbol Numeric(4) No
SymbolSpecific Specific symbol Numeric(10) No
SymbolVariable Variable symbol Numeric(10) No
TransitCode Transit code Numeric(9) starting with 0 For Canadian orders

1 Fill in NOTPROVIDED if you do not need to use end to end reference

Response

Response example:
{
    "OrderId":"123456789"
}
Name Description Format
OrderId Id of created order Numeric(10)

Create orders

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/CreateOrders

Creates orders in accordance with provided pain.001.001.03 order. Only SEPA and Other country orders can be created this way.

Request

Create orders example:

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

public long[] CreateOrders(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/CreateOrders";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         Xml = "..."
      };

      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["OrderIds"];
   }
}

function CreateOrders($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/CreateOrders';
   $data = array('Xml' => '...'); 

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

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[] CreateOrders(String token){ try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/CreateOrders"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public String Xml = "..."; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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("OrderIds")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Xml Xml order (urn:iso:std:iso:20022:tech:xsd:pain.001.001.03) Varchar(MAX) Yes

Mass xml order example

Name Description Format Required
AbaCode ABA routing number Numeric(9) For US orders
Address Address Varchar(60) No
Amount Ordered amount (exactly 2 decimal places) Numeric(13,2)
en-US format
Yes
BsbCode Bank State Branch code Numeric(6) For Australian orders
CorrespondentBank Correspondent bank Varchar(35) No
CreationDateTime Order creation date time UTC, ISO 8601 format, sortable format - 'yyyy-MM-ddTHH:mm:ss' Yes
CreditorAccount Creditor account IBAN for <IBAN></IBAN> tag and other for <Othr><Id></Id></Othr> Varchar(34) excluding XML tags Yes
CreditorAccountWithTags Creditor account including either <IBAN></IBAN> or <Othr><Id></Id></Othr> tags Varchar(34) excluding XML tags Yes
CreditorAddress Creditor address Other country: Varchar(35) / SEPA: Varchar(70) Other country: Yes / SEPA: No
CreditorBankAddress Creditor bank street Varchar(35) Yes
CreditorBankBic Creditor bank Varchar(11) Yes
CreditorBankCity Creditor bank city Varchar(35) Yes
CreditorBankCountry Creditor bank country Char(2) Yes
CreditorBankName Creditor bank name Varchar(35) Yes
CreditorCity Creditor city Varchar(35) Other country: Yes / SEPA: No
CreditorCountry Creditor country Char(2) Other country: Yes / SEPA: No
CreditorName Creditor name Varchar(35) Yes
Currency Currency code Char(3) Yes
DebtorAccount Debtor account Numeric(10) Yes
DebtorName Debtor name Varchar(35) Yes
Description Description Varchar(140) No
EndToEndReference End to end reference Varchar(35) Yes1
MessageId Message ID Varchar(35) Yes
RequestedExecutionDate Requested execution date (must be today or greater) Varchar(10) Yes
TransitCode Transit code Numeric(9) starting with 0 For Canadian orders

1 Fill in NOTPROVIDED if you do not need to use end to end reference

Response

Response example:
{
    "OrderIds":["123456789","123456790"]
}
Name Description Format
OrderIds Ids of created orders Numeric(10)

Refund payment

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/RefundPayment

Refunds payment.

Request

Refund payment example:

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

public long RefundPayment(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/RefundPayment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         PaymentId = 1234567890,
         Amount = "1.25",
         BeneficiaryName = "John Doe",
         Description = "description"
      };

      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["OrderId"];
   }
}

function RefundPayment($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/RefundPayment';
   $data = array('PaymentId' = 1234567890,
                 'Amount' = '1.25',
                 'BeneficiaryName' = 'John Doe',
                 'Description' = 'description'
           ); 

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

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 long RefundPayment(String token) { try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/RefundPayment"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public long PaymentId = 1234567890; public String Amount = "1.25"; public String BeneficiaryName = "John Doe"; public String Description = "description"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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("OrderId")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentId Trust Pay Payment ID of payment to be refunded Numeric(10) Yes
Amount Amount to refund (exactly 2 decimal places) Numeric(13,2)
en-US format
Yes
BeneficiaryName Beneficiary name Varchar(70) Yes1
Description Transaction description Varchar(140) No

1 Beneficiary name is not required for refunds in CZK currency.

Response

Response example:
{
    "OrderId":"123456789"
}
Name Description Format
OrderId Id of created order Numeric(10)

Virtual IBANs

Virtual IBAN accounts are linked to main account, which must be specified when creating a virtual IBAN account. Any payment made in bank with the virtual account as credit account, will be credited to the main account instead. Virtual IBAN account effectively works as an alias to the main account.

Additionally, reference can be specified for each virtual IBAN account. This reference will be added to the payment and payment notification for all payments made via virtual IBAN account.

Create virtual IBAN account

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/CreateVirtualIbanAccount

Creates a virtual IBAN account with specified reference.

Request

Create virtual IBAN account example:

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

public long CreateVirtualAccount(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/CreateVirtualIbanAccount";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         AccountId = 2107000544,
         ClientReference = "REF_123456"
      };

      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["Iban"];
   }
}

function CreateVirtualAccount($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/CreateVirtualIbanAccount';
   $data = array('AccountId' = 2107000544,
                 'ClientReference' = 'REF_123456'
           ); 

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

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 long CreateVirtualAccount(String token) { try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/CreateVirtualIbanAccount"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public long AccountId = 2107000544; public String ClientReference = "REF_123456"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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("Iban")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
AccountId Account ID of main account in BBAN format Numeric(10) Yes
ClientReference Reference that will be added to payments made via this virtual account Varchar(35) Yes

Response

Response example:
{
    "Iban": "SK0799520000001909710578"
}
Name Description Format
Iban IBAN of the newly created virtual account Varchar(34)

Get virtual IBAN account list

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/GetVirtualIbanAccountList

Gets a list of virtual IBAN accounts

Request

Get virtual IBAN account list example:

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

public dynamic GetVirtualAccountList(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/GetVirtualIbanAccountList";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         AccountId = 2107000544,
         ClientReference = "REF_123456"
      };

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

function GetVirtualAccountList($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/GetVirtualIbanAccountList';
   $data = array('AccountId' = 2107000544,
                 'ClientReference' = 'REF_123456'
           ); 

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

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 Map<String, String> GetVirtualAccountList(String token) { try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/GetVirtualIbanAccountList"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public long AccountId = 2107000544; public String ClientReference = "REF_123456"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); 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; } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Filter Virtual IBAN account list filter Request/Filter Yes
Paging Paging information Request/Paging Yes

Request/Filter

Name Description Format Required
AccountId Account ID of main account Numeric(10) Yes
State Account state Request/Filter/State No
ClientReference Client reference Varchar(35) No
VirtualIban Virtual IBAN account Varchar(34) No

Request/Filter/State or Response/Filter/State

Value Description
Active Active accounts
Blocked Blokced accounts (can be reactivated)
Closed Closed accounts (can not be reactivated)

Request/Paging or Response/Paging

Name Description Format Required
Page Number of page to show (starts from zero) Numeric(10) Yes
PageSize Number of results on the page Numeric(5) Yes

Response

Response example:
{
    "Accounts": [
        {
            "ClientReference": "REF_123456",
            "Iban": "SK0799520000001909710578",
            "State": 0
        },
        {
            "ClientReference": "REF_123456",
            "Iban": "SK5199520000001960067530",
            "State": 0
        }
    ],
    "TotalCount": 2,
    "Paging": {
        "Page": 0,
        "PageSize": 10
    }
}
Name Description Format
Accounts Details of selected accounts Response/VirtualAccount
TotalCount Count of all transactions on the account Numeric(10)
Paging Paging info Response/Paging

Response/VirtualAccount

Name Description Format
ClientReference Client's reference Varchar(35)
Iban Virtual account's IBAN Varchar(35)
State Account state Response/Filter/State

Change virtual IBAN account reference

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/ChangeVirtualIbanAccountReference

Updates the reference of an existing virtual IBAN account.

Request

Change virtual IBAN account reference example:

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

public bool ChangeAccountReference(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/ChangeVirtualIbanAccountReference";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         Iban = "SK0799520000001909710578",
         ClientReference = "REF_456789"
      };

      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 Encoding.UTF8.GetString(responseData) == "{}";
   }
}

function ChangeAccountReference($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/ChangeVirtualIbanAccountReference';
   $data = array('Iban' = 'SK0799520000001909710578',
                 'ClientReference' = 'REF_123456'
           ); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization:bearer $Token",
            'Content-type: text/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = file_get_contents($url, false, $context);
   
   return $response == "{}";
}

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 boolean ChangeAccountReference(String token) { try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/ChangeVirtualIbanAccountReference"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public long Iban = "SK0799520000001909710578"; public String ClientReference = "REF_123456"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } return reponse == "{}"; } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Iban IBAN on which to change the reference Varchar(34) Yes
ClientReference Reference that will be added to payments made via this virtual account Varchar(35) Yes

Response

Response example:
{}

You should expect empty response with HTTP status code 200 if the reference was successfully updated.

Change virtual IBAN account state

API endpoints:
Live - https://api.trustpay.eu/ApiBanking/ChangeVirtualIbanAccountState

Changes the state of an existing virtual IBAN account.

Request

Change virtual IBAN account state example:

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

public bool ChangeAccountState(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/ChangeVirtualIbanAccountState";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: bearer " + token,
         "Content-Type: text/json"
      };
      var request = new
      {
         Iban = "SK0799520000001909710578",
         Action = "Block"
      };

      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 Encoding.UTF8.GetString(responseData) == "{}";
   }
}

function ChangeAccountState($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/ChangeVirtualIbanAccountState';
   $data = array('Iban' = 'SK0799520000001909710578',
                 'Action' = 'Block'
           ); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization:bearer $Token",
            'Content-type: text/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = file_get_contents($url, false, $context);
   
   return $response == "{}";
}

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 boolean ChangeAccountState(String token) { try { URL obj = new URL("https://api.trustpay.eu/ApiBanking/ChangeVirtualIbanAccountState"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "bearer " + token); con.setRequestProperty("Content-type", "text/json"); Object request = new Object() { public long Iban = "SK0799520000001909710578"; public String Action = "Block"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(jsonrequest); wr.flush(); wr.close(); String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } return reponse == "{}"; } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Iban IBAN on which to change the state Varchar(34) Yes
Action Action to perform Request/Action Yes

Request/Action

Value Description
Block Block the account
Unblock Unblock the account
Close Close the account

Response

Response example:
{}

You should expect empty response with HTTP status code 200 if the reference was successfully updated.

Code lists

Supported currencies

The list of currencies (according to ISO 4217) supported by TrustPay for instant bank transfers.

Code ID Name
CZK 203 Czech koruna
EUR 978 Euro

Supported countries

The list of customer countries (according to ISO 3166-1 alpha-2) supported by TrustPay for instant bank transfers.

Code Country
CZ Czech Republic
SK Slovak Republic

Supported languages

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

Code Language Supported for wire payments Supported for card payments
bgBulgarianYesNo
bsBosnianYesNo
csCzechYesYes
deGermanNoYes
enEnglishYesYes
esSpanishNoYes
etEstonianYesNo
hrCroatianYesYes
huHungarianYesYes
itItalianNoYes
ltLithuanianYesNo
lvLatvianYesNo
plPolishYesYes
roRomanianYesYes
ruRussianYesYes
skSlovakYesYes
slSloveneYesYes
srSerbianYesNo
trTurkishYesNo
ukUkrainianNoYes

Result codes

Code Name Description Returned via
0 Success Payment was successfully processed. When received in notification, funds have been credited to the merchant account - merchant can provide goods or services without delay client redirects, merchant notifications
1 Pending Payment may have been payed, but the real result is not known yet (for example client made offline payment or Trust Pay still waits for notification from bank). client redirects
2 Announced TrustPay has been notified that the client placed a payment order or has made payment, but further confirmation from 3rd party is needed. Another notification (with result code 0 - success) will be sent when TrustPay receives and processes payment from 3rd party. Funds have not been credited to the merchant account and there is no guarantee they will be. merchant notifications
3 Authorized Payment was successfully authorized. Another notification (with result code 0 - success) will be sent when TrustPay receives and processes payment from 3rd party. For card payments, funds will be credited to the merchant's account in a bulk payment on the next settlement day. Merchant can provide goods or services without delay. merchant notifications
4 Processing TrustPay has received the payment, but it must be internally processed before it is settled on the merchant's account. When the payment is successfully processed, another notification (with the result code 0 – success) will be sent. Funds will be credited to merchant's account at a later date. merchant notifications
5 AuthorizedOnly Card payment was successfully authorized, but not captured. Subsequent MAPI calls are required to capture the payment. client redirects, merchant notifications
1001 Invalid request Some of the parameters in request are missing or have invalid format client redirects
1002 Unknown account Account with specified ID was not found. Please check that you are using correct AID for playground/live environment. client redirects
1003 Merchant account disabled Merchant account has been disabled client redirects
1004 Invalid signature Verification of request signature has failed client redirects
1005 User cancel Customer has cancelled the payment client redirects
1006 Invalid authentication Request was not properly authenticated client redirects
1007 Insufficient balance Requested transaction amount is greater than disposable balance client redirects
1008 Service not allowed Service cannot be used or permission to use given service has not been granted. If you receive this code, please contact Trust Pay for more information. client redirects
1009 Processing ID used Specified processing ID was already used. Please generate a new PID using Setup payment service call. client redirects
1010 Transaction not found Transaction with specified ID was not found client redirects, API responses
1011 Unsupported transaction The requested action is not supported for the transaction client redirects, API responses
1014 Rejected transaction Transaction was rejected by issuer client redirects
1100 General Error Internal error has occurred. Please contact Trust Pay to resolve this issue. client redirects, API reponses
1101 Unsupported currency conversion Currency conversion for requested currencies is not supported client redirects

Card acquirer result code

Code Description
100.100.303 Rejected - card expired
100.100.600 Rejected - invalid CVV
100.100.601 Rejected - invalid CVV
100.100.700 Rejected - invalid card number
100.380.401 Rejected - failed 3DS authentication
100.380.501 Rejected - failed 3DS authentication
800.100.151 Rejected - invalid card number
800.100.153 Rejected - invalid CVV
800.100.155 Rejected - insufficient funds
800.100.157 Rejected - invalid expiry date
800.100.161 Rejected - too many invalid tries
800.100.162 Rejected - card limit exceeded
800.100.163 Rejected - card limit exceeded
800.120.101 Rejected - card limit exceeded
800.120.200 Rejected - card limit exceeded
800.120.201 Rejected - card limit exceeded

Direct debits result code

Code Description
1001000 Success
1002000 General error
1003000 Security error
1002004 Invalid request
1132000 Invalid mapi request
1132001 Unknown account
1132002 Merchant account disabled
1132009 Unknown mandate
1132010 Canceled mandate
1132011 Missing Cid
1132012 Mandate already paid
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.