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

Overview of payment process

Intro

The TrustPay 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 endpoint:
Live - https://amapi.trustpay.eu/
For testing purposes please use the same API endpoint with your testing credentials.

Payment process

Payment processing

Instant Bank transfers

Payment setup v02

API endpoint:

Live - https://amapi.trustpay.eu/mapi5/wire/paypopup
For testing purposes please use the same API endpoint with your testing credentials.
Example HTML code:

        <script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://amapi.trustpay.eu/mapi5/wire/paypopup?accountId=4107111111..."></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
        

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

The IFrame URL should contain the following parameters:

Payment setup example:

public string GetSetUpPaymentUrl() 
{
    string baseUrl = "https://amapi.trustpay.eu/mapi5/wire/paypopup";
    long accountId = 4107111111;
    decimal amount = 1.5M;
    string currency = "EUR";
    string reference = "123456789";
    string notificationUrl = "https://example.handler.com/result.php";
    int paymentType = 0;
        
    string secretKey = "123456";
    string sigData = string.Format(
        CultureInfo.InvariantCulture,
        "{0}/{1:0.00}/{2}/{3}/{4}", accountId, amount, currency, reference, paymentType);
    string signature = GetSignature(secretKey, sigData);

    string url = string.Format(
    CultureInfo.InvariantCulture,
        "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&NotificationUrl={5}&PaymentType={6}&Signature={7}",
        baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference),
        HttpUtility.UrlEncode(notificationUrl), paymentType, signature);

    Response.Redirect(url);
}

function getSetUpPaymentUrl()
{
    $baseUrl = "https://amapi.trustpay.eu/mapi5/wire/paypopup";
    $accountId = 4107111111;
    $amount = 1.5;
    $currency = "EUR";
    $reference = "123456789";
    $notificationUrl = "https://example.handler.com/result.php";
    $paymentType = 0;

    $secretKey = "123456";
    $sigData = sprintf("%d/%s/%s/%s/%d", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType);
    $signature = GetSignature($secretKey, $sigData);

    $url = sprintf(
        "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&NotificationUrl=%s&PaymentType=%d&Signature=%s",
        $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency,
        urlencode($reference), urlencode($notificationUrl), $paymentType, $signature);
    return $url;
}

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

public String GetSetUpPaymentUrl()
{
    String baseUrl = "https://amapi.trustpay.eu/mapi5/wire/paypopup";
    long accountId = 4107111111;
    double amount = 1.5d;
    String currency = "EUR";
    String reference = "123456789";
    String notificationUrl = "https://example.handler.com/result.php";
    int paymentType = 0;

    try
    {
        String secretKey = "123456";
        String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d", accountId, amount, currency, reference, paymentType);
        String signature = GetSignature(secretKey, sigData);

        String url = String.format(
            Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&NotificationUrl=%s&PaymentType=%d&Signature=%s", 
            baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), 
            URLEncoder.encode(notificationUrl, "UTF-8"), paymentType, signature);
        return url;
    }catch(Exception ex){}
}
Name Description Format Required
AccountId Merchant account or project ID (ID of account or project assigned by TrustPay) Numeric(10) Yes
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2)
en-US format
Yes
Currency Currency of the payment (same as currency of merchant account) Char(3) Yes
Reference Reference (merchant’s payment identification) Varchar(35)1 Yes
PaymentType Payment type
For purchase must be set to 0
Numeric(1) Yes
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Reference and PaymentType parameters, if these parameters are present. Slash character ('/') is used as separator. Char(64) Yes
Url Return URL (overrides any default Return URL, can be overridden further by Return URL, Cancel URL, Error URL) Varchar(256) No
ReturnUrl Return URL (overrides default Success Return URL) Varchar(256) No
CancelUrl Cancel URL (overrides default Cancel Return URL) Varchar(256) No
ErrorUrl Error URL (overrides default Error Return URL) Varchar(256) No
NotificationUrl Notification URL (overrides default Notification URL) Varchar(256) No
Localization Default language for TrustPay site Char(2) No
Country Default country of client Char(2) No
Description Description (payment description text that will be displayed to the user) Varchar(140) No
Email Customer email Varchar(254) No
IsRedirect Allows to make a redirect from merchant's e-shop Bool2 No

1 The reference can not contain characters < and >
2 Only values True and False are allowed.

Payment result v02

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?Reference=1234567890&ResultCode=0&PaymentRequestId=4337417657
Name Description Format
Reference Reference (merchant’s payment identification) Varchar(500)
ResultCode Result code Numeric(4)
PaymentRequestId Payment request ID (sent when available, can be used for inquiries regarding failed payments) Numeric(10)

Refund v02

API endpoint:
Live - https://amapi.trustpay.eu/mapi5/wire/paypopup
For testing purposes please use the same API endpoint with your testing credentials.
Refund example:

string baseUrl = "https://amapi.trustpay.eu/mapi5/Wire/PayPopup";
long accountId = 4107111111;
decimal amount = 1.5M;
string currency = "EUR";
string reference = "123456789";
int paymentType = 8;
int paymentRequestId = 555;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}/{1:0.00}/{2}/{3}/{4}/{5}/{6}", accountId, amount, currency, reference, paymentType, paymentRequestId);
string signature = GetSignature(secretKey, sigData);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}&PaymentRequestId={7}",
    baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType, paymentRequestId);

Response.Redirect(url);

$baseUrl = "https://amapi.trustpay.eu/mapi5/Wire/PayPopup";
$accountId = 4107111111;
$amount = 1.5;
$currency = "EUR";
$reference = "123456789";
$paymentType = 8;
$paymentRequestId = 555;
        
$secretKey = "123456";
$sigData = sprintf("%d/%s/%s/%s/%d/%d", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType, $paymentRequestId);
$signature = GetSignature($secretKey, $sigData);

$url = sprintf(
    "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&PaymentRequestId=%s", 
    $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType, $paymentRequestId);
header("Location: $url");
exit();

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

String  baseUrl = "https://amapi.trustpay.eu/mapi5/Wire/PayPopup";
long accountId = 4107111111;
double amount = 1.5d;
String  currency = "EUR";
String  reference = "123456789";
int paymentType = 8;
int paymentRequestId = 555;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d/%d", accountId, amount, currency, reference, paymentType, paymentRequestId);
    String signature = GetSignature(secretKey, sigData);

    String url = String.format(
        Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&PaymentRequestId=%s", 
        baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType, paymentRequestId);
    response.sendRedirect(url);
}catch(Exception ex){}

This function allows refunding a transaction.

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

Name Description Format Required
PaymentType Payment type
For refund must be set to 8
Numeric(1) Yes
PaymentRequestId Payment request ID from notification Numeric(10) Yes
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Reference, PaymentType and PaymentRequestId parameters, if these parameters are present. Slash character ('/') is used as separator. Char(64) Yes

Body of HTTP response will contain a result code (see example response to the right).

Example response:

{
    "ResultCode": 0
}

Direct banking

Intro v01

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 v01

API endpoint:
Live - https://amapi4.trustpay.eu/mapi/GetBankList.aspx
For testing purposes please use the same API endpoint with your testing credentials.

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://amapi.trustpay.eu/mapi/GetBankList.aspx";
string CNT = "SK"
       
string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?CNT={1}", baseUrl, CNT);

Response.Redirect(url);
            
        

$baseUrl = "https://amapi.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://amapi.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://amapi.trustpay.eu/mapi/GetBankList.aspx \
-d "CNT=SK" \

<form method="GET" action="https://amapi.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 or project ID (ID of account or project assigned by TrustPay) 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 v01

API endpoint:
Live - https://amapi4.trustpay.eu/mapi/SetupPayment.aspx
For testing purposes please use the same API endpoint with your testing credentials.

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://amapi.trustpay.eu/mapi/SetupPayment.aspx";
long AID = 4107111111;
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://amapi.trustpay.eu/mapi/SetupPayment.aspx";
$AID = 4107111111;
$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://amapi.trustpay.eu/mapi/SetupPayment.aspx";
long AID = 4107111111;
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://amapi.trustpay.eu/mapi/SetupPayment.aspx \
-d "AID=4107111111" \
-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://amapi.trustpay.eu/mapi/SetupPayment.aspx">
    <input type="hidden" name="AID" value="4107111111" />
    <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 or project ID (ID of account or project assigned by TrustPay) 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 v01

API endpoint:
Live - https://amapi4.trustpay.eu/mapi/RedirectToBank.aspx
For testing purposes please use the same API endpoint with your testing credentials.

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://amapi.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://amapi.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://amapi.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://amapi.trustpay.eu/mapi/RedirectToBank.aspx \
-d "PID=4312345678" \
-d "EURL=https%3A%2F%2Fexample.handler.com%2Ferror.php"

<form method="GET" action="https://amapi.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.

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 TrustPay account later in a single transaction. You will not receive any further notifications for the individual card transactions.

Test cards v02

When you are testing your implementation on the mapi endpoint with your testing credentials, 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 v02

API endpoint:
Live - https://amapi.trustpay.eu/mapi5/Card/PayPopup
For testing purposes please use the same API endpoint with your testing credentials.
Example HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://amapi.trustpay.eu/mapi5/Card/PayPopup?accountId=4107111111..."></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>

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

The IFrame URL should contain the following parameters:

Payment setup example:

public string GetPurchaseUrl() 
{
    string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    decimal amount = 1.5M;
    string billingcity = "Bratislava";
    string billingcountry = "SK";
    string billingpostcode = "83103";
    string billingstreet = "Za kasarnou 1";
    string cardholder = "TrustPay";
    string currency = "EUR";
    string email = "info@trustpay.eu";
    string reference = "123456789";
    int paymentType = 0;

    string secretKey = "123456";
    string sigData = string.Format(
        CultureInfo.InvariantCulture,
        "{0}/{1:0.00}/{2}/{3}/{4}/{5}/{6}/{7}/{8}/{9}/{10}", accountId, amount, currency, reference, paymentType, billingcity, billingcountry, billingpostcode, billingstreet, cardholder, email);
        string signature = GetSignature(secretKey, sigData);

    string url = string.Format(
        CultureInfo.InvariantCulture,
        "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&PaymentType={5}&Signature={6}&BillingCity={7}&BillingCountry={8}&BillingPostcode={9}&BillingStreet={10}&CardHolder={11}&Email={12}",
        baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), paymentType, signature, billingcity, billingcountry, billingpostcode, billingstreet, cardholder, email);

    return url;
}


function getPurchaseUrl()
{
    $baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    $accountId = 4107111111;
    $amount = 1.5;
    $billingcity = "Bratislava";
    $billingcountry = "SK";
    $billingpostcode = "83103";
    $billingstreet = "Za kasarnou 1";
    $cardholder = "TrustPay";
    $currency = "EUR";
    $email = "info@trustpay.eu";
    $reference = "123456789";
    $paymentType = 0;
        
    $secretKey = "123456";
    $sigData = sprintf("%d/%s/%s/%s/%d/%s/%s/%s/%s/%s/%s", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType, $billingcity, $billingcountry, $billingpostcode, $billingstreet, $cardholder, $email);
    $signature = GetSignature($secretKey, $sigData);

    $url = sprintf(
        "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&PaymentType=%d&Signature=%s&BillingCity=%s&BillingCountry=%s&BillingPostcode=%s&BillingStreet=%s&CardHolder=%s&Email=%s", 
        $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $paymentType, $signature, $billingcity, $billingcountry, $billingpostcode, $billingstreet, $cardholder, $email);

    return $url;
}


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

public String GetPurchaseUrl()
{
    String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    double amount = 1.5d;
    String billingcity = "Bratislava";
    String billingcountry = "SK";
    String billingpostcode = "83103";
    String billingstreet = "Za kasarnou 1";
    String cardholder = "TrustPay";
    String currency = "EUR";
    String email = "info@trustpay.eu";
    String reference = "123456789";
    int paymentType = 0;

    try
    {
        String secretKey = "123456";
        String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d/%s/%s/%s/%s/%s/%s", accountId, amount, currency, reference, paymentType, billingcity, billingcountry, billingpostcode, billingstreet, cardholder, email);
        String signature = GetSignature(secretKey, sigData);

        String url = String.format(
            Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&PaymentType=%d&Signature=%s&BillingCity=%s&BillingCountry=%s&BillingPostcode=%s&BillingStreet=%s&CardHolder=%s&Email=%s", 
            baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), paymentType, signature, billingcity, billingcountry, billingpostcode, billingstreet, cardholder, email);
        return url;
    }catch(Exception ex){}
}

Name Description Format Required
AccountId Merchant account or project ID (ID of account or project assigned by TrustPay) Numeric(10) Yes
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2)
en-US format
Yes
BillingCity The town, district or city of customer's billing address Varchar(80) Yes, from 1.10.2020
BillingCountry The country of customer's billing address (in ISO-3166 format) Char(2) Yes, from 1.10.2020
BillingPostcode The postal code or zip code of customer's billing address Varchar(30)1 Yes, from 1.10.2020
BillingStreet The street name and number of customer's billing address Varchar(100) Yes, from 1.10.2020
CardHolder The cardholder name (at least 3 characters) Varchar(3-140) Yes, from 1.10.2020
Currency Currency of the payment Char(3) Yes
Email Customer email Varchar(254) Yes, from 1.10.2020
PaymentType Payment type
For purchase must be set to 0
Numeric(1) Yes
Reference Reference (merchant’s payment identification) Varchar(35)1 Yes
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Reference, PaymentType, BillingCity, BillingCountry, BillingPostcode, BillingStreet, CardHolder and Email parameters, if these parameters are present. Slash character ('/') is used as separator. Email parameter in the signature is optional until 1. 10. 2020. Char(64) Yes
Url Return URL (overrides any default Return URL, can be overridden further by Return URL, Cancel URL, Error URL) Varchar(256) No
ReturnUrl Return URL (overrides default Success Return URL) Varchar(256) No
CancelUrl Cancel URL (overrides default Cancel Return URL) Varchar(256) No
ErrorUrl Error URL (overrides default Error Return URL) Varchar(256) No
NotificationUrl Notification URL (overrides default Notification URL) Varchar(256) No
Localization Default language for TrustPay site Char(2) No
Country Default country of client Char(2) No
Description Description (payment description text that will be displayed to the user) Varchar(140)2 No
IsRedirect Allows to make a redirect from merchant's e-shop Bool3 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.
3 Only values True and False are allowed.

Card on file v02

API endpoint:
Live - https://amapi.trustpay.eu/mapi5/Card/PayPopup
For testing purposes please use the same API endpoint with your testing credentials.

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:

public string GetRegisterUrl() 
{
    string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    decimal amount = 1.5M;
    string currency = "EUR";
    string reference = "123456789";
    int paymentType = 1;
        
    string secretKey = "123456";
    string sigData = string.Format(
        CultureInfo.InvariantCulture,
        "{0}/{1:0.00}/{2}/{3}/{4}", accountId, amount, currency, reference, paymentType);
    string signature = GetSignature(secretKey, sigData);

    string url = string.Format(
        CultureInfo.InvariantCulture,
        "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}",
        baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType);

    return url;
}

function getRegisterUrl() 
{
    $baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    $accountId = 4107111111;
    $amount = 1.5;
    $currency = "EUR";
    $reference = "123456789";
    $paymentType = 1;
        
    $secretKey = "123456";
    $sigData = sprintf("%d/%s/%s/%s/%d", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType);
    $signature = GetSignature($secretKey, $sigData);

    $url = sprintf(
        "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d", 
        $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType);

    return $url;
}

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

public String GetRegisterUrl()
{
    String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    double amount = 1.5d;
    String  currency = "EUR";
    String  reference = "123456789";
    int paymentType = 1;

    try
    {
        String secretKey = "123456";
        String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d", accountId, amount, currency, reference, paymentType);
        String signature = GetSignature(secretKey, sigData);

        String url = String.format(
            Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d", 
            baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType);
        return 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
PaymentType Payment 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:

public string GetCardOnFilePurchaseUrl()
{
    string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    decimal amount = 1.5M;
    string currency = "EUR";
    string reference = "123456789";
    int paymentType = 2;
    string cardId = "8a8394855cfd3692015d0dc3f793355b";
        
    string secretKey = "123456";
    string sigData = string.Format(
        CultureInfo.InvariantCulture,
        "{0}/{1:0.00}/{2}/{3}/{4}/{5}/{6}", accountId, amount, currency, reference, paymentType, cardId);
    string signature = GetSignature(secretKey, sigData);

    string url = string.Format(
        CultureInfo.InvariantCulture,
        "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}&CardId={7}",
        baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType, cardId);

    return url;
}

function getCardOnFilePurchaseUrl()
{
    $baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    $accountId = 4107111111;
    $amount = 1.5;
    $currency = "EUR";
    $reference = "123456789";
    $paymentType = 2;
    $cardId = "8a8394855cfd3692015d0dc3f793355b";
        
    $secretKey = "123456";
    $sigData = sprintf("%d/%s/%s/%s/%d/%s", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType, $cardId);
    $signature = GetSignature($secretKey, $sigData);

    $url = sprintf(
        "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&CardId=%s", 
        $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType, $cardId);

    return $url;
}

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

public String GetCardOnFilePurchaseUrl()
{
    String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    double amount = 1.5d;
    String  currency = "EUR";
    String  reference = "123456789";
    int paymentType = 2;
    String cardId = "8a8394855cfd3692015d0dc3f793355b";

    try
    {
        String secretKey = "123456";
        String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d/%s", accountId, amount, currency, reference, paymentType, cardId);
        String signature = GetSignature(secretKey, sigData);

        String url = String.format(
            Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&CardId=%s", 
            baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType, cardId);
        return 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
PaymentType Payment type
For card on file purchase must be set to 2
Numeric(1) Yes
CardId Card ID from notification Varchar(64) No
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Reference, PaymentType, BillingCity, BillingCountry, BillingPostcode, BillingStreet, CardHolder, Email and CardId parameters, if these parameters are present. Slash character ('/') is used as separator. Char(64) Yes

Card on file preauthorization

Card on file preauthorization example:

public string GetCardOnFilePreauthorizationUrl() 
{
    string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    decimal amount = 1.5M;
    string currency = "EUR";
    string reference = "123456789";
    int paymentType = 9;
    string cardId = "8a8394855cfd3692015d0dc3f793355b";

    string secretKey = "123456";
    string sigData = string.Format(
        CultureInfo.InvariantCulture,
        "{0}/{1:0.00}/{2}/{3}/{4}/{5}/{6}", accountId, amount, currency, reference, paymentType, cardId);
    string signature = GetSignature(secretKey, sigData);

    string url = string.Format(
        CultureInfo.InvariantCulture,
        "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}&CardId={7}",
        baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType, cardId);

    return url;
}

function getCardOnFilePreauthorizationUrl()
{
    $baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    $accountId = 4107111111;
    $amount = 1.5;
    $currency = "EUR";
    $reference = "123456789";
    $paymentType = 9;
    $cardId = "8a8394855cfd3692015d0dc3f793355b";
        
    $secretKey = "123456";
    $sigData = sprintf("%d/%s/%s/%s/%d/%s", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType, $cardId);
    $signature = GetSignature($secretKey, $sigData);

    $url = sprintf(
        "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&CardId=%s", 
        $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType, $cardId);

    return $url;
}

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

public String GetCardOnFilePreauthorizationUrl()
{
    String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    double amount = 1.5d;
    String  currency = "EUR";
    String  reference = "123456789";
    int paymentType = 9;
    String cardId = "8a8394855cfd3692015d0dc3f793355b";

    try
    {
        String secretKey = "123456";
        String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d/%s", accountId, amount, currency, reference, paymentType, cardId);
        String signature = GetSignature(secretKey, sigData);

        String url = String.format(
            Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&CardId=%s", 
            baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType, cardId);
        return 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
PaymentType Payment type
For card on file preauthorization must be set to 9
Numeric(1) Yes
CardId Card ID from notification Varchar(64) Yes
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Reference, PaymentType, BillingCity, BillingCountry, BillingPostcode, BillingStreet, CardHolder, Email and CardId parameters, if these parameters are present. Slash character ('/') is used as separator. Char(64) Yes

Recurring v02

API endpoint:
Live - https://amapi.trustpay.eu/mapi5/Card/PayPopup
For testing purposes please use the same API endpoint with your testing credentials.

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:

public string GetInitialPaymentUrl()
{
    string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    decimal amount = 1.5M;
    string currency = "EUR";
    string reference = "123456789";
    int paymentType = 3;
        
    string secretKey = "123456";
    string sigData = string.Format(
        CultureInfo.InvariantCulture,
        "{0}/{1:0.00}/{2}/{3}/{4}", accountId, amount, currency, reference, paymentType);
    string signature = GetSignature(secretKey, sigData);

    string url = string.Format(
        CultureInfo.InvariantCulture,
        "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}",
        baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType);

    return url;
}

function getInitialPaymentUrl()
{
    $baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    $accountId = 4107111111;
    $amount = 1.5;
    $currency = "EUR";
    $reference = "123456789";
    $paymentType = 3;
        
    $secretKey = "123456";
    $sigData = sprintf("%d/%s/%s/%s/%d", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType);
    $signature = GetSignature($secretKey, $sigData);

    $url = sprintf(
        "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d", 
        $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType);
    
    return $url;
}

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

public String GetInitialPaymentUrl()
{
    String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    double amount = 1.5d;
    String  currency = "EUR";
    String  reference = "123456789";
    int paymentType = 3;

    try
    {
        String secretKey = "123456";
        String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d", accountId, amount, currency, reference, paymentType);
        String signature = GetSignature(secretKey, sigData);

        String url = String.format(
            Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d", 
            baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType);
        return url;
    }catch(Exception ex){}
}

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

Name Description Format Required
PaymentType Payment type
For initial recurring payment must be set to 3
Numeric(1) Yes

Subsequent payment

Subsequent payment example:

string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
long accountId = 4107111111;
decimal amount = 1.5M;
string currency = "EUR";
string reference = "123456789";
int paymentType = 4;
int paymentRequestId = 555;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}/{1:0.00}/{2}/{3}/{4}/{5}/{6}", accountId, amount, currency, reference, paymentType, paymentRequestId);
string signature = GetSignature(secretKey, sigData);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}&PaymentRequestId={7}",
    baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType, paymentRequestId);

Response.Redirect(url);

$baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
$accountId = 4107111111;
$amount = 1.5;
$currency = "EUR";
$reference = "123456789";
$paymentType = 4;
$paymentRequestId = 555;
        
$secretKey = "123456";
$sigData = sprintf("%d/%s/%s/%s/%d/%d", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType, $paymentRequestId);
$signature = GetSignature($secretKey, $sigData);

$url = sprintf(
    "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&PaymentRequestId=%s", 
    $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType, $paymentRequestId);
header("Location: $url");
exit();

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

String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
long accountId = 4107111111;
double amount = 1.5d;
String  currency = "EUR";
String  reference = "123456789";
int paymentType = 4;
int paymentRequestId = 555;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d/%d", accountId, amount, currency, reference, paymentType, paymentRequestId);
    String signature = GetSignature(secretKey, sigData);

    String url = String.format(
        Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&PaymentRequestId=%s", 
        baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType, paymentRequestId);
    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
PaymentType Payment type
For subsequent recurring payments must be set to 4
Numeric(1) Yes
PaymentRequestId Payment request ID from notification Numeric(10) Yes
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Reference, PaymentType, BillingCity, BillingCountry, BillingPostcode, BillingStreet, CardHolder, Email and PaymentRequestId parameters, if these parameters are present. Slash character ('/') is used as separator. Char(64) Yes

Body of HTTP response will contain a result code (see example response to the right).

Example response:

{
    'ResultCode':3,
    'AcquirerResponseId':'000.000.000'
}

Recurring Initial Preauthorization v02

API endpoint:
Live - https://amapi.trustpay.eu/mapi5/Card/PayPopup
For testing purposes please use the same API endpoint with your testing credentials.

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

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

Merchants responsibilities:

Initial payment

Initial payment example:

public string GetInitialPaymentUrl()
{
    string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    decimal amount = 1.5M;
    string currency = "EUR";
    string reference = "123456789";
    int paymentType = 12;
        
    string secretKey = "123456";
    string sigData = string.Format(
        CultureInfo.InvariantCulture,
        "{0}/{1:0.00}/{2}/{3}/{4}", accountId, amount, currency, reference, paymentType);
    string signature = GetSignature(secretKey, sigData);

    string url = string.Format(
        CultureInfo.InvariantCulture,
        "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}",
        baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType);

    return url;
}

function getInitialPaymentUrl()
{
    $baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    $accountId = 4107111111;
    $amount = 1.5;
    $currency = "EUR";
    $reference = "123456789";
    $paymentType = 12;
        
    $secretKey = "123456";
    $sigData = sprintf("%d/%s/%s/%s/%d", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType);
    $signature = GetSignature($secretKey, $sigData);

    $url = sprintf(
        "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d", 
        $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType);
    
    return $url;
}

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

public String GetInitialPaymentUrl()
{
    String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    double amount = 1.5d;
    String  currency = "EUR";
    String  reference = "123456789";
    int paymentType = 12;

    try
    {
        String secretKey = "123456";
        String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d", accountId, amount, currency, reference, paymentType);
        String signature = GetSignature(secretKey, sigData);

        String url = String.format(
            Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d", 
            baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType);
        return url;
    }catch(Exception ex){}
}

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

Name Description Format Required
PaymentType Payment type
For initial recurring preauthorization payment must be set to 12
Numeric(2) Yes

Preauthorization

API endpoint:
Live - https://amapi.trustpay.eu/mapi5/Card/PayPopup
For testing purposes please use the same API endpoint with your testing credentials.

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:

public string GetPreauthorizationSetupUrl() 
{
    string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    decimal amount = 1.5M;
    string currency = "EUR";
    string reference = "123456789";
    int paymentType = 5;
        
    string secretKey = "123456";
    string sigData = string.Format(
        CultureInfo.InvariantCulture,
        "{0}/{1:0.00}/{2}/{3}/{4}", accountId, amount, currency, reference, paymentType);
    string signature = GetSignature(secretKey, sigData);

    string url = string.Format(
        CultureInfo.InvariantCulture,
        "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}",
        baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType);

    return url;
}

function getPreauthorizationSetupUrl()
{
    $baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    $accountId = 4107111111;
    $amount = 1.5;
    $currency = "EUR";
    $reference = "123456789";
    $paymentType = 5;
        
    $secretKey = "123456";
    $sigData = sprintf("%d/%s/%s/%s/%d", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType);
    $signature = GetSignature($secretKey, $sigData);

    $url = sprintf(
        "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d", 
        $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType);

    return $url;
}

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

public String GetPreauthorizationSetupUrl()
{
    String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
    long accountId = 4107111111;
    double amount = 1.5d;
    String  currency = "EUR";
    String  reference = "123456789";
    int paymentType = 5;

    try
    {
        String secretKey = "123456";
        String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d", accountId, amount, currency, reference, paymentType);
        String signature = GetSignature(secretKey, sigData);

        String url = String.format(
            Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d", 
            baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType);
        return url;
    }catch(Exception ex){}
}

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

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

Capture

Capture example:

string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
long accountId = 4107111111;
decimal amount = 1.5M;
string currency = "EUR";
string reference = "123456789";
int paymentType = 6;
int paymentRequestId = 555;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}/{1:0.00}/{2}/{3}/{4}/{5}/{6}", accountId, amount, currency, reference, paymentType, paymentRequestId);
string signature = GetSignature(secretKey, sigData);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}&PaymentRequestId={7}",
    baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType, paymentRequestId);

Response.Redirect(url);

$baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
$accountId = 4107111111;
$amount = 1.5;
$currency = "EUR";
$reference = "123456789";
$paymentType = 6;
$paymentRequestId = 555;
        
$secretKey = "123456";
$sigData = sprintf("%d/%s/%s/%s/%d/%d", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType, $paymentRequestId);
$signature = GetSignature($secretKey, $sigData);

$url = sprintf(
    "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&PaymentRequestId=%s", 
    $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType, $paymentRequestId);
header("Location: $url");
exit();

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

String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
long accountId = 4107111111;
double amount = 1.5d;
String  currency = "EUR";
String  reference = "123456789";
int paymentType = 6;
int paymentRequestId = 555;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d/%d", accountId, amount, currency, reference, paymentType, paymentRequestId);
    String signature = GetSignature(secretKey, sigData);

    String url = String.format(
        Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&PaymentRequestId=%s", 
        baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType, paymentRequestId);
    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
PaymentType Payment type
For capture must be set to 6
Numeric(1) Yes
PaymentRequestId Payment request ID from notification Numeric(10) Yes
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Reference, PaymentType and PaymentRequestId parameters, if these parameters are present. Slash character ('/') is used as separator. Char(64) Yes

Body of HTTP response will contain a result code (see example response to the right).

Example response:

{
    'ResultCode':3,
    'AcquirerResponseId':'000.000.000'
}

Refund v02

API endpoint:
Live - https://amapi.trustpay.eu/mapi5/Card/PayPopup
For testing purposes please use the same API endpoint with your testing credentials.
Refund example:

string baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
long accountId = 4107111111;
decimal amount = 1.5M;
string currency = "EUR";
string reference = "123456789";
int paymentType = 8;
int paymentRequestId = 555;
        
string secretKey = "123456";
string sigData = string.Format(
    CultureInfo.InvariantCulture,
    "{0}/{1:0.00}/{2}/{3}/{4}/{5}/{6}", accountId, amount, currency, reference, paymentType, paymentRequestId);
string signature = GetSignature(secretKey, sigData);

string url = string.Format(
    CultureInfo.InvariantCulture,
    "{0}?AccountId={1}&Amount={2:0.00}&Currency={3}&Reference={4}&Signature={5}&PaymentType={6}&PaymentRequestId={7}",
    baseUrl, accountId, amount, currency, HttpUtility.UrlEncode(reference), signature, paymentType, paymentRequestId);

Response.Redirect(url);

$baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
$accountId = 4107111111;
$amount = 1.5;
$currency = "EUR";
$reference = "123456789";
$paymentType = 8;
$paymentRequestId = 555;
        
$secretKey = "123456";
$sigData = sprintf("%d/%s/%s/%s/%d/%d", $accountId, number_format($amount, 2, '.', ''), $currency, $reference, $paymentType, $paymentRequestId);
$signature = GetSignature($secretKey, $sigData);

$url = sprintf(
    "%s?AccountId=%d&Amount=%s&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&PaymentRequestId=%s", 
    $baseUrl, $accountId, number_format($amount, 2, '.', ''), $currency, urlencode($reference), $signature, $paymentType, $paymentRequestId);
header("Location: $url");
exit();

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

String  baseUrl = "https://amapi.trustpay.eu/mapi5/Card/PayPopup";
long accountId = 4107111111;
double amount = 1.5d;
String  currency = "EUR";
String  reference = "123456789";
int paymentType = 8;
int paymentRequestId = 555;

try
{
    String secretKey = "123456";
    String sigData = String.format(Locale.ROOT, "%d/%.2f/%s/%s/%d/%d", accountId, amount, currency, reference, paymentType, paymentRequestId);
    String signature = GetSignature(secretKey, sigData);

    String url = String.format(
        Locale.ROOT,"%s?AccountId=%d&Amount=%.2f&Currency=%s&Reference=%s&Signature=%s&PaymentType=%d&PaymentRequestId=%s", 
        baseUrl, accountId, amount, currency, URLEncoder.encode(reference, "UTF-8"), signature, paymentType, paymentRequestId);
    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
PaymentType Payment type
For refund must be set to 8
Numeric(1) Yes
PaymentRequestId Payment request ID from notification Numeric(10) Yes
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Reference, PaymentType and PaymentRequestId parameters, if these parameters are present. Slash character ('/') is used as separator. Char(64) Yes

Body of HTTP response will contain a result code (see example response to the right).

Example response:

{
    'ResultCode':0,
    'AcquirerResponseId':'000.000.000'
}

Payment result v02

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?Reference=1234567890&ResultCode=0&AcquirerResponseId=000.100.110&PaymentRequestId=4337417657
Name Description Format
Reference Reference (merchant’s payment identification) Varchar(35)
ResultCode Result code Numeric(4)
AcquirerResponseId Card acquirer result code Varchar(128)
PaymentRequestId Payment request ID (sent when available, can be used for inquiries regarding failed payments) Numeric(10)

SEPA Direct Debits

Prepare mandate v01

API endpoints:
Live - https://mapiservice.trustpay.eu/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://mapiservice.trustpay.eu/api/DirectDebit/PrepareMandate";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/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 = "test123",
         ReturnUrls = new
         {
            MandateNotificationUrl = "https://somedomain.eu/notification_handler",
            Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["PreparedMandateUrl"];
   }
}

function PrepareMandate($token)
{
   $url = 'https://mapiservice.trustpay.eu/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' => 'https://somedomain.eu/notification_handler',
         'Notification' => 'https://somedomain.eu/notification_handler',
      ),
   );  
   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['PreparedMandateUrl'];
}

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

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

public String PrepareMandate(String token){
    try{
        URL obj = new URL("https://mapiservice.trustpay.eu/api/DirectDebit/PrepareMandate");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public boolean PayNow = true;
            public 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 = 4107058607;
            };
            public Byte ReducedPeriod = null;
            public String EndToEnd = "test";
            public String RemittanceInformation = "test";
            public Object ReturnURLs = new Object(){
                public String MandateNotificationUrl = "https://somedomain.eu/notification_handler";
                public String NotificationUrl = "https://somedomain.eu/notification_handler";
            };
        };

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

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

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

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return deserialized.get("PreparedMandateUrl");
    }
    catch(Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PayNow Create first direct debit together with the mandate Boolean Yes
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
RemittanceInformation Remittance advice Varchar(35) No
ReturnUrls Return URLs Request/ReturnUrls No

Request/Merchant

Name Description Format Required
Account Merchant account or project ID (ID of account or project assigned by TrustPay) 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://mapiservice.trustpay.eu/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 v01

API endpoints:
Live - https://mapiservice.trustpay.eu/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://mapiservice.trustpay.eu/api/DirectDebit/CancelMandate";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         Umr = "12345678901234567890"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

function CancelMandate($token)
{
   $url = 'https://mapiservice.trustpay.eu/api/DirectDebit/CancelMandate';
   $data = array('Umr' => '12345678901234567890'); 

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

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

Response

Response example:
{}
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 v01

API endpoints:
Live - https://mapiservice.trustpay.eu/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://mapiservice.trustpay.eu/api/DirectDebit/CapturePayment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/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 = "test123",
         ReturnUrls = new
         {
            Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["DirectDebitId"];
   }
}

function CapturePayment($token)
{
   $url = 'https://mapiservice.trustpay.eu/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' => 'https://somedomain.eu/notification_handler',
      ),
      );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['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://mapiservice.trustpay.eu/api/DirectDebit/CapturePayment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String Umr = "12345678901234567890";
            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 RemittanceInformation = "test";
            public Object ReturnURLs = new Object() {
                public String NotificationUrl = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

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

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

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("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 Varchar(35) 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
RemittanceInformation Remittance advice Varchar(35) No
ReturnUrls Return URLs Request/ReturnUrls No

Request/Merchant

Name Description Format Required
Account Merchant account or project ID (ID of account or project assigned by TrustPay) 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)

Capture payment with external mandate v01

API endpoints:
Live - https://mapiservice.trustpay.eu/api/DirectDebit/CapturePaymentWithExternalMandate

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

Request

Capture payment example:

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

public int CapturePayment(string token)
{
   string url = "https://mapiservice.trustpay.eu/api/DirectDebit/CapturePaymentWithExternalMandate";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         Umr = "12345678901234567890",
         RequestedDueDate = "2017-07-28",
         Amount = 1.50,
         Currency = "EUR",
         Reference = "Order #12345",
         Merchant = new
         {
            Account = 1234567890
         },
         EndToEnd = "e2e",
         RemittanceInformation = "test123",
         ReturnUrls = new
         {
            Notification = "https://somedomain.eu/notification_handler"
         },
         DebtorName = "John Doe",
         DebtorAddress = "Street 1/A",
         DebtorPostalCode = "12345",
         DebtorCity = "Bratislava",
         DebtorCountry = "SK",
         DebtorBic = "TPAYSKBX",
         DebtorIban = "SK3112000000198742637541",
         SignatureDate = "2020-06-01",
         SignatureCity = "Bratislava",
         SequenceType = "FRST",
         DebtorEmail = "client@somedomain.eu",
         DebtorIpAddress = "1.2.3.4"
      };

      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://mapiservice.trustpay.eu/api/DirectDebit/CapturePaymentWithExternalMandate';
   $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' => 'https://somedomain.eu/notification_handler',
      ),
      'DebtorName' => 'John Doe',
      'DebtorAddress' => 'Street 1/A',
      'DebtorPostalCode' => '12345',
      'DebtorCity' => 'Bratislava',
      'DebtorCountry' => 'SK',
      'DebtorBic' => 'TPAYSKBX',
      'DebtorIban' => 'SK3112000000198742637541',
      'SignatureDate' => '2020-06-01',
      'SignatureCity' => 'Bratislava',
      'SequenceType' => 'FRST',
      'DebtorEmail' => 'client@somedomain.eu',
      'DebtorIpAddress' => '1.2.3.4'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['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://mapiservice.trustpay.eu/api/DirectDebit/CapturePaymentWithExternalMandate");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String Umr = "12345678901234567890";
            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 RemittanceInformation = "test";
            public Object ReturnURLs = new Object() {
                public String NotificationUrl = "https://somedomain.eu/notification_handler";
            };
            public String DebtorName = "John Doe";
            public String DebtorAddress = "Street 1/A";
            public String DebtorPostalCode = "12345";
            public String DebtorCity = "Bratislava";
            public String DebtorCountry = "SK";
            public String DebtorBic = "TPAYSKBX";
            public String DebtorIban = "SK3112000000198742637541";
            public String SignatureDate = "2020-06-01";
            public String SignatureCity = "Bratislava";
            public String SequenceType = "FRST";
            public String DebtorEmail = "client@somedomain.eu";
            public String DebtorIpAddress = "1.2.3.4";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

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

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

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("DirectDebitId"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
DebtorName Debtor's name Varchar(70) Yes
DebtorAddress Debtor's address Varchar(70) Yes
DebtorPostalCode Debtor's postal code Varchar(16) Yes
DebtorCity Debtor's city Varchar(35) Yes
DebtorCountry Debtor's country Char(2) Yes
DebtorBic Debtor's BIC code Varchar(11) No
DebtorIban Debtor's IBAN Varchar(34) Yes
SignatureDate Signature date of the mandate Varchar(10) Yes
SignatureCity Signature city of the mandate Varhar(35) Yes
SequenceType Type of direct debit payment:
FRST - First payment
FNAL - Final payment payment
RCUR - Recurrent payment
OOFF - One-off payment
Char(4) Yes
DebtorEmail Debtor's email address Varhar(320) No
DebtorIpAddress Debtor's IP address Varhar(15) No

Cancel direct debit v01

API endpoints:
Live - https://mapiservice.trustpay.eu/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://mapiservice.trustpay.eu/api/DirectDebit/CancelDirectDebit";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/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://mapiservice.trustpay.eu/api/DirectDebit/CancelDirectDebit';
   $data = array(
      'Umr' => '12345678901234567890',
      'DirectDebitId' => '1',
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = file_get_contents($url, false, $context);
   if ($response == "{}"){
      return null;
   }
   throw new Exception(json_decode($response, true)['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://mapiservice.trustpay.eu/api/DirectDebit/CancelDirectDebit"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-type", "application/json"); Object request = new Object() { public String Umr = "12345678901234567890"; public String DirectDebitId = "1"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } System.out.println(response); Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized.get("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)

Cancel direct debit with external mandate v01

API endpoints:
Live - https://mapiservice.trustpay.eu/api/DirectDebit/CancelDirectDebitWithExternalMandate

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://mapiservice.trustpay.eu/api/DirectDebit/CancelDirectDebitWithExternalMandate";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         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://mapiservice.trustpay.eu/api/DirectDebit/CancelDirectDebitWithExternalMandate';
   $data = array(
      'DirectDebitId' => '1',
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = file_get_contents($url, false, $context);
   if ($response == "{}"){
      return null;
   }
   throw new Exception(json_decode($response, true)['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://mapiservice.trustpay.eu/api/DirectDebit/CancelDirectDebitWithExternalMandate"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-type", "application/json"); Object request = new Object() { public String DirectDebitId = "1"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } System.out.println(response); Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized.get("ErrorMessage"); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) 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)

Account management

API Banking

Get account list v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/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: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response;
}

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", "application/json"); Object request = new Object(); ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized; } catch(Exception ex){ throw new RuntimeException(ex.getMessage()); } }

Response

Response example:
{
    "AccountList": [
        {
            "AccountId": 4107347927,
            "IBAN": "SK1099520000004107347927",
            "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": 4107138076,
            "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 TrustPay 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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/json"
      };
      var request = new
      {
         AccountId = "4107000000"
      };

      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' => '4107000000'); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context));
   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", "application/json"); Object request = new Object() { public long AccountId = "4107000000"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized; } 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 TrustPay) Numeric(10) Yes

Response

Response example:
{
    "AccountDetails": {
        "AccountId": 4107347927,
        "IBAN": "SK1099520000004107347927",
        "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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/json"
      };
      var request = new
      {
          Filter = new
          {
              AccountId = 4107000000,
              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' = 4107000000,
                '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: application/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", "application/json"); Object request = new Object() { public Object Filter = new Object() { public long AccountId = 4107000000; 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); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized; } 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 TrustPay) 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 TrustPay Transaction ID Numeric(10) No
PaymentId TrustPay Payment ID Numeric(10) No
OrderId TrustPay 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(3) 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 TrustPay Transaction ID (unique ID used for any enquiries)
PaymentId Payment ID TrustPay Payment ID
OrderId Order ID TrustPay 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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/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: application/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", "application/json"); Object request = new Object() { public long TransactionId = "123456789"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized; } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
TransactionId TrustPay Transaction ID (unique ID used for any enquiries) Numeric(10) No1
PaymentId TrustPay Paymnet ID Numeric(10) No1
OrderId TrustPay 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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/json"
      };
      var request = new
      {
         Filter = new {
            AccountId = 4107000000,
            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' = 4107000000,
                'DateFrom' = '2017-08-01',
                'DateTo' = '2017-09-01',
                'FileFormat' = 'Csv'
            )); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context));
   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", "application/json"); Object request = new Object() { public Object Filter = new Object() { public long AccountId = 4107000000; 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); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return String.valueOf(deserialized.get("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 TrustPay) 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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/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: application/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", "application/json"); Object request = new Object() { public String Xml = "..."; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return String.valueOf(deserialized.get("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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/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: application/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", "application/json"); Object request = new Object() { public String Xml = "..."; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return String.valueOf(deserialized.get("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)

Get order details v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - https://api.trustpay.eu/ApiBanking/GetOrderDetails

Gets details of order identified by its ID.

Request

Get order details example:

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

public dynamic GetOrderDetails(string token)
{
   string url = "https://api.trustpay.eu/ApiBanking/GetOrderDetails";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         OrderId = "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 GetOrderDetails($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/GetTransactionDetails';
   $data = array('OrderId' => '123456789'); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context));
   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> GetOrderDetails(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", "application/json"); Object request = new Object() { public long OrderId = "123456789"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized; } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
OrderId TrustPay Order ID Numeric(10) Yes

Response

Response example:

    {
        "OrderDetail": {
            "Amount": 3.34,
            "Created": "2020-01-08T06:42:50.0076915Z",
            "Currency": "EUR",
            "DestinationAccount": "SK3299520000002107058180",
            "SourceAccount": "2107734580",
            "State": "Processed"
    },
        "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 order Response/OrderDetails
Xml Xml order (urn:iso:std:iso:20022:tech:xsd:pain.001.001.05) Varchar(MAX)

Order Details

Name Description Format
Amount Order's amount Numeric(10)
Created Date of order creation UTC, ISO 8601 standard, sortable format - "yyyy'-'MM'-'dd'T'HH':'mm':'ss"
Currency Order's currency Varchar(3)
DestinationAccount Destination Account Varchar(34)
SourceAccount TrustPay Account Number Numeric(10)
State State of order OrderState

Order State

States
Waiting
Ready
Rejected
Error
Processed
Blocked
Refused
Reversed
WaitingForApprove
Reserved
Deleted
Canceled
Processing

Refund payment v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/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: application/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", "application/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); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return String.valueOf(deserialized.get("OrderId")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentId TrustPay 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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/json"
      };
      var request = new
      {
         AccountId = 4107000544,
         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' = 4107000544,
                 'ClientReference' = 'REF_123456'
           ); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context));
   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", "application/json"); Object request = new Object() { public long AccountId = 4107000544; public String ClientReference = "REF_123456"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return String.valueOf(deserialized.get("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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/json"
      };
      var request = new
      {
          Filter = new
          {
              AccountId = 4107000544,
              ClientReference = "REF_123456"
          },
          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 GetVirtualAccountList($token)
{
   $url = 'https://api.trustpay.eu/ApiBanking/GetVirtualIbanAccountList';
   $data = array(
            'Filter' => array(
                'AccountId' = 4107000544,
                'ClientReference' = 'REF_123456'
            ),
            'Paging' => array(
                'Page' = 0,
                'PageSize' = 10
            )
        ); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context));
   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", "application/json"); Object request = new Object() { public Object Filter = new Object() { public long AccountId = 4107000544; public String ClientReference = "REF_123456"; }; 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); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized; } 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(3) 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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/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: application/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", "application/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); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } 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 v01

API endpoints:
Live (if you have access to TrustPay Internet Banking) - 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: application/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: application/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", "application/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); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } 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.

OAuth

Getting access token v01

Direct debit API endpoints:
Live (if you have access to TrustPay Internet Banking) - https://mapiservice.trustpay.eu/api/oauth2/token
API banking endpoints:
Live (if you have access to TrustPay Internet Banking) - 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://mapiservice.trustpay.eu/api/oauth2/token";
      string userName = "test";
      string password = "test";
      string auth = $"Basic {Convert.ToBase64String(Encoding.UTF8.GetBytes($"{userName}:{password}"))}";
      client.Headers = new WebHeaderCollection
      {
         "Authorization:" + auth,
         "Content-Type: application/x-www-form-urlencoded"
      };

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

$url = 'https://mapiservice.trustpay.eu/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(){ HttpsURLConnection con = null; try { URL obj = new URL("https://mapiservice.trustpay.eu/api/oauth2/token"); con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); String username = "abcdef"; String password = "123abc"; String encoded = "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()); con.setRequestProperty("Authorization", encoded); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes("grant_type=client_credentials"); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } ObjectMapper JsonParser = new ObjectMapper(); Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized.get("access_token"); } catch(Exception ex){ throw new RuntimeException(ex.getMessage()); } finally { if(con != null) { con.disconnect(); } } }
Name Description Format Required
username Merchants username Varchar(256) Yes
password Merchants password Varchar(256) Yes

Response

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

Signature

Creating a secret key

For live environment, a different secret key is automatically generated for every merchant account. You can view this secret key in your TrustPay Merchant Portal in Technical settings. 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 TrustPay.

Verification of a signature v02

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






























Payment notifications

Wire notification v02

For each announced, authorized, or successfully finished payment on the merchant’s account, TrustPay 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?AccountId=4107111111&Type=CRDT&Amount=6.00&Currency=EUR&ResultCode=0&PaymentId=177561&Reference=1234567890&CounterAccount=SK3399520000002107425307&CounterAccountName=TestAccount&Signature=C4FFA5F7B57A0F5E6DD105197C8B7D7B9214509F3618CDC0F527C9B4E57F0334
Payment E-mail notification example:

{
    "AccountId":4107111111,
    "Type":"CRDT",
    "Amount":6.00,
    "Currency":"EUR",
    "Reference":"1234567890",
    "ResultCode":0,
    "PaymentId":"177561",
    "Signature":"C4FFA5F7B57A0F5E6DD105197C8B7D7B9214509F3618CDC0F527C9B4E57F0334",
    "CounterAccount":"SK3399520000002107425307",
    "CounterAccountName":"TestAccount"
}
Name Description Format
AccountId Merchant account or project ID (ID of account or project assigned by TrustPay) Numeric(10)
Type Type of transaction (CRDT or DBIT) Char(4)
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2), en-US format
Currency Currency of the payment (same as currency of merchant account) Char(3)
Reference1 Reference (merchant’s payment identification) Varchar(35)
ResultCode Result code Numeric(4)
PaymentId Payment ID Numeric(10)
OrderId1 TrustPay Order ID (ID of payment order) Numeric(10)
CounterAccount1 Counter account Varchar(34)
CounterAccountName1 Counter account name Varchar(140)
RefuseReason1 Refuse reason Varchar(4)
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Type, ResultCode, CounterAccount, CounterAccountName, OrderId, PaymentId, Reference and RefuseReason parameters, if these parameters are present. Slash character ('/') is used as separator. Char(64)

1 These parameters might not be present depending on the request and/or payment gateway used.

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

Card notification v02

Payment URL notification example:
https://example.handler.com/result.php?AccountId=4107111111&Type=CRDT&Amount=6.00&Currency=EUR&Reference=1234567890&ResultCode=0&PaymentRequestId=177561&Signature=C4FFA5F7B57A0F5E6DD105197C8B7D7B9214509F3618CDC0F527C9B4E57F0334&CardId=8a8294495c589aa3015c63bd6d237e46&CardMask=0162&CardExpiration=1020&AuthNumber=198159
Payment E-mail notification example:

{
    "AccountId":"4107111111",
    "Type":"CRDT",
    "Amount":"6.00",
    "Currency":"EUR",
    "PaymentRequestId":"177561",
    "CardId":"8a8294495c589aa3015c63bd6d237e46",
    "CardMask":"0162",
    "CardExpiration":"1020",
    "AuthNumber":"198159",
    "Signature":"51541600BDED4230304D5E20DB96730181E7C34886DF00D82650C6F0C28424A2",
    "ResultCode":"3",
    "Reference":"1234567890"
}

Card URL and e-mail notifications contain following parameters:

Name Description Format
AccountId Merchant account or project ID (ID of account or project assigned by TrustPay) Numeric(10)
Type Type of transaction (CRDT or DBIT) Char(4)
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2), en-US format
Currency Currency of the payment (same as currency of merchant account) Char(3)
Reference Reference (merchant’s payment identification) Varchar(35)
ResultCode Result code Numeric(4)
PaymentRequestId Payment request ID (sent when available, can be used for inquiries regarding failed payments) Numeric(10)
Signature Data signature calculated from concatenated values of AccountId, Amount, Currency, Reference, Type, ResultCode, PaymentRequestId, CardId, CardMask, CardExpiration and AuthNumber parameters, if these parameters are present. Slash character ('/') is used as separator. Char(64)
CardId1 Card ID. This can be used to make card-on-file payments Varchar(64)
CardMask1 Masked card number or last 4 digits of the card Varchar(19)
CardExpiration1 Card expiration in MMYY format Number(4)
AuthNumber1 Authorization number Varchar(7)

1 These parameters might not be present depending on the request.

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
enEnglishYesYes
skSlovakYesYes
csCzechYesYes
bgBulgarianNoYes
hrCroatianNoYes
daDanishNoYes
nlDutchNoYes
etEstonianNoYes
fiFinnishNoYes
frFrenchNoYes
deGermanNoYes
elGreekNoYes
huHungarianNoYes
itItalianNoYes
jaJapaneseNoYes
lvLatvianNoYes
ltLithuanianNoYes
nbNorwegian BokmålNoYes
plPolishNoYes
ptPortugueseNoYes
roRomanianNoYes
ruRussianNoYes
slSloveneNoYes
esSpanishNoYes
svSwedishNoYes
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 TrustPay 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, no further notification will be sent and 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
6 Refused Direct debit was refused. 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 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 TrustPay 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 or gateway. client redirects
1015 Declined by risk Transaction was rejected by risk department. client redirects, API responses
1100 General Error Internal error has occurred. Please contact TrustPay to resolve this issue. client redirects, API responses
1101 Unsupported currency conversion Currency conversion for requested currencies is not supported. client redirects

Refuse reasons

Code Definition
AC01 Account Identifier incorrect
AC04 Account closed
AC06 Account blocked
AC13 Invalid debtor account type
AG01 Transaction forbidden on this type of account
AG02 Payment transaction code incorrect
AM04 Insufficient funds
AM05 Duplicate collection
BE05 Identifier of the Creditor Incorrect
CNOR Creditor Bank is not registered under this BIC in CSM
DNOR Debtor Bank is not registered under this BIC in CSM
FF01 File format incomplete or invalid
MD01 No mandate or unable to obtain mandate confirmation from the Debtor
MD02 Mandate data missing or incorrect
MD07 Debtor deceased
MS02 Refusal by the Debtor
MS03 Reason not specified, contact the Debtor
RC01 Bank Identifier (BIC) incorrect
RR01 Missing Debtor account or identification
RR02 Missing Debtor name/address
RR03 Missing Creditor name/address
RR04 Regulatory Reason
SL01 Due to specific service offered by the Debtor Bank
B15 Technical issue

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

Payment type

Code Description
0 Purchase
1 Card on file - Register
2 Card on file - Purchase
3 Recurring - Initial payment
4 Recurring - Subsequent payment
5 Preauthorization
6 Capture
9 Card on file - Preauthorization
8 Refund

API update 2020 - SCA

What is SCA?

Strong Customer Authentication (SCA), as part of the Payment Services Directive (PSD2) in the European Economic Area, requires changes to customer authentication of online payments. In order to increase the security of online payments, a new version of customer verification will be required.

What SCA means for you?

TrustPay amended its payments gateway to meet the new regulatory requirements of SCA in a way that will require as few changes from the merchant´s side as possible. You will be required to send us some additional information about your customer in the payment requests for card payments and the rest will be done by TrustPay.

What changes do you have to make in your integration?

You have to send us the following additional fields in your payment requests for card payments:

Name Description Format
CardHolder The cardholder name (at least 3 characters) Varchar(100)
BillingStreet The street name and number of customer's billing address Varchar(100)
BillingCity The town, district or city of customer's billing address Varchar(80)
BillingPostcode The postal code or zip code of customer's billing address Varchar(30)1
BillingCountry The country of customer's billing address Char(2)
Email Customer email Varchar(254)

1 Only alphanumeric characters are allowed. Other characters may be lost or changed during payment process.

For more information please check this section of our integration manual: Cards

What is the deadline to update the integration?

You should ensure that your systems will comply with the above-mentioned changes by October 1st,2020. If you fail to update your integration, your transactions missing the new mandatory elements may be rejected by the issuing banks.

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.