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

General

Overview

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

OAuth

Getting access token

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

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

Request

Obtain token example:

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

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

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


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

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

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

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

Response

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

Callback Urls

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

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

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

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

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

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

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

Code lists

Supported currencies

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

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

Supported languages

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

Code Language Supported Payment Methods
enEnglishAll payment methods
skSlovakCard Payments, Instant Bank Transfer, Instant Bank Transfer(PL), SEPA Direct Debit, SEPA Credit Transfer, IDeal, MyBank, Blik, Satispay, AircashPay, WeChatPay, Payconiq, OpenBanking
bgBulgarianCard Payments
csCzechCard Payments, Instant Bank Transfer, SEPA Direct Debit, IDeal, MyBank, SEPA Credit Transfer
hrCroatianCard Payments, Aircash
daDanishCard Payments
nlDutchCard Payments, SEPA Direct Debit, IDeal
etEstonianCard Payments
fiFinnishCard Payments, Instant Bank Transfer (FI)
frFrenchCard Payments, SEPA Direct Debit, IDeal, MyBank
deGermanCard Payments, SEPA Direct Debit, IDeal, MyBank, OpenBanking
elGreekCard Payments
huHungarianCard Payments
itItalianCard Payments, SEPA Direct Debit, MyBank
jaJapaneseCard Payments
lvLatvianCard Payments
ltLithuanianCard Payments
nbNorwegian, BokmålCard Payments
plPolishCard Payments, Instant Bank Transfer(PL), Blik
ptPortugueseCard Payments, Multibanco, MbWay
roRomanianCard Payments
ruRussianCard Payments
slSloveneCard Payments
esSpanishCard Payments, SEPA Direct Debit, MyBank
svSwedishCard Payments, Instant Bank Transfer (FI)
ukUkrainianCard Payments

Result codes

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

The list of Result codes

ResultCode Description
1001000Success
1092002TooManyTransactions. Change the request to select less transactions.
1112002AlreadyCanceledReversed
1112003CancelReversalAlreadyProcessing
1112004CutoffTimeExceeded
1112005CancelReversalNotAllowed
1112008InvalidPaymentState
1112009RefundRejected
1122006AccountCurrencyNotAllowed
1130000MapiSuccess
1130001MapiPending
1130002MapiAnnounced
1130003MapiAuthorized
1130004MapiProcessing
1130005MapiAuthorizedOnly
1132000InvalidMapiRequest
1132001UnknownAccount
1132002MerchantAccountDisabled
1132003InvalidSign
1132004DisposableBalance
1132005TransactionNotFound
1132006UnsupportedTransaction
1132007GeneralMapiError
1132008UnsupportedCurrencyConversion
1132009UnknownMandate
1132010CanceledMandate
1132011MissingCid
1132012MandateAlreadyPaid
1132013AccountIsTesting
1132014RequestThrottled
1133000InvalidAuthentication
1133001ServiceNotAllowed
1133002PaymentRequestNotFound
1133003UnexpectedGateway
1133004MissingExternalId
1133005ApiDomainNotAllowed
1152000RiskDecline

Reason codes

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

The list of Reason codes

CodeDescription
000.000.000Transaction succeeded
000.000.100Successful request
000.100.105Chargeback Representment is successful
000.100.106Chargeback Representment cancellation is successful
000.100.110Request successfully processed in 'Merchant in Integrator Test Mode'
000.100.111Request successfully processed in 'Merchant in Validator Test Mode'
000.100.112Request successfully processed in 'Merchant in Connector Test Mode'
000.100.200Reason not Specified
000.100.201Account or Bank Details Incorrect
000.100.202Account Closed
000.100.203Insufficient Funds
000.100.204Mandate not Valid
000.100.205Mandate Cancelled
000.100.206Revocation or Dispute
000.100.207Cancellation in Clearing Network
000.100.208Account Blocked
000.100.209Account does not exist
000.100.210Invalid Amount
000.100.211Transaction succeeded (amount of transaction is smaller then amount of pre-authorization)
000.100.212Transaction succeeded (amount of transaction is greater then amount of pre-authorization)
000.100.220Fraudulent Transaction
000.100.221Merchandise Not Received
000.100.222Transaction Not Recognized By Cardholder
000.100.223Service Not Rendered
000.100.224Duplicate Processing
000.100.225Credit Not Processed
000.100.226Cannot be settled
000.100.227Configuration Issue
000.100.228Temporary Communication Error - Retry
000.100.229Incorrect Instructions
000.100.230Unauthorised Charge
000.100.231Late Representment
000.100.232Liability Shift
000.100.233Authorization-Related Chargeback
000.100.234Non receipt of merchandise
000.100.299Unspecified (Technical)
000.200.000Transaction pending
000.200.001Transaction pending for acquirer, the consumer is not present
000.200.100Successfully created checkout
000.200.101Successfully updated checkout
000.200.102Successfully deleted checkout
000.200.103Checkout is pending
000.200.200Transaction initialized
000.200.201QR Scanned/Link Clicked, waiting for the final authentication result
000.300.000Two-step transaction succeeded
000.300.100Risk check successful
000.300.101Risk bank account check successful
000.300.102Risk report successful
000.300.103Exemption check successful
000.310.100Account updated
000.310.101Account updated (Credit card expired)
000.310.110No updates found, but account is valid
000.400.000Transaction succeeded (please review manually due to fraud suspicion)
000.400.010Transaction succeeded (please review manually due to AVS return code)
000.400.020Transaction succeeded (please review manually due to CVV return code)
000.400.030Transaction partially failed (please reverse manually due to failed automatic reversal)
000.400.040Transaction succeeded (please review manually due to amount mismatch)
000.400.050Transaction succeeded (please review manually because transaction is pending)
000.400.060Transaction succeeded (approved at merchant's risk)
000.400.070Transaction succeeded (waiting for external risk review)
000.400.080Transaction succeeded (please review manually because the service was unavailable)
000.400.081Transaction succeeded (please review manually, as the risk status not available yet due network timeout)
000.400.082Transaction succeeded (please review manually, as the risk status not available yet due processing timeout)
000.400.090Transaction succeeded (please review manually due to external risk check)
000.400.100Transaction succeeded, risk after payment rejected
000.400.101Card not participating/authentication unavailable
000.400.102User not enrolled
000.400.103Technical Error in 3D system
000.400.104Missing or malformed 3DSecure Configuration for Channel
000.400.105Unsupported User Device - Authentication not possible
000.400.106Invalid payer authentication response(PARes) in 3DSecure Transaction
000.400.107Communication Error to Scheme Directory Server
000.400.108Cardholder Not Found - card number provided is not found in the ranges of the issuer
000.400.109Card is not enrolled for 3DS version 2
000.400.110Authentication successful (frictionless flow)
000.400.111Data Only request failed
000.400.1123RI transaction not permitted
000.400.120Authentication successful (data only flow)
000.400.200Risk management check communication error
000.500.000Transaction succeeded - very good rating
000.500.100Transaction succeeded (address corrected)
000.600.000Transaction succeeded due to external update
100.100.100Request contains no creditcard, bank account number or bank name
100.100.101Invalid creditcard, bank account number or bank name
100.100.104Invalid unique id / root unique id
100.100.200Request contains no month
100.100.201Invalid month
100.100.300Request contains no year
100.100.301Invalid year
100.100.303Card expired
100.100.304Card not yet valid
100.100.305Invalid expiration date format
100.100.400Request contains no cc/bank account holder
100.100.401Cc/bank account holder too short or too long
100.100.402Cc/bank account holder not valid
100.100.500Request contains no credit card brand
100.100.501Invalid credit card brand
100.100.600Empty CVV for VISA, MASTER, AMEX not allowed
100.100.601Invalid CVV/brand combination
100.100.650Empty CreditCardIssueNumber for MAESTRO not allowed
100.100.651Invalid CreditCardIssueNumber
100.100.700Invalid cc number/brand combination
100.100.701Blacklist Validation (50) suspecting fraud, this card may not be processed
100.150.100Request contains no Account data and no registration id
100.150.101Invalid length for specified registration id (must be 32 chars)
100.150.200Registration does not exist
100.150.201Registration is not confirmed yet
100.150.202Registration is already deregistered
100.150.203Registration is not valid, probably initially rejected
100.150.204Account registration reference pointed to no registration transaction
100.150.205Referenced registration does not contain an account
100.150.300Payment only allowed with valid initial registration
100.200.100Bank account contains no or invalid country
100.200.103Bank account has invalid bankcode/name account number combination
100.200.104Bank account has invalid acccount number format
100.200.200Bank account needs to be registered and confirmed first. Country is mandate based.
100.210.101Virtual account contains no or invalid Id
100.210.102Virtual account contains no or invalid brand
100.211.101User account contains no or invalid Id
100.211.102User account contains no or invalid brand
100.211.103No password defined for user account
100.211.104Password does not meet safety requirements (needs 8 digits at least and must contain letters and numbers)
100.211.105Wallet id has to be a valid email address
100.211.106Voucher ids have 32 digits always
100.212.101Wallet account registration must not have an initial balance
100.212.102Wallet account contains no or invalid brand
100.212.103Wallet account payment transaction needs to reference a registration
100.250.100Job contains no execution information
100.250.105Invalid or missing action type
100.250.106Invalid or missing duration unit
100.250.107Invalid or missing notice unit
100.250.110Missing job execution
100.250.111Missing job expression
100.250.120Invalid execution parameters, combination does not conform to standard
100.250.121Invalid execution parameters, hour must be between 0 and 23
100.250.122Invalid execution parameters, minute and seconds must be between 0 and 59
100.250.123Invalid execution parameters, Day of month must be between 1 and 31
100.250.124Invalid execution parameters, month must be between 1 and 12
100.250.125Invalid execution parameters, Day of week must be between 1 and 7
100.250.250Job tag missing
100.300.101Invalid test mode (please use LIVE or INTEGRATOR_TEST or CONNECTOR_TEST)
100.300.200Transaction id too long
100.300.300Invalid reference id
100.300.400Missing or invalid channel id
100.300.401Missing or invalid sender id
100.300.402Missing or invalid version
100.300.501Invalid response id
100.300.600Invalid or missing user login
100.300.601Invalid or missing user pwd
100.300.700Invalid relevance
100.300.701Invalid relevance for given payment type
100.310.401Account management type not supported
100.310.402Account management transaction not allowed in current state
100.350.100Referenced session is REJECTED (no action possible).
100.350.101Referenced session is CLOSED (no action possible)
100.350.200Undefined session state
100.350.201Referencing a registration through reference id is not applicable for this payment type
100.350.301Confirmation (CF) must be registered (RG) first
100.350.302Session already confirmed (CF)
100.350.303Cannot deregister (DR) unregistered account and/or customer
100.350.310Cannot confirm (CF) session via XML
100.350.311Cannot confirm (CF) on a registration passthrough channel
100.350.312Cannot do passthrough on non-internal connector
100.350.313Registration of this type has to provide confirmation url
100.350.314Customer could not be notified of pin to confirm registration (channel)
100.350.315Customer could not be notified of pin to confirm registration (sending failed)
100.350.316Cannot extend the token (TE) on unregistered account
100.350.400No or invalid PIN (email/SMS/MicroDeposit authentication) entered
100.350.500Unable to obtain personal (virtual) account - most likely no more accounts available
100.350.601Registration is not allowed to reference another transaction
100.350.602Registration is not allowed for recurring payment migration
100.360.201Unknown schedule type
100.360.300Cannot schedule(SD) unscheduled job
100.360.303Cannot deschedule(DS) unscheduled job
100.360.400Schedule module not configured for LIVE transaction mode
100.370.100Transaction declined
100.370.101ResponseUrl not set in Transaction/Frontend
100.370.102Malformed responseUrl in Transaction/Frontend
100.370.110Transaction must be executed for German address
100.370.111System error( possible incorrect/missing input data)
100.370.121No or unknown ECI Type defined in Authentication (100.370.121)
100.370.122Parameter with null key provided in 3DSecure Authentication
100.370.123No or unknown verification type defined in 3DSecure Authentication
100.370.124Unknown parameter key in 3DSecure Authentication
100.370.125Invalid 3DSecure Verification_ID. Must have Base64 encoding a Length of 28 digits
100.370.131No or unknown authentication type defined in Transaction/Authentication@type
100.370.132No result indicator defined Transaction/Authentication/resultIndicator
100.380.101Transaction contains no risk management part
100.380.201No risk management process type specified
100.380.305No frontend information provided for asynchronous transaction
100.380.306No authentication data provided in risk management transaction
100.380.401User authentication failed
100.380.501Risk management transaction timeout
100.390.101Purchase amount/currency mismatch
100.390.102PARes Validation failed
100.390.103PARes Validation failed - problem with signature
100.390.104XID mismatch
100.390.105Transaction rejected because of technical error in 3DSecure system
100.390.106Transaction rejected because of error in 3DSecure configuration
100.390.107Transaction rejected because cardholder authentication unavailable
100.390.108Transaction rejected, merchant not participating in 3DSecure program
100.390.109Transaction rejected because of VISA status 'U' or AMEX status 'N' or 'U' in 3DSecure program
100.390.110Cardholder Not Found - card number provided is not found in the ranges of the issuer
100.390.111Communication error to VISA/Mastercard Directory Server
100.390.112Technical Error in 3D system
100.390.113Unsupported user device - authentication not possible
100.390.114Not authenticated because the issuer is rejecting authentication
100.390.1153DS authentication failed due to invalid message format
100.390.1163DSecure Error, Access denied to the authentication system
100.390.1173DS authentication failed due to invalid data fields
100.390.1183DSecure Error (85) Authentication failed due to suspected fraud (100.390.118)
100.395.101Bank not supported for Giropay
100.395.102Account not enabled for Giropay e.g. test account
100.395.501Previously pending online transfer transaction timed out
100.395.502Acquirer/Bank reported timeout on online transfer transaction
100.396.101Cancelled by user
100.396.102Not confirmed by user
100.396.103Previously pending transaction timed out
100.396.104Uncertain status - probably cancelled by user
100.396.106User did not agree to payment method terms
100.396.201Cancelled by merchant
100.397.101Cancelled by user due to external update
100.397.102Rejected by connector/acquirer due to external update
100.400.000Transaction declined (Wrong Address)
100.400.001Transaction declined (Wrong Identification)
100.400.002Transaction declined (Insufficient credibility score)
100.400.005Transaction must be executed for German address
100.400.007System error ( possible incorrect/missing input data)
100.400.020Transaction declined
100.400.021Transaction declined for country
100.400.030Transaction not authorized. Please check manually
100.400.039Transaction declined for other error
100.400.040Authorization failure
100.400.041Transaction must be executed for German address
100.400.042Transaction declined by SCHUFA (Insufficient credibility score)
100.400.043Transaction declined because of missing obligatory parameter(s)
100.400.044Transaction not authorized. Please check manually
100.400.045SCHUFA result not definite. Please check manually
100.400.051SCHUFA system error (possible incorrect/missing input data)
100.400.060Authorization failure
100.400.061Transaction declined (Insufficient credibility score)
100.400.063Transaction declined because of missing obligatory parameter(s)
100.400.064Transaction must be executed for Austrian, German or Swiss address
100.400.065Result ambiguous. Please check manually
100.400.071System error (possible incorrect/missing input data)
100.400.080Authorization failure
100.400.081Transaction declined
100.400.083Transaction declined because of missing obligatory parameter(s)
100.400.084Transaction can not be executed for given country
100.400.085Result ambiguous. Please check manually
100.400.086Transaction declined (Wrong Address)
100.400.087Transaction declined (Wrong Identification)
100.400.091System error (possible incorrect/missing input data)
100.400.100Transaction declined - very bad rating
100.400.120Authorization failure
100.400.121Account blacklisted
100.400.122Transaction must be executed for valid German account
100.400.123Transaction declined because of missing obligatory parameter(s)
100.400.130System error (possible incorrect/missing input data)
100.400.139System error (possible incorrect/missing input data)
100.400.140Transaction declined by GateKeeper
100.400.141Challenge by ReD Shield
100.400.142Deny by ReD Shield
100.400.143Noscore by ReD Shield
100.400.144ReD Shield data error
100.400.145ReD Shield connection error
100.400.146Line item error by ReD Shield
100.400.147Payment void and transaction denied by ReD Shield
100.400.148Payment void and transaction challenged by ReD Shield
100.400.149Payment void and data error by ReD Shield
100.400.150Payment void and connection error by ReD Shield
100.400.151Payment void and line item error by ReD Shield
100.400.152Payment void and error returned by ReD Shield
100.400.241Challenged by Threat Metrix
100.400.242Denied by Threat Metrix
100.400.243Invalid sessionId
100.400.260Authorization failure
100.400.300Abort checkout process
100.400.301Reenter age/birthdate
100.400.302Reenter address (packstation not allowed)
100.400.303Reenter address
100.400.304Invalid input data
100.400.305Invalid foreign address
100.400.306Delivery address error
100.400.307Offer only secure methods of payment
100.400.308Offer only secure methods of payment; possibly abort checkout
100.400.309Confirm corrected address; if not confirmed, offer secure methods of payment only
100.400.310Confirm bank account data; if not confirmed, offer secure methods of payment only
100.400.311Transaction declined (format error)
100.400.312Transaction declined (invalid configuration data)
100.400.313Currency field is invalid or missing
100.400.314Amount invalid or empty
100.400.315Invalid or missing email address (probably invalid syntax)
100.400.316Transaction declined (card missing)
100.400.317Transaction declined (invalid card)
100.400.318Invalid IP number
100.400.319Transaction declined by risk system
100.400.320Shopping cart data invalid or missing
100.400.321Payment type invalid or missing
100.400.322Encryption method invalid or missing
100.400.323Certificate invalid or missing
100.400.324Error on the external risk system
100.400.325External risk system not available
100.400.326Risk bank account check unsuccessful
100.400.327Risk report unsuccessful
100.400.328Risk report unsuccessful (invalid data)
100.400.391System integrity reject - issuer will not approve
100.400.392System integrity reject - issuer would not approve at this time
100.400.393System integrity reject - revalidate payment information
100.400.394System integrity reject - transaction should not be resubmitted
100.400.395Transaction blacklisted - card scheme blacklisted
100.400.396Transaction blacklisted - card issuer's country under its scheme blacklisted
100.400.397The used card is blacklisted
100.400.500Waiting for external risk
100.500.101Payment method invalid
100.500.201Payment type invalid
100.500.301Invalid due date
100.500.302Invalid mandate date of signature
100.500.303Invalid mandate id
100.500.304Invalid mandate external id
100.550.300Request contains no amount or too low amount
100.550.301Amount too large
100.550.303Amount format invalid (only two decimals allowed).
100.550.310Amount exceeds limit for the registered account.
100.550.311Exceeding account balance
100.550.312Amount is outside allowed ticket size boundaries
100.550.400Request contains no currency
100.550.401Amount Error (35) invalid currency
100.550.601Risk amount too large
100.550.603Risk amount format invalid (only two decimals allowed)
100.550.605Risk amount is smaller than amount (it must be equal or bigger then amount)
100.550.701Amounts not matched
100.550.702Currencies not matched
100.560.121Invalid or blacklisted MCC
100.570.136Invalid card scheme transaction id for recurring payment without provider reference (length exceeded or invalid format)
100.570.140Zero amount subsequent PA/PU not allowed
100.600.500Usage field too long
100.700.100Customer.surname may not be null
100.700.101Customer.surname length must be between 0 and 50
100.700.200Customer.givenName may not be null
100.700.201Customer.givenName length must be between 0 and 50
100.700.300Invalid salutation
100.700.400Invalid title
100.700.500Company name too long
100.700.800Identity contains no or invalid 'paper'
100.700.801Identity contains no or invalid identification value
100.700.802Identification value too long
100.700.810Specify at least one identity
100.800.100Request contains no street
100.800.101The combination of street1 and street2 must not exceed 201 characters.
100.800.102The combination of street1 and street2 must not contain only numbers.
100.800.200Request contains no zip
100.800.201Zip too long
100.800.202Invalid zip
100.800.300Request contains no city
100.800.301City too long
100.800.302Invalid city
100.800.400Invalid state/country combination
100.800.401State too long
100.800.500Request contains no country
100.800.501Invalid country
100.900.100Request contains no email address
100.900.101Invalid email address (probably invalid syntax)
100.900.105Email address too long (max 50 chars)
100.900.200Invalid phone number (has to start with a digit or a '+', at least 7 and max 25 chars long)
100.900.300Invalid mobile phone number (has to start with a digit or a '+', at least 7 and max 25 chars long)
100.900.301Mobile phone number mandatory
100.900.400Request contains no ip number
100.900.401Invalid ip number
100.900.450Invalid birthdate
100.900.500Invalid recurrence mode
200.100.101Invalid Request Message. No valid XML. XML must be url-encoded! maybe it contains a not encoded ampersand or something similar.
200.100.102Invalid Request. XML load missing (XML string must be sent within parameter 'load')
200.100.103Invalid Request Message. The request contains structural errors
200.100.150Transaction of multirequest not processed because of subsequent problems
200.100.151Multi-request is allowed with a maximum of 10 transactions only
200.100.199Wrong Web Interface / URL used. Please check out the Tech Quick Start Doc Chapter 3.
200.100.201Invalid Request/Transaction tag (not present or [partially] empty)
200.100.300Invalid Request/Transaction/Payment tag (no or invalid code specified)
200.100.301Invalid Request/Transaction/Payment tag (not present or [partially] empty)
200.100.302Invalid Request/Transaction/Payment/Presentation tag (not present or [partially] empty)
200.100.401Invalid Request/Transaction/Account tag (not present or [partially] empty)
200.100.402Invalid Request/Transaction/Account(Customer, Relevance) tag (one of Account/Customer/Relevance must be present)
200.100.403Invalid Request/Transaction/Analysis tag (Criterions must have a name and value)
200.100.404Invalid Request/Transaction/Account (must not be present)
200.100.501Invalid or missing customer
200.100.502Invalid Request/Transaction/Customer/Name tag (not present or [partially] empty)
200.100.503Invalid Request/Transaction/Customer/Contact tag (not present or [partially] empty)
200.100.504Invalid Request/Transaction/Customer/Address tag (not present or [partially] empty)
200.100.601Invalid Request/Transaction/(ApplePay|GooglePay|SamsungPay) tag (not present or [partially] empty)
200.100.602Invalid Request/Transaction/(ApplePay|GooglePay|SamsungPay)/PaymentToken tag (not present or [partially] empty)
200.100.603Invalid Request/Transaction/(ApplePay|GooglePay|SamsungPay)/PaymentToken tag (decryption error)
200.200.106Duplicate transaction. Please verify that the UUID is unique
200.300.403Invalid HTTP method
200.300.404Invalid or missing parameter
200.300.405Duplicate entity
200.300.406Entity not found
200.300.407Entity not specific enough
300.100.100Transaction declined (additional customer authentication required)
400.001.002Authentication approved
400.001.003Authentication redirect is necessary
400.001.004Authentication attempted with proof
400.001.301Card not enrolled in supported 3DS versions
400.001.302Transaction was already handled
400.001.600Authentication error
400.001.601Authentication declined
400.001.602Invalid transaction
400.001.603Invalid RReq packet received
400.001.604Invalid transaction state
400.002.001Successfully processed the notification message
400.002.300Transaction already processed
400.002.600Error
400.003.001Successfully processed method data
400.003.600Error
400.004.001Successfully processed method data
400.004.600Error- description contains details but this indicates that the transaction ID was not found
400.100.003Timeout
400.100.004Transaction Rejected
400.100.005Canceled by Customer
400.100.006Canceled by Merchant
400.100.007Bank Offline
400.100.008General error
400.200.0013rd party MPI is not enabled
400.200.004Payment too old to be refunded
400.200.005The refund has already been processed
400.200.006The payment to be refunded does not exist
400.200.007Refund exceed deposit volume
400.200.008General refund error
400.200.009Refund currency does not match with payment currency
400.200.010Partial refund of preauthorization is not allowed
400.200.011Payment to be refunded has already been rejected
400.200.012Payment to be refunded has already been chargebacked
400.200.019Service not allowed
400.300.001Cross-site request forgery
400.300.004Invalid payment state
400.300.005Refund rejected
400.300.006Account currency not allowed
400.300.007Merchant account disabled
400.300.008Insufficient disposable balance
400.300.009Transaction not found
400.300.010Unsupported transaction
400.300.011General mapi error
400.300.012Unsupported currency conversion
400.300.013Unknown mandate
400.300.014Canceled mandate
400.300.015Missing CID
400.300.016Mandate already paid
400.300.017Account is testing
400.300.019Service not allowed
400.300.020Payment request not found
400.300.021Unexpected gateway
400.300.022Missing external ID
400.300.023Risk decline
400.300.024Processing ID Used
400.300.025Api domain not allowed
400.300.035General config error
400.390.151Non 3DS transactions forbidden
400.900.001Technical error
400.900.002Unpaid
500.100.201Channel/Merchant is disabled (no processing possible)
500.100.202Channel/Merchant is new (no processing possible yet)
500.100.203Channel/Merchant is closed (no processing possible)
500.100.301Merchant-Connector is disabled (no processing possible)
500.100.302Merchant-Connector is new (no processing possible yet)
500.100.303Merchant-Connector is closed (no processing possible)
500.100.304Merchant-Connector is disabled at gateway (no processing possible)
500.100.401Connector is unavailable (no processing possible)
500.100.402Connector is new (no processing possible yet)
500.100.403Connector is unavailable (no processing possible)
500.200.101No target account configured for DD transaction
600.100.100Unexpected Integrator Error (Request could not be processed)
600.200.100Invalid Payment Method
600.200.200Unsupported Payment Method
600.200.201Channel/Merchant not configured for this payment method
600.200.202Channel/Merchant not configured for this payment type
600.200.300Invalid Payment Type
600.200.310Invalid Payment Type for given Payment Method
600.200.400Unsupported Payment Type
600.200.500Invalid payment data. You are not configured for this currency or sub type (country or brand)
600.200.501Invalid payment data for Recurring transaction. Merchant or transaction data has wrong recurring configuration.
600.200.600Invalid payment code (type or method)
600.200.700Invalid payment mode (you are not configured for the requested transaction mode)
600.200.701TestMode not allowed
600.200.800Invalid brand for given payment method and payment mode (you are not configured for the requested transaction mode)
600.200.810Invalid return code provided
600.200.900Invalid Payment Request
600.300.101Merchant key not found
600.300.200Merchant source IP address not whitelisted
600.300.210Merchant notificationUrl not whitelisted
600.300.211ShopperResultUrl not whitelisted
700.100.100Reference id does not exist
700.100.200Non matching reference amount
700.100.300Invalid amount (probably too large)
700.100.400Referenced payment method does not match with requested payment method
700.100.500Referenced payment currency does not match with requested payment currency
700.100.600Referenced mode does not match with requested payment mode
700.100.700Referenced transaction is of inappropriate type
700.100.701Referenced a DB transaction without explicitly providing an account. Not allowed to used referenced account.
700.100.710Cross-linkage of two transaction-trees
700.300.100Referenced tx can not be refunded, captured or reversed (invalid type)
700.300.200Referenced tx was rejected
700.300.300Referenced transaction can not be refunded, captured or reversed
700.300.400Referenced tx can not be captured (cut off time reached)
700.300.500Chargeback error (multiple chargebacks)
700.300.600Referenced tx can not be refunded or reversed (was chargebacked)
700.300.700Referenced tx can not be reversed (reversal not possible anymore)
700.300.800Referenced tx can not be voided
700.400.000Serious workflow error (call support)
700.400.100Cannot capture
700.400.101Cannot capture (Not supported by authorization system)
700.400.200Cannot refund
700.400.300Cannot reverse (already refunded|reversed, invalid workflow or amount exceeded)
700.400.400Cannot chargeback (already chargebacked or invalid workflow?)
700.400.402Chargeback can only be generated internally by the payment system
700.400.410Cannot reversal chargeback (chargeback is already reversaled or invalid workflow?)
700.400.411Cannot reverse chargeback or invalid workflow (second chargeback)
700.400.420Cannot reversal chargeback (no chargeback existing or invalid workflow?)
700.400.510Capture needs at least one successful transaction of type (PA)
700.400.520Refund needs at least one successful transaction of type (CP or DB or RB or RC)
700.400.530Reversal needs at least one successful transaction of type (CP or DB or RB or PA)
700.400.540Reconceile needs at least one successful transaction of type (CP or DB or RB)
700.400.550Chargeback needs at least one successful transaction of type (CP or DB or RB)
700.400.560Receipt needs at least one successful transaction of type (PA or CP or DB or RB)
700.400.561Receipt on a registration needs a successfull registration in state 'OPEN'
700.400.562Receipts are configured to be generated only internally by the payment system
700.400.565Finalize needs at least one successful transaction of type (PA or DB)
700.400.570Cannot reference a waiting/pending transaction
700.400.580Cannot find transaction
700.400.590Installment needs at least one successful transaction of type (DB or PA)
700.400.600Finalize needs at least one successful transaction of type (IN, DB, PA or CD)
700.400.700Initial and referencing channel-ids do not match
700.450.001Cannot transfer money from one account to the same account
700.500.001Referenced session contains too many transactions
700.500.002Capture or preauthorization appears too late in referenced session
700.500.003Live transactions with test credit card numbers are rejected
700.500.004Cannot refer a transaction which contains deleted customer information
800.100.100Transaction declined for unknown reason
800.100.150Transaction declined (refund on gambling tx not allowed)
800.100.151Transaction declined (invalid card)
800.100.152Transaction declined by authorization system
800.100.153Transaction declined (invalid CVV)
800.100.154Transaction declined (transaction marked as invalid)
800.100.155Transaction declined (amount exceeds credit)
800.100.156Transaction declined (format error)
800.100.157Transaction declined (wrong expiry date)
800.100.158Transaction declined (suspecting manipulation)
800.100.159Authorization Error (95) transaction declined (stolen card) (800.100.159)
800.100.160Transaction declined (card blocked)
800.100.161Transaction declined (too many invalid tries)
800.100.162Transaction declined (limit exceeded)
800.100.163Transaction declined (maximum transaction frequency exceeded)
800.100.164Transaction declined (merchants limit exceeded)
800.100.165Transaction declined (card lost)
800.100.166Transaction declined (Incorrect personal identification number)
800.100.167Transaction declined (referencing transaction does not match)
800.100.168Transaction declined (restricted card)
800.100.169Transaction declined (card type is not processed by the authorization center)
800.100.170Transaction declined (transaction not permitted)
800.100.171Transaction declined (pick up card)
800.100.172Transaction declined (account blocked)
800.100.173Transaction declined (invalid currency, not processed by authorization center)
800.100.174Transaction declined (invalid amount)
800.100.175Transaction declined (invalid brand)
800.100.176Transaction declined (account temporarily not available. Please try again later)
800.100.177Transaction declined (amount field should not be empty)
800.100.178Transaction declined (PIN entered incorrectly too often)
800.100.179Transaction declined (exceeds withdrawal count limit)
800.100.190Transaction declined (invalid configuration data)
800.100.191Transaction declined (transaction in wrong state on aquirer side)
800.100.192Transaction declined (invalid CVV, Amount has still been reserved on the customer's card and will be released in a few business days. Please ensure the CVV code is accurate before retrying the transaction)
800.100.195Transaction declined (UserAccount Number/ID unknown)
800.100.196Transaction declined (registration error)
800.100.197Transaction declined (registration cancelled externally)
800.100.198Transaction declined (invalid holder)
800.100.199Transaction declined (invalid tax number)
800.100.200Refer to payer due to reason not specified
800.100.201Account or Bank Details Incorrect
800.100.202Account closed
800.100.203Insufficient funds
800.100.204Mandate Expired
800.100.205Mandate Discarded
800.100.206Refund of an authorized payment requested by the customer
800.100.207Refund requested
800.100.208Direct debit not enabled for the specified account or bank
800.100.300Network token transaction declined (the PAN data is invalid)
800.100.301Network token transaction declined (the issuer considers the PAN as not eligible for tokenization)
800.100.302Network token transaction declined (the issuer declined the tokenization)
800.100.303Network token transaction declined (session timeout expired with card scheme)
800.100.304Network token transaction declined (card scheme not identified or supported)
800.100.305Network token transaction declined (merchant id wrong or merchant not onboarded)
800.100.306Network token transaction declined (data cannot be decrypted)
800.100.307Network token transaction declined (invalid network token state - operation not allowed)
800.100.308Network token transaction declined (request cannot be verified by the card scheme)
800.100.309Network token transaction declined (aborted by the card scheme)
800.100.310Network token transaction declined (unknown reason)
800.100.311Network token transaction declined (network token request in-flight)
800.100.312Network token transaction declined (network token not available but requested)
800.100.313Network token transaction declined (insufficient data to request a network token)
800.100.314Network token transaction declined (network token already exists)
800.100.315Network token transaction declined (required field not present)
800.100.316Network token transaction declined (not processed - token vault configuration error)
800.100.317Network token transaction declined (suspended network token)
800.100.318Network token transaction declined (at least one transaction with cryptogram required)
800.100.320Network token transaction declined (token service provider non retryable generic error)
800.100.321Network token transaction declined (token service provider retryable generic error)
800.100.322Network token transaction declined (card scheme retryable generic error)
800.100.323Network token transaction declined (card scheme non retryable generic error)
800.100.324Network token transaction declined (format error)
800.100.325Network token transaction declined (unauthorized)
800.100.326Network token transaction declined (network token not found)
800.100.327Network token transaction declined (too many requests)
800.100.330Network token transaction declined (network token expired)
800.100.402Cc/bank account holder not valid
800.100.403Transaction declined (revocation of authorisation order)
800.100.500Card holder has advised his bank to stop this recurring payment
800.100.501Card holder has advised his bank to stop all recurring payments for this merchant
800.110.100Duplicate transaction
800.120.100Rejected by throttling
800.120.101Maximum number of transactions per account already exceeded
800.120.102Maximum number of transactions per ip already exceeded
800.120.103Maximum number of transactions per email already exceeded
800.120.200Maximum total volume of transactions already exceeded
800.120.201Maximum total volume of transactions per account already exceeded
800.120.202Maximum total volume of transactions per ip already exceeded
800.120.203Maximum total volume of transactions per email already exceeded
800.120.300Chargeback rate per bin exceeded
800.120.401Maximum number of transactions or total volume for configured MIDs or CIs exceeded
800.121.100Channel not configured for given source type. Please contact your account manager.
800.121.200Secure Query is not enabled for this entity. Please contact your account manager.
800.121.300SMS is not enabled for this entity. Please contact your account manager.
800.130.100Transaction with same TransactionId already exists
800.140.100Maximum number of registrations per mobile number exceeded
800.140.101Maximum number of registrations per email address exceeded
800.140.110Maximum number of registrations of mobile per credit card number exceeded
800.140.111Maximum number of registrations of credit card number per mobile exceeded
800.140.112Maximum number of registrations of email per credit card number exceeded
800.140.113Maximum number of registrations of credit card number per email exceeded
800.150.100Account Holder does not match Customer Name
800.160.100Invalid payment data for configured Shopper Dispatching Type
800.160.110Invalid payment data for configured Payment Dispatching Type
800.160.120Invalid payment data for configured Recurring Transaction Dispatching Type
800.160.130Invalid payment data for configured TicketSize Dispatching Type
800.190.999Unknown risk error
800.200.159Account or user is blacklisted (card stolen)
800.200.160Account or user is blacklisted (card blocked)
800.200.165Account or user is blacklisted (card lost)
800.200.202Account or user is blacklisted (account closed)
800.200.208Account or user is blacklisted (account blocked)
800.200.220Account or user is blacklisted (fraudulent transaction)
800.300.101Account or user is blacklisted
800.300.102Country blacklisted
800.300.200Email is blacklisted
800.300.301Ip blacklisted
800.300.302Ip is anonymous proxy
800.300.401Bin blacklisted
800.300.499Card scheme blacklisted
800.300.500Transaction temporary blacklisted (too many tries invalid CVV)
800.300.501Transaction temporary blacklisted (too many tries invalid expire date)
800.310.200Account closed
800.310.210Account not found
800.310.211Account not found (BIN/issuer not participating)
800.400.100AVS Check Failed
800.400.101Mismatch of AVS street value
800.400.102Mismatch of AVS street number
800.400.103Mismatch of AVS PO box value fatal
800.400.104Mismatch of AVS zip code value fatal
800.400.105Mismatch of AVS settings (AVSkip, AVIgnore, AVSRejectPolicy) value
800.400.110AVS Check Failed. Amount has still been reserved on the customer's card and will be released in a few business days. Please ensure the billing address is accurate before retrying the transaction.
800.400.150Location validation (37), Implausible address data
800.400.151Implausible address state data
800.400.200Invalid Payer Authentication in 3DSecure transaction
800.400.500Waiting for confirmation of non-instant payment. Denied for now.
800.400.501Waiting for confirmation of non-instant debit. Denied for now.
800.400.502Waiting for confirmation of non-instant refund. Denied for now.
800.500.100Direct debit transaction declined for unknown reason
800.500.110Unable to process transaction - ran out of terminalIds - please contact acquirer
800.600.100Transaction is being already processed
800.700.100Transaction for the same session is currently being processed, please try again later
800.700.101Family name too long
800.700.201Given name too long
800.700.500Company name too long
800.800.102Invalid street
800.800.202Invalid zip
800.800.302Invalid city
800.800.400Connector/acquirer system is under maintenance
800.800.800The payment system is currenty unavailable, please contact support in case this happens again.
800.800.801The payment system is currenty unter maintenance. Please apologize for the inconvenience this may cause. If you were not informed of this maintenance window in advance, contact your sales representative.
800.900.100Sender authorization failed
800.900.101Invalid email address (probably invalid syntax)
800.900.200Invalid phone number (has to start with a digit or a '+', at least 7 and max 25 chars long)
800.900.201Unknown channel
800.900.300User authorization failed
800.900.301User authorization failed, user has no sufficient rights to process transaction
800.900.302Authorization failed
800.900.303No token created
800.900.399Secure Registration Problem
800.900.401Invalid IP number
800.900.450Invalid birthdate
900.100.100Unexpected communication error with connector/acquirer
900.100.200Error response from connector/acquirer
900.100.201Error on the external gateway (e.g. on the part of the bank, acquirer,...)
900.100.202Invalid transaction flow, the requested function is not applicable for the referenced transaction.
900.100.203Error on the internal gateway
900.100.204Error during message parsing
900.100.205Error response from token vault
900.100.300No response from connector/acquirer [uncertain result]
900.100.301Transaction timed out without response from connector/acquirer. It was reversed.
900.100.310Transaction timed out due to internal system misconfiguration. Request to acquirer has not been sent.
900.100.400Timeout at connectors/acquirer side
900.100.500Timeout at connectors/acquirer side (try later)
900.100.600Connector/acquirer currently down
900.100.700Error on the external service provider
900.200.100Message Sequence Number of Connector out of sync
900.300.600User session timeout
900.400.100Unexpected communication error with external risk provider
999.999.888Undefined platform database error
999.999.999Undefined connector/acquirer error

Notifications

Notification Signature

Creating a secret key

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

Creating a Notification signature


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

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

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

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

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

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

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

Verification of Notification signature

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























































Transaction notifications

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

Status
Rejected
Chargebacked
RapidDisputeResolution
Authorized
Rejected card payment notification:

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

    

Refunds

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

Refund request example:

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

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

You can cancel SEPA Direct Debits with separate API request.

Request

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

Refund example:

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

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

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

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

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/References

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

Response

Response example:

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

Response/ResultInfo

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

Payment Methods

Card Payments PopUp

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

Payment

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

Initiates new card payment request.

Request

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

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Purchase

Purchase initiate request example:

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


Initiate response:

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

        
HTML code:

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

Preauthorization

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

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

Preauthorization request example:

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

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

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

Capture

Capture request example:

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

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

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

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

Card On File

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

Card On File request example:

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

Card On File response example:

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

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

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

Card On File - Registration

Card On File - Registration request example:

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

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

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

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

Card On File - Authorization

Card On File - Authorization request example:

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

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

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

Recurring Initial Transaction

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

Merchants responsibilities:

Recurring Initial request example:

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

Recurring Subsequent Transaction

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

Recurring Subsequent request example:

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

Recurring Subsequent response example:

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

Check required and optional parameters in Refunds section.

Recurring Initial Preauthorization

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

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

Merchants responsibilities:

Recurring Initial Preauthorization request example:

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

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

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/Debtor/Address

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

Request/PaymentInformation/References

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

Request/CallbackUrls

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

Request/PaymentInformation/CardTransaction

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

Request/PaymentInformation/CardTransaction/Card

Name Description Format Required
Token CardId Varchar(64) No

Payment Types

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

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format Included
PaymentMethod Card Varchar(4) In case of Capture, Recurring subsequent and Card on File payment types
MerchantIdentification Identification of merchant Merchant Identification In case of Capture, Recurring subsequent and Card on File payment types
PaymentInformation Payment information PaymentInformation In case of Capture, Recurring subsequent and Card on File payment types
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256) In case of any payment type other than Capture, Recurring subsequent and Card on File
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20) Always
ResultInfo Contains result information. ResultInfo Always

Response/MerchantIdentification

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

Response/PaymentInformation

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

Response/PaymentInformation/Amount

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

Response/PaymentInformation/References

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

1 Field present for status Paid

Response/PaymentInformation/Debtor

Name Description Format
Name Debtor Name Varchar(512)

Response/PaymentInformation/DebtorAccount

Name Description Format
Iban Debtor Iban Varchar(512)

Response/PaymentInformation/CardTransaction

Name Description Format
Card Card Details Card Details

Response/PaymentInformation/CardTransaction/Card

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

Response/ResultInfo

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

Card payments notifications v3

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

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


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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

1 Field present for status Paid

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

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

Notification/PaymentInformation/CardTransaction

Name Description Format Included
Card Card Details Card Details Always

Notification/PaymentInformation/CardTransaction/Card

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

Test cards

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

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

Card Payments EmbeddedFields

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

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

TrustPay Gateway supports the following payment methods:

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

Overview of the payment process:

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

Prerequisites:

Initialization

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

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

Create Intent

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

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

Request

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

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

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

Response

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

Card Payment

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

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

The benefit of this solution is two-fold:

TrustPay supports the following cards:

Integration

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

Server Side

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

Client Side

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

You have two options here:

  • Combined Card Component Layout
  • Custom Card Component Layout

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

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

Example of this layout:



To create your own layout with the combined card component:

Card component placeholder:


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

3.1.1. Place a card placeholder HTML element on your webpage

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

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

Mount your card component to a placeholder:
                cardComponent.mount("#card-element"});
            

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

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

Example of a custom layout:



To create your own layout with separate card components:

Card component mount:

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

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

Card components placeholders:

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

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

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

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

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

Card component mount:

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

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

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

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

Common Instructions

TP.js

Including TrustPay JavaScript API file

Example of including the TrustPayApi's script file:

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

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

TrustPayApi object

Creating TrustPayApi object

Example of instantiating the TrustPayApi object:

var trustPayApi = new TrustPayApi(<secrets>);
        

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

Styling of the TrustPayApi's input components

Example of styling input components:

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

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

Checking Payment Status

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

Use paymentStatus property to determine whether the payment was successful.

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

The payment is considered successful if the paymentStatus:

Get Transaction Status call

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

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

Request

The instanceId needs to be provided as a GET parameter.

This API call is an HTTP GET request.

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

Example of a Get Transaction Status request:
    
curl https://tpgw.trustpay.eu/api/v1/Instance/{instanceId} \
    -H "X-API-KEY: YOUR_API_KEY" -k
    

Response

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

Check the list of common PaymentStatus codes

Preauthorization

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

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

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

Integration

1.
Initialize a payment request with a Create Intent call

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

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

Recurring Payment

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

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

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

Integration

1.
Initialize a payment request with a Create Intent call

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

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

Card on File

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

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

Integration

1.
Initialize a payment request with a Create Intent call

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

Name Description Format Required
PaymentType Must be set to CardOnFileInitial PaymentType Yes
2.
Let the customer execute the initial payment
3.
Make payments with stored card data with our backend S2S Subsequent Card on File Payment call

Common Types

Request

PaymentType

PaymentType is an enumeration type.

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

PaymentAction

PaymentAction is an enumeration type.

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

Currency

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

List of commonly used currencies:

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

Response

Status

Status is an integer type that represents server call status.

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

Secrets

Object that holds client secrets, consisting of:

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

Card Payments ServerToServer

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

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

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

All parameter names are case-insensitive.

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

Authentication

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

Purchase

Represents a basic payment request.

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

Plain purchase request

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

* Required when using a third-party MPI.

Example of a purchase request:

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

And a successful response:

{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "dlfunKRnrpN_tuih23wJzw",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed"
}

Recurring Purchase

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

Initial recurring

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

Initial recurring purchase request

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

* Required when using a third-party MPI.

Example of an initial recurring payment request:

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

And a successful response:

{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "I1D0Uf9niYSUqCZ259yMJg",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302083458578661"
}

Subsequent recurring

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

Subsequent TPGW recurring purchase

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

Subsequent TPGW recurring purchase request

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

* Required when using a third-party MPI.

Example of a subsequent TPGW recurring payment request

 curl https://tpgw.trustpay.eu/api/v1/purchase \
 -d "PaymentType=RecurringSubsequent" \
 -d "InstanceId=I1D0Uf9niYSUqCZ259yMJg" \
 -d "Amount=0.01" \
 -d "Currency=EUR" \
 -d "Reference=not a flamethrower" \
 -d "NotificationUrl=https://tpgw.trustpay.eu" \
 -d "RedirectUrl=https://tpgw.trustpay.eu" \
 -d "Billing.City=Bratislava" \
 -d "Billing.Country=SK" \
 -d "Billing.Street1=Test street No.1" \
 -d "Billing.Postcode=01234" \
 -d "Customer.Email=gentleman@trustpay.eu" \
 -d "Customer.Ipaddress=127.0.0.1" \
 -d "Browser.AcceptHeader=*" \
 -d "Browser.Language=en-US" \
 -d "Browser.ScreenHeight=1080" \
 -d "Browser.ScreenWidth=1920" \
 -d "Browser.Timezone=3600" \
 -d "Browser.UserAgent=none" \
 -d "Browser.JavaEnabled=false" \
 -d "Browser.JavaScriptEnabled=true" \
 -d "Browser.ScreenColorDepth=24" \
 -d "Browser.ChallengeWindow=1" \
 -H 'X-API-KEY: YOUR_API_KEY'

And a successful response:

{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "E0omTN9iYMcQxKs1MLBZ_g",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302084259578665"
}

Subsequent non-TPGW recurring purchase

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

Subsequent non-TPGW recurring purchase request

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

* Required when using a third-party MPI.

Example of a subsequent non-TPGW recurring payment request:

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

And a successful response:

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

Merchant Advice Codes (MAC)

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

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

Scheme Response Code

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

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

Card on File Purchase

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

Initial Card on File

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

Initial Card on File purchase request

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

* Required when using a third-party MPI.

Example of an initial Card on File payment request:

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

And a successful response:

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

Subsequent Card on File

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

Subsequent TPGW Card on File purchase

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

Subsequent TPGW Card on File purchase request

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

* Required when using a third-party MPI.

Example of a subsequent TPGW Card on File payment request:

 curl https://tpgw.trustpay.eu/api/v1/purchase \
 -d "PaymentType=CardOnFileSubsequent" \
 -d "CardId=45505032-b673-19a1-de3f-512ee9fa3ffc" \
 -d "Amount=0.01" \
 -d "Currency=EUR" \
 -d "Cardholder=Honourable Gentleman" \
 -d "Reference=not a flamethrower" \
 -d "NotificationUrl=https://tpgw.trustpay.eu" \
 -d "RedirectUrl=https://tpgw.trustpay.eu" \
 -d "Billing.City=Bratislava" \
 -d "Billing.Country=SK" \
 -d "Billing.Street1=Test street No.1" \
 -d "Billing.Postcode=01234" \
 -d "Customer.Email=gentleman@trustpay.eu" \
 -d "Customer.Ipaddress=127.0.0.1" \
 -d "Browser.AcceptHeader=*" \
 -d "Browser.Language=en-US" \
 -d "Browser.ScreenHeight=1080" \
 -d "Browser.ScreenWidth=1920" \
 -d "Browser.Timezone=3600" \
 -d "Browser.UserAgent=Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" \
 -d "Browser.JavaEnabled=false" \
 -d "Browser.JavaScriptEnabled=true" \
 -d "Browser.ScreenColorDepth=24" \
 -d "Browser.ChallengeWindow=1" \
 -H 'X-API-KEY: YOUR_API_KEY'

And a successful response:

{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "MX88Rp6UKzjIKqCNv1TBPg",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302090547579153"
}

Subsequent non-TPGW Card on File purchase

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

Subsequent non-TPGW Card on File purchase request

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

* Required when using a third-party MPI.

Example of a subsequent TPGW Card on File payment request:

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

And a successful response:

{
    "status": 0,
    "description": "successfully processed the purchase",
    "instanceId": "1odXLVrSbPCeGDWUw22RJg",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed",
    "cardSchemeTxId": "302090102578979"
}

Preauthorization

Money reserved via Preauthorization can be released by Capture.

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

Example of parameters used for preauthorization:

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

Capture

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

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

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

Capture request

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

InstanceId=sbNyN1_Uw2Ohee_McFPg8A
Amount=0.02
Currency=EUR
NotificationUrl=https://www.trustpay.eu
Example of the Capture request:

curl --location --request POST 'https://tpgw.trustpay.eu/api/v1/Capture' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'instanceId="INSTANCEID"' \
--form 'amount="0.01"' \
--form 'currency="EUR"'

And a successful response:

{
    "status": 0,
    "description": "Request successfully processed in 'Merchant in Connector Test Mode'",
    "instanceId": "fhtK20BZvLa8o2Chlrq44w",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed in 'Merchant in Connector Test Mode'"
}

Refund

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

Refund can be used to return full or partial amount.

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

Refund request

Name Description Format Required
InstanceId Identification referencing payment to be refunded Varchar(32) Yes
Amount Amount of the payment Numeric(18,2) Yes
Currency The currency code of the payment request's amount Currency Yes
Reference Merchant's reference Varchar(35) No
NotificationUrl URLs No
Example of the Refund request:

curl --location --request POST 'https://tpgw.trustpay.eu/api/v1/Refund' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'instanceId="INSTANCEID"' \
--form 'amount="0.01"' \
--form 'currency="EUR"'

And a successful response:

{
    "status": 0,
    "description": "Request successfully processed in 'Merchant in Connector Test Mode'",
    "instanceId": "fhtK20BZvLa8o2Chlrq44w",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed in 'Merchant in Connector Test Mode'"
}

Reversal

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

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

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

Reversal request

Name Description Format Required
InstanceId Identification referencing payment to be refunded Varchar(32) Yes
Reference Merchant's reference Varchar(35) No
NotificationUrl URLs No
Example of the Reversal request:

curl --location --request POST 'https://tpgw.trustpay.eu/api/v1/Reverse' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'instanceId="INSTANCEID"' \
--form 'amount="0.01"' \
--form 'currency="EUR"'

And a successful response:

{
    "status": 0,
    "description": "Request successfully processed in 'Merchant in Connector Test Mode'",
    "instanceId": "fhtK20BZvLa8o2Chlrq44w",
    "paymentStatus": "000.100.112",
    "paymentDescription": "Request successfully processed in 'Merchant in Connector Test Mode'"
}

Transaction status

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

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

Use InstanceId as a query parameter.

This API call is an HTTP GET request.

Electronic Commerce Indicator (ECI)

ECI value Flow type Brand Description
00 Non-3DS MasterCard 3DS authentication is either failed or could not be attempted. Possible reasons being both card and Issuing Bank are not secured by 3DS, technical errors, or improper configuration.
01 Partial 3DS MasterCard 3DS authentication was attempted but was not or could not be completed. Possible reasons being either the card or its Issuing Bank has yet to participate in 3DS, or cardholder ran out of time to authorize.
02 Fully 3DS MasterCard 3DS authentication is successful and both card and Issuing Bank are secured by 3DS.
05 Fully 3DS flow VISA 3DS authentication was successful. Transactions are secured by 3DS.
06 Partial 3DS VISA 3DS authentication was attempted but was not or could not be completed. Possible reasons being either the card or its Issuing Bank has yet to participate in 3DS.
07 Non-3DS VISA 3DS authentication is either failed or could not be attempted. Possible reasons being both card and Issuing Bank are not secured by 3DS, technical errors, or improper configuration.
Get transaction status request example:

     curl https://tpgw.trustpay.eu/api/v1/instance/617z4szmbu7ipyarpD4_Ww  \
     -H 'X-API-KEY: YOUR_API_KEY'

Transaction status response - success:

{
    "status": 0,
    "instanceId": "617z4szmbu7ipyarpD4_Ww",
    "created": "2022-09-19T09:36:03.7851749Z",
    "amount": "0.01",
    "currency": "EUR",
    "reference": "20220919_15",
    "paymentStatus": "000.100.110",
    "paymentDescription": "Request successfully processed in 'Merchant in Integrator Test Mode'",
    "paymentStatusDetails": {
        "extendedDescription": "Approved",
        "schemeResponseCode": "00"
    },
    "threeDSecure": {
        "eci": "05"
    },
    "card": {
        "maskedPan": "420000******0000",
        "expiration": "10/22",
        "description": "Visa •••• 0000"
    }
}

Transaction status response - pending transaction:

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

Transaction status response - error:
    
{
    "status": 0,
    "instanceId": "617z4szmbu7ipyarpD4_Ww",
    "created": "2021-02-23T12:36:03.7851749Z",
    "amount": "5.00",
    "currency": "EUR",
    "reference": "20220919_15",,
    "paymentStatus": "800.100.203",
    "paymentDescription": "Insufficient Funds",
    "paymentStatusDetails": {
        "additionalResponseReasonCode": "2",
        "extendedDescription": "Not sufficient funds",
        "schemeResponseCode": "51",
        "merchantAdviceCode": "2"
    },
    "card": {
        "maskedPan": "520488******0222",
        "expiration": "01/25",
        "description": "Mastercard •••• 0222"
    }
}
     

Request structures

Request/PaymentType

PaymentType is an enumeration type.

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

Request/Currency

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

List of commonly used currencies

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

Request/CardData

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

Request/CardSchemeTransactionId

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

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

Request/URLs

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

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

Request/BillingAddress

Billing parameter names are prefixed with Billing.

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

Request/CustomerData

Customer parameter names are prefixed with Customer.

Name Description Format Required
IpAddress Customer's IP address (IPv4 / IPv6) Varchar(45) Yes
Email Customer's email address Varchar(128) Yes2
Phone Customer's phone number1 Varchar(16) Yes2
Surname Customer's last name or surname Varchar(48) No3
Birthdate Customer's birthday in ISO 8601 YYYY-MM-DD format Varchar(10) No3

1 Phone number in ITU E.164 CountryCode-Subscriber format, e.g. 421-123456789
2 At least one of the parameters is required (email or phone)
3 Required for some risk checks and payment providers

Request/BrowserData

Browser parameter names are prefixed with Browser.

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

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

Request/ChallengeWindow

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

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

Request/3DsData

3DS parameter names are prefixed with threeDSecure.

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

Request/3DsData/ChallengeIndicator

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

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

Request/3DsData/AuthenticationType

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

Value Description
01 Static
02 Dynamic
03 OOB
04 Decoupled

Request/3DsData/ExemptionFlag

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

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

Request/Instructions

Instruction parameters are prefixed with Instructions.

Name Description Format Required
Authentication 3DS authentication toggle Authentication Instruction No

Request/Instructions/Authentication

Instructions.Authentication controls transaction's 3DS authentication.

Value Description
Enforce3DS Request 3DS authentication
Skip3DS Skip 3DS authentication

Response structure

All responses from TPGW are returned as JSON.

Success response example:

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

Response structure for successful requests

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

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

Pending response example:

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

Response structure for failed requests

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

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

Response/ResultCode

Indicates state of current request.

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

Response/PaymentStatus

Indicates state of a financial transaction.

Response/PaymentStatusDetails

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

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

Response/Card

Masked card data.

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

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

List of common PaymentStatus codes

Payment Status Codes

List of common Error codes

Value Description
1 Unspecified error
4 Validation failed
5 Validation failed
6 Invalid InstanceId format
7 Invalid InstanceId value
8 Invalid PAN (unexpected characters)
9 Invalid PAN (length)
10Invalid PAN (checksum)
11Invalid CVV format
12Invalid CVV value
13Invalid Card expiration format
14Invalid Card expiration (month)
15Invalid Card expiration (year)
16Invalid Amount format
17Invalid Amount value
18Invalid Currency format
19Invalid Currency value
21Access denied for Instance
22Instance already processed
23Instance already processed
25Failed to create Instance
26Invalid CardId
30Access denied
31Authentication failed
32Invalid API KEY
34Invalid parameter value
35Invalid URL
37Invalid request type
39Invalid parameter length
40Invalid secret
41Invalid secret
45Apple Pay not supported
46Google Pay not supported
48Invalid Apple Pay payment token
49Failed to validate Apple Pay session
50Failed to process Apple Pay
52Invalid Google Pay payment token
56Failed to process Google Pay
59Failed to capture (try again later)
60Failed to capture (amount exceeded)
67Google Pay configuration missing
81Invalid Apple Pay configuration
82Transaction amount exceeded
83Transactions volume exceeded
84Transactions count exceeded
85Card not enrolled for 3DS
86BIN blacklisted
87IP country blacklisted
88External 3DS disabled
89Recurring transactions disabled
91Card On File transactions disabled
92Preauthorization s disabled
93Refunds disabled
94Reversals disabled
96Insufficient Project permissions

Handling 3DS process

Response with preconditions example:

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

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

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

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

In case of asynchronous process proceed as follows:

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

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

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

Open a hidden iframe and post data to the Preconditions URL

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

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

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

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

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

Wallet Payments EmbeddedFields

Embedded Fields for Wallet Payments

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

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

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

Apple Pay

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

When configuring button appearance always respect Apple's guidelines.

GooglePay

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

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

When configuring button appearance always respect Google's guidelines.

MobilePay

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

When configuring button appearance always respect MobilePay's guidelines.

How to register for MobilePay

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

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

Prerequisites

Setup

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

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

Initialize TP.js object:

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

All the embedded fields follow the same scheme:

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

Setup Apple Pay

1. Add a placeholder

Example of an Apple Pay placeholder:

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

2. Create an instance of the component

Create an instance of the component:

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

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

3. Check availability and mount

Mount the component:

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

4. Handle the result

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

Setup Google Pay

1. Add a placeholder

Example of a Google Pay placeholder:

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

2. Create an instance of the component

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

3. Check availability and mount

Mount the component:

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

4. Handle the result

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

Setup MobilePay

1. Add a placeholder

Example of a MobilePay placeholder:

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

2. Create an instance of the component

Create an instance of the component:
    
interface IPaymentResult {
    status:number;
    description:string;
}
var mpButton = trustpayApi.createComponent("mobilePay", {
    buttonVerb: "pay",
    buttonLanguage: "en-uk",
    branded: true,
    onPaymentProcessed: (result: IPaymentResult) => { console.log(result); },
    // define your callback function -
    // this will be called after the transaction is resolved (either synchronously or asynchronously)
});

Parameter Required Value
buttonVariant no Please refer to MobilePay’s documentation for the parameter variant
buttonLanguage no Please refer to MobilePay’s documentation for the parameter language
buttonVerb no Please refer to MobilePay’s documentation for the parameter verb
rounded no For possible values, please refer to MobilePay’s documentation
stretched no For possible values, please refer to MobilePay’s documentation
branded no For possible values, please refer to MobilePay’s documentation
onPaymentProcessed recommended The supplied handler function will trigger once the payment process is completed

3. Check availability and mount

Mount the component:

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

4. Handle the result

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

The possible codes are listed below:

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

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

Customer Metadata

Components for Apple Pay and Google Pay support customer metadata extraction.

Setup

To retrieve metadata, set up your component as described in the relevant documentation and add the requestCustomerMetadata preference to the preferences array.

Add the requestCustomerMetadata preference to the preferences array:

var gpButton = trustpayApi.createComponent("googlePay", {
    ...
    preferences: ["requestCustomerMetadata"] // initialize customer metadata request
    ...
});
var apButton = trustpayApi.createComponent("applePay", {
    ...
    preferences: ["requestCustomerMetadata"] // initialize customer metadata request
    ...
});

Data

Currently following fields can be gathered:

The data will be returned the following way:

Subfield customerData example:

{
    ...
    "customerData": {
        "email": "customer@email.com",
        "name":" Customer Name"
    }
    ...
}

Limitations

Modal Window Events

The TrustPayApi class uses modals to display and handle some workflows (e.g. 3DS challenge redirects) necessary to complete a payment.

Example:

    ...
    trustpayApi = new TrustPayApi(serverResponse.secrets);
    trustpayApi.addEventListener("modalopen", (e) => {
        console.log("[Integration] Modal opened", e) 
    });
    trustpayApi.addEventListener("modalload", (e) => {
        console.log("[Integration] Modal loaded", e) 
    });
    trustpayApi.addEventListener("modalclose", (e) => {
        console.log("[Integration] Modal closed", e) 
    });
    ...

You can subscribe to following events to provide a better experience for your customers: modalopen, modalload, modalclose.

Modal Opened

This event is raised when the modal window starts to display content (e.g. 3DS challenge redirect).

The content of the modal window is loaded in an iframe placed in a div element which is appended to document.body with the following properties:

Property Value
div.style.width 100%
div.style.height 100%
div.style.position absolute
div.style.top 0
div.style.left 0
div.style.backgroundColor white
div.style.zIndex 999

Modal Loaded

This event is raised when content is loaded within the modal window (i.e. onLoad of the modal's iframe).

Please note this event may be raised multiple times based on the flow being executed - e.g. 3DS authentication may require multiple URL redirects within the modal's iframe element.

Modal Closed

This event is raised when the current flow handled by the modal window finishes and the content is stopped being displayed.

Setup

Calling addEventListener:

addEventListener(eventType: TpEvents, eventHandler: () => void);
    

Component Event Handling

You can subscribe to following events triggered by instances of ApplePayComponent, GooglePayComponent and MobilePayComponent.

Example of registering the click event for the GooglePayComponent:

let gpButton = trustpayApi.createComponent("googlePay", {
    ...
});
gpButton.on("click", (event) => { 
    console.log("[Integration] Google Pay button CLICKED!", event);
})//hook up click event

Component Removal

Example of component removal:

// create your instance of TrustPayApi
trustpayApi = new TrustPayApi(...);
...
// add your GooglePay component
let gpButton = trustpayApi.createComponent("googlePay", {
    ...
});
...
// remove your GooglePay component
trustpayApi.removeComponent(gpButton);

If necessary, you can remove components you added to your TrustPayApi instance by calling removeComponent.

AircashPay

Payment process

Payment

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

Initiates new AircashPay payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}


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

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


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

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

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

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

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

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

Initiate response:

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

   
HTML code:

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/References

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

AircashPay notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Bancontact

Payment

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

Initiates new Bancontact payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/References

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

Request/CallbackUrls

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

Response

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

Response/ResultInfo

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

Bancontact notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Notification/PaymentInformation/CardTransaction

Name Description Format Included
Card Card Details Card Details Always

Notification/PaymentInformation/CardTransaction/Card

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

Blik

Payment

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

Initiates new Blik payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
PLN 985 Polish zloty

Request/PaymentInformation/References

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

Request/PaymentInformation/Debtor

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Blik notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

CashToCode

Payment process

Payment

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

Initiates new CashtoCode payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'CashtoCode',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'Country' => 'SK'
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'Debtor' => array(
            'Address':{
                'CountryCode':'DE'
            },
            'Identification' => array(
                'Id' => '123456'
            )
         )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

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


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

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

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

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

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

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

Initiate response:

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Localization Used to pre-select the language on the CashtoCode page. (ISO 639-1 format) Char(2) No
Country Used for pre-selecting the country for the end-user on the CashtoCode page. (ISO 3166-2 format) Char(2) Yes
References Reference (merchant’s payment identification) References Yes
RemittanceInformation Description of payment Char(127) Yes
Debtor Debtor information Debtor Yes

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

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

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/Debtor/Address

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

Request/PaymentInformation/Debtor/Identification

Name Description Format Required
Id Identifier of the buyer account on the merchant platform Varchar Yes

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Pricepoints

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

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

CashtoCode notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

CashToCode eVoucher

Payment process

Payment

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

Initiates new CashtoCode eVoucher payment request.

Request

Payment example:

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

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "CashToCodeEVoucher",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "USD"
             },
             Localization = "SK",
             Country = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             Debtor = new
             {
                Address = new
                {
                    CountryCode = "DE"
                },
                Identification = new
                {
                    Id = "123456"
                }
            }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'CashToCodeEVoucher',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'USD'
          ),
         'Localization' => 'SK',
         'Country' => 'SK'
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'Debtor' => array(
            'Address':{
                'CountryCode':'DE'
            },
            'Identification' => array(
                'Id' => '123456'
            )
         )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

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


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

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

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

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

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

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

Initiate response:

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Localization Used to pre-select the language on the CashtoCode eVoucher page. (ISO 639-1 format) Char(2) No
Country Used for pre-selecting the country for the end-user on the CashtoCode eVoucher page. (ISO 3166-2 format) Char(2) Yes
References Reference (merchant’s payment identification) References Yes
RemittanceInformation Description of payment Char(127) Yes
Debtor Debtor information Debtor Yes

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
USD 840 United States dollar

Request/PaymentInformation/References

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

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/Debtor/Address

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

Request/PaymentInformation/Debtor/Identification

Name Description Format Required
Id Identifier of the buyer account on the merchant platform Varchar Yes

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Pricepoints

The payment request Amount is validated by the following pricepoints.

CountryAmount
All1.00 - 1200.00

CashtoCode eVoucher notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Direct Banking

Payment process

At first the GetBankList API request is made. After receiving the bank list, the customer can choose a bank. After that the merchant sends a SetupPayment request. After receiving the SetupPayment result, the merchant/customer chooses between an online or offline payment. For an online payment an additional ExecutePayment redirect has to be made. After redirection, the standart payment process flow follows.

Get bank list

API endpoints:
Live - https://aapi.trustpay.eu/api/gateway/gateways

The GetBankList request is used to aquire a list of currently supported banks. If the country and/or merchant account ID parameter is specified, only banks available for that country/merchant account are returned.

Request

Name Description Format Required
MerchantIdentification Identification of merchant Merchant Identification Yes
Request example:

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

public dynamcic Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Gateway/Gateways";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "4107123456"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response;
   }
}

Response

Response example:

{
  "Gateways": [
    {
      "Country": "SK",
      "Gateways": [
        {
          "Id": 1000000,
          "Name": "TestBank",
          "Currency": "EUR",
          "Url": "https://testbank.sk/",
          "OnlinePayments": true,
          "OfflinePayments": false
        },
        {
          "Id": 1000001,
          "Name": "TestBank2",
          "Currency": "EUR",
          "Url": "https://testbank2.eu/",
          "OnlinePayments": false,
          "OfflinePayments": true
        }
      ]
    },
    {
      "Country": "CZ",
      "Gateways": [
        {
          "Id": 1000002,
          "Name": "TestBank3",
          "Currency": "EUR",
          "Url": "https://testbank3.eu/",
          "OnlinePayments": true,
          "OfflinePayments": false
        },
        {
          "Id": 1000003,
          "Name": "TestBank4",
          "Currency": "CZK",
          "Url": "https://testbank2.cz/",
          "OnlinePayments": false,
          "OfflinePayments": true
        }
      ]
    }
  ],
    "ResultInfo": {
            "ResultCode": 1001000,
            "AdditionalInfo": "Success"
        }
}

Name Description Format
Gateways List of gateways grouped by countries Array of Gateways
ResultInfo Contains result information. ResultInfo

Response/Gateways

Name Description Format
Country Format defined in ISO3166-1Alpha-2 Char(2)
Gateways List of gateways grouped by country Array of Gateway

Response/Gateways/Gateway

Name Description Format
Id This Id you have to fill into request as ProprietaryId Numeric
Name Name of bank's gateway Varchar(50)
Url Url to bank's internet banking Varchar(50)
Currency Currency of the payment Char(3)
OnlinePayments If true, gateway is able to do online payments Bool
OfflinePayments If true, gateway is able to do offline payments Bool
OnlineNotice Online notice Varchar(255)
OfflineNotice Offline notice Varchar(255)

Response/ResultInfo

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

Setup payment

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

Request

Parameters are same as for Wire payment but this additional parameter have to be added to the request

Request/PaymentInformation/DebtorAgent

Name Description Format Required
ProprietaryId Selected gateway's Id from response Numeric Yes
Setup example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Response

Setup response:

{
  "OfflineInstructions": [
    {
      "Language": "sk-SK",
      "Instructions": [
        {
          "Value": "SK123456789123456",
          "Label": "Číslo účtu"
        }
      ]
    },
    {
      "Language": "en-GB",
      "Instructions": [
        {
          "Value": "SK123456789123456",
          "Label": "Account number"
        }
      ]
    }
  ],
  "PaymentRequestId": 12345,
  "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
  "ResultInfo": {
         "ResultCode": 1001000,
         "AdditionalInfo": "Success"
    }
}
    
    
Name Description Format
OfflineInstructions Offline instruction grouped by language Array of OfflineInstructions
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

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

Response/OfflineInstructions

Name Description Format
Language Language of instructions Varchar(5)
Instructions Array of instructions Array of Instruction

Response/OfflineInstructions/Instructions

Name Format
Value Varchar(50)
Label Varchar(50)

EPS

Payment

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

Initiates new EPS (Electronic Payment Standard) payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/References

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Payment (recurring)

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

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

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

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

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

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

Request/PaymentInformation/Debtor

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

EPS notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Giropay

Payment

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

Initiates new Giropay payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/References

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

Request/PaymentInformation/ShippingInformation

Name Description Format Required
Addressee Addressee data Addressee Yes

Request/PaymentInformation/ShippingInformation/Addressee

Name Description Format Required
FirstName First name Varchar(100) Yes
LastName Last name Varchar(100) Yes
Email Email address Varchar(256) Yes

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Payment (recurring)

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

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

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

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

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

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

Request/PaymentInformation/Debtor

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Giropay notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Home Credit

Payment process

Payment

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

Initiates new HomeCredit payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}


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

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


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

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

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

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

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

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

Initiate response:

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

   
HTML code:

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
CZK 203 Czech koruna

Request/PaymentInformation/References

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

Request/PaymentInformation/Debtor

Name Description Format Required
FirstName FirstName Varchar(50) Yes
LastName LastName Varchar(50) Yes
Email Email Varchar(320) Yes
Phone Phone Varchar(30) No

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Home Credit notifications v3

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

{
    "PaymentMethod": "HomeCredit",
    "MerchantIdentification": {
        "ProjectId": "4101111111"
    },
    "PaymentInformation": {
        "Amount": {
            "Amount": "25.00",
            "Currency": "CZK"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
        "MerchantReference": "1234567890",
        "PaymentId": "49863043",
        "PaymentRequestId": "1234"
    },
    "Debtor": {
        "Name": "Test name"
    },
    "DebtorAccount": {
        "Iban": "DE35940594210032507931"
    }
    "DebtorAgent": {
        "Bic": "TESTDETT421"
    }
    },
    "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}
    
HomeCredit E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

iDEAL

Payment process

Payment

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

Initiates new iDEAL payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}


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

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


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

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

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

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

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

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

Initiate response:

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

   
HTML code:

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/References

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Payment (recurring)

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

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

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

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

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

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

Request/PaymentInformation/Debtor

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

iDEAL notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Instant Bank Transfers

Payment

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

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

Initiates new bank transfer payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Initiate response:

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

        
HTML code:

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

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

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/References

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

Request/CallbackUrls

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

Bank transfer notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Instant Bank Transfers (FI)

Payment process

Payment

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

Initiates new Instant Bank Transfers (FI) payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}


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

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


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

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

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

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

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

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

Initiate response:

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

   
HTML code:

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

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

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email Varchar Yes

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Instant Bank Transfers (FI) notifications v3

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

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

Instant Bank Transfers (FI) E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Data signature calculated from concatenated values of all values (in ASCII sorted order) in the notification. Slash character ('/') is used as separator. Not empty values are sorted in ascending order and then concatenated using the separator. Char(64) Always

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Instant Bank Transfers (PL)

Payment

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

Initiates new Instant Bank Transfers (PL) payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}

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

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

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

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

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

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

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

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
PLN 985 Polish zloty

Request/PaymentInformation/References

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

Request/PaymentInformation/Debtor

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Instant Bank Transfers (PL) notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

MbWay

Payment process

Payment

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

Initiates new MbWay payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}


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

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


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

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

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

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

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

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

Initiate response:

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

   
HTML code:

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

Request/MerchantIdentification

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

Request/PaymentInformation

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

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No
Phone Debtor's phone Varchar (e.g.+countrycode phone number, +421 XXXXXXXXX ) Yes

Request/PaymentInformation/References

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

MbWay notifications v3

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

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

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

Notification/MerchantIdentification

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

Notification/PaymentInformation

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

Notification/PaymentInformation/Amount

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

Notification/PaymentInformation/References

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

Notification/PaymentInformation/Debtor

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

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Multibanco

Payment process

Payment

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

Initiates new Multibanco payment request.

Request

Payment example:

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

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

      JavaScriptSerializer serializer = new JavaScriptSerializer();

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

      return response["GatewayUrl"];
   }
}


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

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


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

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

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

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

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

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

Initiate response:

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

   
HTML code:

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

Request/MerchantIdentification

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

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Localization Char(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes
DueDate Date to which the transaction should be carried out, YYYY-MM-DD format. Max current date + 30 days. Varchar(10) No

Request/PaymentInformation/Amount

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

Request/PaymentInformation/Amount/Currency

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

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

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

Request/PaymentInformation/References

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

Request/CallbackUrls

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

Response

Response example:

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

Response/ResultInfo

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

Multibanco notifications v3

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

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

Multibanco E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

MyBank

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new MyBank payment request.

When no Issuer's ProprietaryId is specified in the Payment request the default Issuer selection form can be displayed as a popup overlaid over the merchant's site using IFrame. The Merchant's site has to include link to Merchant API JavaScript popup.js on it's page and load the TrustPay payment gateway url inside an IFrame. The included JavaScript will style the IFrame so that it is hidden. It also contains the code necessary to show the Issuer selection form from the hidden IFrame as a popup overlaid over the merchant's e-shop. To allow users to show the Issuer selection popup, the merchant needs to include some link/button/etc. with CSS class "show-popup" somewhere on the page. Onclick event handler that shows the popup will be automatically added to this element. Please see the HTML code example to the right.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "MyBank",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             DebtorAgent = new
             {
                 ProprietaryId = "CT000005:it"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'MyBank',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'DebtorAgent' => array(
            'ProprietaryId' => 'CT000005:it'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "MyBank";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object DebtorAgent = new Object(){
                        public String ProprietaryId = "CT000005:it";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod MyBank Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
DebtorAgent Debtor's agent details DebtorAgent No
Localization Language Varchar(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/DebtorAgent

Name Description Format Required
ProprietaryId MyBank participant bank identifier and aliasLanguage, format ParticipantBankId:aliasLanguage, e.g. CT000005:it Varchar Yes

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Payment (recurring)

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new MyBank recurring payment request using direct debit. The debtor's name and IBAN from the original MyBank payment request will be used to initiate the direct debit.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             DueDate = "2022-05-25",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345",
                 OriginalPaymentRequestId = 73807
             }
             Debtor = new
             {
                 Email = "example@example.org",
                 IpAddress = "1.2.3.4",
             },
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'DueDate' => '2022-05-25',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
            'OriginalPaymentRequestId' => '73807'
          ),
         'Debtor' => array(
            'Email' => 'example@example.org'
            'IpAddress' => '1.2.3.4'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaDirectDebit";
            public String DueDate = "2022-05-25";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public long OriginalPaymentRequestId = 73807;
                };
                public Object Debtor = new Object(){
                        public String Email = "example@example.org";
                        public String IpAddress = "1.2.3.4";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) No
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information No
Debtor Debtor information Debtor No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId PaymentRequestId of the original MyBank payment request Numeric(20) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) No

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No
IpAddress Debtor's IP address IPv4 address No

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ErrorCode Id of error that occurred during service call (sent only when call failed) Numeric(10)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Issuers

API endpoints:
Live - https://aapi.trustpay.eu/api/Issuers/Issuers/MyBank

Retrieve MyBank Issuers list using GET request.

Request

Request example:

using System.Net;
using System.Text;

public string ListIssuers()
{
   string url = "https://aapi.trustpay.eu/api/Issuers/Issuers/MyBank";
   using (var client = new WebClient())
   {
      return client.DownloadString(url);
   }
}

function ListIssuers()
{
   $url = 'https://aapi.trustpay.eu/api/Issuers/Issuers/MyBank';

   $options = array('http' => array(
         'method' => 'GET'
      )
   );
   $context = stream_context_create($options);
   return file_get_contents($url, false, $context);
}


import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String ListIssuers(){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Issuers/Issuers/MyBank");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("GET");
        con.setDoOutput(false);

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        return response;
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Response

Response example:
{
    "Issuers": [
    {
        "ProprietaryId":"CT000052",
        "Country":"IT",
        "PaymentMethod":"MyBank",
        "Aliases":[{"Alias":"CODICE WEB","Language":"en"}]
    },
    {
        "ProprietaryId":"CT000094",
        "Country":"IT",
        "PaymentMethod":"MyBank",
        "Aliases":[{"Alias":"VOLKSBANK - BANCA POPOLARE","Language":"de"}]
    }]
}
Name Description Format
Issuers Issuers list Array of MyBank Issuer

Response/MyBank Issuer

Name Description Format
ProprietaryId Issuer's identifier Varchar
Country Issuer's country Varchar(2)
PaymentMethod MyBank Varchar
Aliases Issuer's aliases Array of MyBank Issuer Alias

Response/MyBank Issuer Alias

Name Description Format
Alias Issuer's alias Varchar
Language Issuer's alias's language Varchar(2)

MyBank notifications v3

MyBank URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "MyBank",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "DE35940594210032507931"
    }
    "DebtorAgent": {
      "Bic": "TESTDETT421"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

MyBank E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Na splátky Tatra banka

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new NasplatkyTB payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "NasplatkyTB",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             Debtor = new 
             {
                 FirstName = "John",
                 LastName = "Doe",
                 Email = "email@example.com"
             },
             OrderedItems = new []
             {    
                 new 
                 {
                     Name = "Item1",
                     Quantity = 1,
                     Price = 1.50
                 }
             },
         }
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'NasplatkyTB',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'Debtor' => array(
            'FirstName' => 'John',
            'LastName' => 'Doe',
            'Email' => 'email@example.com'
          ),
          'OrderedItems' => array(
            array(
              'Name' => 'Item1',
              'Quantity' => '1',
              'Price' => '1.50'
            )
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "NasplatkyTB";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "SK";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public Object Debtor = new Object(){
                    public String FirstName = "John";
                    public String LastName = "Doe";
                    public String Email = "email@example.com";
                };
                public Object[] OrderedItems = new Object[]{
                    new Object(){
                        public String Name = "Item1";
                        public int Quantity = 1;
                        public double Price = 1.50;
                    };
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod NasplatkyTB Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Localization Localization Char(2) No
References Reference (merchant’s payment identification) References Yes
Debtor Debtor Debtor Yes
OrderedItems Array of ordered items OrderedItem Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
FirstName FirstName Varchar(50) Yes
LastName LastName Varchar(50) Yes
Email Email Varchar(320) Yes
Phone Phone Varchar(30) No

Request/PaymentInformation/OrderedItem

Name Description Format Required
Name Name Varchar(255) Yes
Quantity Quantity Numeric Yes
Price Price Numeric(13,2) en-US format Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Na splátky Tatra banka notifications v3

NasplatkyTB URL notification v3 example:
https://example.handler.com/

    {
    "PaymentMethod": "NasplatkyTB",
    "MerchantIdentification": {
    "ProjectId": "4101111111"
    },
    "PaymentInformation": {
    "Amount": {
    "Amount": "25.00",
    "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
    "MerchantReference": "1234567890",
    "PaymentId": "49863043",
    "PaymentRequestId": "1234"
    },
    "Debtor": {
    "Name": "Test name"
    },
    "DebtorAccount": {
    "Iban": "DE35940594210032507931"
    }
    "DebtorAgent": {
    "Bic": "TESTDETT421"
    }
    },
    "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
    }

NasplatkyTB E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

OpenBanking

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new OpenBanking payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "OpenBanking",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "SK",
             Country = "DE",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'OpenBanking',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'Country' => 'DE'
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "OpenBanking";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "SK";
                public String Country = "DE"
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };                 
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod OpenBanking Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Localization Used to pre-select the language on the OpenBanking page. (ISO 639-1 format) Char(2) No
Country Used for pre-selecting the country for the end-user on the OpenBanking page. (ISO 3166-2 format) Char(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) Yes*
Error URL address to which the customer is redirected after payment processing failed Varchar(256) Yes*
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to the OpenBanking payment page Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

OpenBanking notifications v3

OpenBanking URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "OpenBanking",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

OpenBanking E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Authorized, Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Payconiq

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Payconiq payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Payconiq",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Payconiq',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Payconiq";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Payconiq Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Localization Char(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Payconiq notifications v3

Payconiq URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Payconiq",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Payconiq E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

PayPal

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new PayPal payment request.

Request

Payment example (for tangible goods):

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "PayPal",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en-GB",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             RemittanceInformation: "Some description"
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'PayPal',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en-GB',
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'RemittanceInformation' => 'Some description'
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "PayPal";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en-GB";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public String RemittanceInformation = "Some description";
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2&issuerId=AbwCEe8zJYkLtIAMZ-s-jB"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="PayPalFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2&issuerId=AbwCEe8zJYkLtIAMZ-s-jB"></iframe>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod PayPal Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls Yes

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Localization Localization - BCP 47 format (for example: "en-GB") Char(5) No
References Reference (merchant’s payment identification) References Yes
RemittanceInformation Description of payment Char(127) Yes
Debtor Debtor information Debtor Yes*

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
AUD 036 Australian Dollar
CAD 124 Canadian Dollar
CHF 756 Swiss Franc
CNY 156 Yuan Renminbi
CZK 203 Czech koruna
DKK 208 Danish Krone
EUR 978 Euro
GBP 826 Pound sterling
HKD 344 Hong Kong Dollar
HUF 348 Hungarian forint
ILS 376 Israeli new shekel
JPY 392 Japanese yen
NOK 578 Norwegian Krone
PLN 985 Polish zloty
SEK 752 Swedish Krona
USD 840 United States dollar

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
FirstName Debtor's first name Varchar Yes
LastName Debtor's last name Varchar Yes
Email Debtor's email Varchar Yes
Phone Debtor's phone Varchar Yes
Address Debtor's address Address Yes
Identification Debtor's identification on the merchant platform Identification Yes

Request/PaymentInformation/Debtor/Address

Name Description Format Required
CountryCode Debtor's country code (ISO 3166-2 format) Varchar(2) Yes

Request/PaymentInformation/Debtor/Identification

Name Description Format Required
Id Identifier of the buyer account on the merchant platform Varchar Yes
Created Date of creation of the debtor’s account on the merchant platform (format: YYYY-MM-DD) Varchar(10) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) Yes*
Error URL address to which the customer is redirected after payment processing failed Varchar(256) Yes*
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to the HTML page with PayPal button (only) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

PayPal notifications v3

PayPal URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "PayPal",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

PayPal E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Paysafecard

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Paysafecard payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Paysafecard",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Debtor = new
             {
                 Email = "email@example.com"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Paysafecard',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Debtor' => array(
            'Email' => 'email@example.com'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Paysafecard";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object Debtor = new Object(){
                        public String Email = "email@example.com";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Paysafecard Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information Yes
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro
GBP 826 Pound sterling
USD 840 United States dollar

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar Yes

Request/CallbackUrls

Name Description Format Required
Success Url address to which the customer is redirected after successful payment Varchar(256) No
Cancel Url address to which the customer is redirected after payment is canceled Varchar(256) No
Error Url address to which the customer is redirected after payment processing failed Varchar(256) No
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Paysafecard notifications

Paysafecard URL notification example:
https://example.handler.com/

{
  "PaymentMethod": "Paysafecard",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "EndToEnd": "e2eReference",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Address": {
        "CountryCode": "SK"
      }
    },
    "DebtorAccount": {
      "Other": "8219820508456139"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Paysafecard E-mail notification: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
EndToEnd Reference between merchant and client Varchar(35) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always

Notification/PaymentInformation/Debtor

Name Description Format Included
Address Debtor's address Address Always

Notification/PaymentInformation/Debtor/Address

Name Description Format Included
CountryCode Country code ISO 3166-1 alpha-2 Char(2) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Other Card Serial Number Varchar Always

Satispay

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Satispay payment request.

Recurring payment

To initiate recurring payment set Recurring as True and do not set OriginalPaymentRequestId value.

For recurring subsequent payment Recurring must be set as True and OriginalPaymentRequestId must contain the PaymentRequestId obtained from recurring initiate payment response.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Satispay",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Satispay',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Satispay";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public String Localization = "en";
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:
{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
    
   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Satispay Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Language Varchar(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes
SatispayTransaction Satispay transaction details SatispayTransaction No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId Payment request identifier of recurring initial payment Numeric(20) No

Request/PaymentInformation/SatispayTransaction

Name Description Format Required
Recurring Recurring payment Boolean No

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Satispay notifications v3

Satispay URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Satispay",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Satispay E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

SEPA Credit Transfer

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new SepaCreditTransfer (SCT) payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaCreditTransfer",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR",
                 RequireExact = true
             },
             DueDate = "2021-04-27",
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaCreditTransfer',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
            'RequireExact' => 'true'
          ),
         'DueDate' => '2021-04-27',
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaCreditTransfer";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                        public boolean RequireExact = true;
                };
                public String DueDate = "2021-04-27";
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaCreditTransfer Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
DueDate Date to which the transaction should be carried out Varchar(10) No
Localization Language Varchar(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes
RequireExact Decline different amount Boolean No

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl Url to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Wire notifications v3

Wire URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Wire",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "EndToEnd": "NOTPROVIDED",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "SK9456000000004137132010"
    },
    "DebtorAgent": {
      "Bic": "KOMASK2X"
    }
  },
  "Signature": "747E25237CF813C540343D2F6C0499DE77D76ABC2AA56BEE20585DBDB13583D1"
}

Wire E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
EndToEnd Reference between merchant and client Varchar(35) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

SEPA Direct Debits

Payment process

Prepare mandate

API endpoints:
Live - https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate

Prepares the mandate and returns the URL of the form in which the customer needs to fill some additional information. After this information is submitted, the mandate will start being processed by TrustPay together with possible payment (if pay now was chosen).

Request

Prepare mandate example:

using System;
using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string PrepareMandate(string token)
{
   string url = "https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PayNow = true,
         ReducedPeriod = 4,
         MerchantIdentification = new
         {
            ProjectId = "1234567",
         },
         PaymentInformation = new
         {
            DueDate = "2017-07-28",
            RemittanceInformation = "test123",
            Amount = new
             {
                Amount = 1.50,
                Currency = "EUR",
             },
            References = new
             {
                MerchantReference = "Order 12345",
                EndToEnd = "e2e",
             },
            SepaDirectDebitInformation = new
             {
                SequenceType = "RCUR",
             },
         },
         CallbackUrls = new
         {
            Notification = "https://somedomain.eu/notification_handler",
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function PrepareMandate($token)
{
   $url = 'https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate';
   $data = array(
      'PayNow' => 'true',
      'ReducedPeriod' => '',
      
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890',
      ),
      'PaymentInformation' => array(
         'DueDate' => '2017-07-28',
         'RemittanceInformation' => 'test123',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
         'References' => array(
            'MerchantReference' => '123456',
            'EndToEnd' => 'test123',
          ),
         'SepaDirectDebitInformation' => array(
            'SequenceType' => 'RCUR',
          ),
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler',
      ),
   );  
   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['PreparedMandateUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String PrepareMandate(String token){
    try{
        URL obj = new URL("https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public boolean PayNow = true;
            public Byte ReducedPeriod = null;
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public String DueDate = "2017-03-27";
                public String RemittanceInformation = "test";
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public String EndToEnd = "e2e";
                };
                public Object SepaDirectDebitInformation = new Object(){
                        public String SequenceType = "RCUR";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };

        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return deserialized.get("PreparedMandateUrl");
    }
    catch(Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PayNow Create first direct debit together with the mandate Boolean Yes
ReducedPeriod Reduces direct debit pre-notification period by up to 13 days. Byte No
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) For paynow
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount For paynow
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References For paynow
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format For paynow
Currency Currency of the payment Char(3) For paynow

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) For paynow
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
SequenceType Type of mandate:
RCUR - Recurrent payment
OOFF - One-off payment
Char(4)
en-US format
Yes

Request/CallbackUrls

Name Description Format Required
Success Url address to which the customer is redirected after successful payment (if PayNow was chosen) Varchar(256) No
Notification Url address to which the notifications regarding this payment should be sent (if PayNow was chosen) Varchar(256) No
Cancel Cancel URL (overrides default Cancel Return URL) Varchar(256) No
Error Error URL (overrides default Error Return URL) Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/SepaDirectDebitMandates/input/ba7db67e-7h73-4bt0-880f-7ec0f07b1c4e",
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl Url to site where Debtors credentials can be submited (sent only when call succeeded) Varchar(256)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Cancel mandate

API endpoints:
Live - https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate/[UMR]/Cancel

This function allows you to cancel an active mandate.

Request

Cancel mandate example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public void CancelMandate(string token)
{
   string url = "https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate/[UMR]/Cancel";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         Umr = "12345678901234567890"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = Encoding.UTF8.GetString(responseData);
      if (response == "{}")
      {
         return;
      }
      throw new Exception(serializer.Deserialize<dynamic>(response)["ResultMessage"]);
   }
}

function CancelMandate($token)
{
   $url = 'https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate/[UMR]/Cancel';
   $data = array('Umr' => '12345678901234567890'); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = file_get_contents($url, false, $context);
   if ($response == "{}"){
      return;
   }
   throw new Exception(json_decode($response, true)['ResultMessage']);
}

This code is using external library Jackson to parse text from and to json format
import org.codehaus.jackson.map.ObjectMapper; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Map; public void CancelMandate(String token){ try { URL obj = new URL("https://aapi.trustpay.eu/api/SepaDirectDebitMandates/Mandate/[UMR]/Cancel"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-type", "application/json"); Object request = new Object() { public String Umr = "12345678901234567890"; }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } if (response == "{}") { return; } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); throw new Exception(deserialized.get("PreparedMandateUrl")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
Umr Unique Mandate Reference of mandate that you want to cancel Char(20) Yes

Response

Response example:

{
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Capture payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Creates new direct debit accounted to an already existing mandate based on it's UMR (Unique Mandate Reference).

Request

Capture payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public int CapturePayment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567",
         },
         PaymentInformation = new
         {
             DueDate = "2017-07-28",
             RemittanceInformation = "test123",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR",
             },
             References = new
             {
                 MerchantReference = "Order 12345",
                 EndToEnd = "e2e",
             },
             SepaDirectDebitInformation = new
             {
                 MandateInformation = new
                 {
                     Umr = "12345678901234567890",
                 },
             },
         },
         CallbackUrls = new
         {
             Notification = "https://somedomain.eu/notification_handler",
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["PaymentRequestId"];
   }
}

function CapturePayment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890',
      ),
      'PaymentInformation' => array(
         'DueDate' => '2017-07-28',
         'RemittanceInformation' => 'test123',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
         'References' => array(
            'MerchantReference' => '123456',
            'EndToEnd' => 'test123',
          ),
          'SepaDirectDebitInformation' => array(
            'MandateInformation' => array(
              'Umr' => '12345678901234567890',
            ),
          ),
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler',
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['PaymentRequestId'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaDirectDebit";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public String DueDate = "2017-03-27";
                public String RemittanceInformation = "test";
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public String EndToEnd = "e2e";
                };
                public Object SepaDirectDebitInformation = new Object(){
                        public Object MandateInformation = new Object(){
                            public String Umr = "12345678901234567890";
                        };
                };
            };
            public Object CallbackUrls = new Object(){
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("PaymentRequestId"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Callback URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) Yes
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information Yes

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":1,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment requestId for the direct debit that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Capture payment with external mandate

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Creates new direct debit without previously creating a mandate in TrustPay. This API has the same request and response as Capture payment, with these additional parameters in the request:

Request

Capture payment with external mandate example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public int CapturePayment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567",
         },
         PaymentInformation = new
         {
             DueDate = "2017-07-28",
             RemittanceInformation = "test123",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR",
             },
             References = new
             {
                 MerchantReference = "Order 12345",
                 EndToEnd = "e2e",
             },
             SepaDirectDebitInformation = new
             {
                 SequenceType = "FRST",
                 MandateInformation = new
                 {
                     Umr = "12345678901234567890",
                     SignatureCity = "Bratislava",
                     SignatureDate = "2017-07-28",
                 },
             },
             Debtor = new
             {
                 Name = "John Doe",
                 Email = "client@somedomain.eu",
                 IpAddress = "1.2.3.4",
                 Address = new
                 {
                     PostCode  = "12345",
                     City = "Bratislava",
                     CountryCode = "SK",
                     Lines = new[]
                     {
                         "Street 1/A",
                     },
                 },
             },
             DebtorAccount = new
             {
                 Iban = "SK3112000000198742637541",
             },
             DebtorAgent = new
             {
                 Bic = "TPAYSKBX",
             },
         },
         CallbackUrls = new
         {
             Notification = "https://somedomain.eu/notification_handler",
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["PaymentRequestId"];
   }
}

function CapturePayment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
    $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
          'ProjectId' => '1234567890',
      ),
      'PaymentInformation' => array(
          'DueDate' => '2017-07-28',
          'RemittanceInformation' => 'test123',
          'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR',
          ),
          'References' => array(
            'MerchantReference' => '123456',
            'EndToEnd' => 'test123',
          ),
          'SepaDirectDebitInformation' => array(
            'SequenceType' => 'FRST',
            'MandateInformation' => array(
                'Umr' => '12345678901234567890',
                'SignatureCity' => 'Bratislava',
                'SignatureDate' => '2017-07-28',
             ),
          ),
          'Debtor' => array(
            'Name' => 'John Doe',
            'Email' => 'client@somedomain.eu',
            'IpAddress' => '1.2.3.4',
            'Address' => array(
                'PostCode' => '12345',
                'City' => 'Bratislava',
                'CountryCode' => 'SK',
                'Lines' => array('Street 1/A'),
             ),
          ),
          'DebtorAccount' => array(
            'Iban' => 'SK3112000000198742637541',
          ),
          'DebtorAgent' => array(
            'Bic' => 'TPAYSKBX',
          ),
      ),
      'CallbackUrls' => array(
         'Notification' => 'https://somedomain.eu/notification_handler',
      ),
    ); 

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['PaymentRequestId'];
}

    This code is using external library Jackson to parse text from and to json format

    import org.codehaus.jackson.map.ObjectMapper;
    import javax.net.ssl.HttpsURLConnection;
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.util.Map;

    public String CapturePayment(String token){
    try {
    URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
    HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    con.setRequestProperty("Authorization", "Bearer " + token);
    con.setRequestProperty("Content-type", "application/json");
    Object request = new Object() {
    public String PaymentMethod = "SepaDirectDebit";
    public Object MerchantIdentification = new Object(){
    public long ProjectId = 4107123456;
    public String Currency = "EUR";
    };
    public Object PaymentInformation = new Object(){
    public String DueDate = "2017-03-27";
    public String RemittanceInformation = "test";
    public Object Amount = new Object(){
    public double Amount = 1.50;
    };
    public Object References = new Object(){
    public String MerchantReference = "merch ref. no. #555";
    public String EndToEnd = "e2e";
    };
    public Object SepaDirectDebitInformation = new Object(){
    public String SequenceType = "FRST";
    public Object MandateInformation = new Object(){
    public String Umr = "12345678901234567890";
    public String SignatureDate = "2020-06-01";
    public String SignatureCity = "Bratislava";
    };
    };
    public Object Debtor = new Object(){
    public String Name = "John Doe";
    public String Email = "client@somedomain.eu";
    public String IpAddress = "1.2.3.4";
    public Object Address = new Object(){
    public String PostCode = "12345";
    public String City = "Bratislava";
    public String CountryCode = "SK";
    public String[] Lines  = {"Street 1/A"};
    };
    };
    public Object DebtorAccount = new Object(){
    public String Iban = "SK3112000000198742637541";
    };
    public Object DebtorAgent = new Object(){
    public String Bic = "TPAYSKBX";
    };
    };
    public Object CallbackUrls = new Object(){
    public String Notification = "https://somedomain.eu/notification_handler";
    };
    };
    ObjectMapper JsonParser = new ObjectMapper();
    String jsonrequest = JsonParser.writeValueAsString(request);
    con.setDoOutput(true);

    try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
    wr.writeBytes(jsonrequest);
    wr.flush();
    }

    String response = "";
    try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
    String inputLine;
    while ((inputLine = in.readLine()) != null) {
    response += inputLine;
    }
    }

    Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
    return String.valueOf(deserialized.get("PaymentRequestId"));
    }
    catch (Exception ex){
    throw new RuntimeException(ex.getMessage());
    }
    }
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant Merchant Identification Yes
PaymentInformation Payment information Payment Information Yes
CallbackUrls Callback URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) Yes
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Yes
Debtor Debtor information Debtor Information Yes
DebtorAccount Debtor Account information Debtor Account Information Yes
DebtorAgent Debtor Agent information Debtor Agent Information No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
SequenceType Type of direct debit payment:
FRST - First payment
FNAL - Final payment
RCUR - Recurrent payment
OOFF - One-off payment
Char(4) Yes
MandateInformation Mandate Information Mandate Information Yes

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) Yes
SignatureDate Signature date of the mandate Varchar(10) Yes
SignatureCity Signature city of the mandate Varhar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
Name Debtor's name Varchar(70) Yes
Email Debtor's email address Varhar(320) No
IpAddress Debtor's IP address (IPv4 / IPv6) Varhar(15) No
Address Debtor's address Address Yes

Request/PaymentInformation/Debtor/Address

Name Description Format Required
PostCode Debtor's postal code Varchar(16) Yes
City Debtor's city Varchar(35) Yes
CountryCode Debtor's country (ISO 3166-1 alpha-2) Char(2) Yes
Lines Address lines string[] Yes

Request/PaymentInformation/DebtorAccount

Name Description Format Required
Iban Debtor's Iban Varchar(34) Yes

Request/PaymentInformation/DebtorAgent

Name Description Format Required
Bic Debtor's bank Bic Varchar(11) No

Request/CallbackUrls

Name Description Format Required
Notification Url address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":1,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment requestId for the direct debit that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Cancel direct debit

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Cancel

This function allows you to reject a direct debit.

Request

Cancel direct debit example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string CancelDirectDebit(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Cancel";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
        
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();
                
      var requestdata = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestdata);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));
      if (Encoding.UTF8.GetString(responseData) == "{}")
      {
         return "DirectDebit was canceled";
      }
      return response["ResultInfo"];
   }
}

function CancelDirectDebit($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Cancel';
   $data = array(
      
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = file_get_contents($url, false, $context);
   if ($response == "{}"){
      return null;
   }
   throw new Exception(json_decode($response, true)['ResultInfo']);
}

This code is using external library Jackson to parse text from and to json format
import org.codehaus.jackson.map.ObjectMapper; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Map; public String CancelDirectDebit(String token){ try { URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment/[PaymentRequestId]/Cancel"); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-type", "application/json"); Object request = new Object() { }; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } System.out.println(response); Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return deserialized.get("ResultInfo"); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentRequestId Identification number of direct debit that should be canceled Char(20) Yes

Response

Response example:

{
    "ResultInfo": {
        "ResultCode": 1130000,
        "AdditionalInfo": "Cancel was successful"
    }
}
Name Description Format
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

DirectDebit notifications

DirectDebit URL notification example:
https://example.handler.com/

{
  "PaymentMethod": "SepaDirectDebit",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "StatusReasonInformation": {
      "Reason": {
        "Code": "MD06"
      }
    },
    "References": {
      "MerchantReference": "1234567890",
      "EndToEnd": "e2eReference",
      "PaymentId": "49863043"
    },
    "Debtor": {
      "Name": "John"
    },
    "DebtorAccount": {
      "Iban": "DE75512108001245126199"
    },
    "DebtorAgent": {
      "Bic": "SOGEDEFF"
    },
    "Creditor": {
      "Name": "John"
    },
    "CreditorAccount": {
      "Iban": "DE75512108001245126199"
    },
    "CreditorAgent": {
      "Bic": "SOGEDEFF"
    },
    "SepaDirectDebitInformation": {
      "MandateInformation": {
        "UMR": "31011111110000001234"
      }
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

DirectDebit E-mail notification: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid, Rejected Varchar(50) Always
References Reference (merchant’s payment identification) References Always
StatusReasonInformation If available then Status reason for the Rejected payment StatusReasonInformation Only Rejected
Debtor Debtor details Debtor Only for CRDT
DebtorAccount Debtor's account details DebtorAccount Only for CRDT
DebtorAgent Debtor's agent details DebtorAgent Only for CRDT
Creditor Creditor details Creditor Only for DBIT
CreditorAccount Creditor's account details CreditorAccount Only for DBIT
CreditorAgent Creditor's agent details CreditorAgent Only for DBIT
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
EndToEnd Reference between merchant and client Varchar(35) Always
PaymentId Id of payment Numeric(20) Always

Notification/PaymentInformation/StatusReasonInformation

Name Description Format Included
Reason Reason Reason If reason specified

Notification/PaymentInformation/StatusReasonInformation/Reason

Name Description Format Included
Code Code Varchar(4) If reason specified

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar Always
Address Debtor's address Address Always

Notification/PaymentInformation/Creditor

Name Description Format Included
Name Creditor's name Varchar Always

Notification/PaymentInformation/Debtor/Address

Name Description Format Included
CountryCode Country code ISO 3166-1 alpha-2 Char(2) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's IBAN Char(22) Always

Notification/PaymentInformation/CreditorAccount

Name Description Format Included
Iban Creditor's IBAN Char(22) Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's agent's bank identifier code Varchar(11) Always

Notification/PaymentInformation/CreditorAgent

Name Description Format Included
Bic Creditor's agent's bank identifier code Varchar(11) Always

Notification/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate details Mandate Information Always

Notification/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Always
UMR Unique Mandate Reference Unique Yes

Mandate notifications

Mandate URL notification example:
https://example.handler.com/result.php?AID=4107111111&UMR=12345678901234567890

{
  "PaymentMethod": "SepaDirectDebit",
  "MerchantIdentification": {
    "ProjectId": "4101111111",
    "CID": "12345678"
  },
  "PayNow": "True",
  "ReducedPeriod": "3",
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "References": {
      "MerchantReference": "1234567890"
    },
    "Debtor": {
      "Name": "John",
      "Email": "Smith",
      "Address": {
        "Lines": [
          "221B Baker St"
        ],
        "City": "London",
        "CountryCode": "UK",
        "PostCode": "NW1 6XE"
      }
    },
    "DebtorAccount": {
      "Iban": "DE75512108001245126199"
    },
    "DebtorAgent": {
      "Bic": "SOGEDEFF"
    },
    "DueDate": "2/14/2021",
    "SepaDirectDebitInformation": {
      "SequenceType": "RCUR",
      "MandateInformation": {
        "UMR": "31011111110000001234",
        "SigningCity": "London",
        "SigningDate": "2/14/2021"
      }
    }
  }
}

Mandate E-mail notification: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PayNow Create first direct debit together with the mandate Boolean Always
ReducedPeriod Reduces direct debit pre-notification period by up to 13 days. Byte Always
PaymentInformation Payment information PaymentInformation Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always
CID Company identifier (assigned by TrustPay) Unique Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount For paynow
References Reference (merchant’s payment identification) References For paynow
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account details DebtorAccount Always
DebtorAgent Debtor's agent details DebtorAgent Always
DueDate Date to which the transaction should be carried out Varchar(10) For paynow
SepaDirectDebitInformation Mandate information SepaDirectDebit Information Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format For paynow
Currency Currency of the payment Char(3) For paynow

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(35) Always
EndToEnd Reference between merchant and client Varchar(35) For paynow

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar Always
Email Debtor's email address Varchar Always
Address Debtor's address Address Always

Notification/PaymentInformation/Debtor/Address

Name Description Format Included
Lines Address lines Array of Varchar Always
City City Varchar Always
CountryCode Country code ISO 3166-1 alpha-2 Char(2) Always
PostCode Postal code Varchar Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's IBAN Char(22) Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's agent's bank identifier code Varchar(11) Always

Notification/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
SequenceType Type of mandate:
RCUR - Recurrent payment
OOFF - One-off payment
Char(4)
en-US format
Yes
MandateInformation Mandate details Mandate Information Always

Notification/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Always
UMR Unique Mandate Reference Unique Yes
SigningCity Place of signature Varchar Yes
SigningDate Date of signature Varchar(10) Yes

SkipPay

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new SkipPay payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SkipPay",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "CZK"
             },
             Localization = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             Debtor = new 
             {
                 FirstName = "John",
                 LastName = "Doe",
                 Email = "email@example.com",
                 Phone = "+420123456789"
             },
             OrderedItems = new []
             {    
                 new 
                 {
                     Code = "1",
                     Name = "Item1",
                     Price = 1.50,
                     Vat = 0.15,
                     VatRate = 10
                 }
             },
            FinancingType = "DEFERRED_PAYMENT"
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SkipPay',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'CZK'
          ),
         'Localization' => 'SK',
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'Debtor' => array(
            'FirstName' => 'John',
            'LastName' => 'Doe',
            'Email' => 'email@example.com',
            'Phone' => '+420123456789'
          ),
          'OrderedItems' => array(
            array(
              'Code' => '1',
              'Name' => 'Item1',
              'Price' => '1.50',
              'Vat' => '0.15',
              'VatRate' => '10'
            )
          ),
          'FinancingType' => 'DEFERRED_PAYMENT'
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SkipPay";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "CZK";
                };
                public String Localization = "SK";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public Object Debtor = new Object(){
                    public String FirstName = "John";
                    public String LastName = "Doe";
                    public String Email = "email@example.com";
                    public String Phone = "+420123456789";
                };
                public Object[] OrderedItems = new Object[]{
                    new Object(){
                        public String Code = "1";
                        public String Name = "Item1";
                        public double Price = 1.50;
                        public double Vat = 0.15;
                        public int VatRate = 10;
                    };
                };
                public String FinancingType = "DEFERRED_PAYMENT";
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SkipPay Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Localization Localization Char(2) No
References Reference (merchant’s payment identification) References Yes
Debtor Debtor Debtor Yes
OrderedItems Array of ordered items OrderedItem Yes
FinancingType Financing type Varchar Yes

Request/PaymentInformation/FinancingType

FinancingType
DEFERRED_PAYMENT
PAY_IN_THREE

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places)
DEFERRED_PAYMENT Min: 3000.00 Max: 60000.00
PAY_IN_THREE Max: 10000.00
Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. CZK.

List of currencies

Code ID Name
CZK 203 Czech koruna

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
FirstName FirstName Varchar(50) Yes
LastName LastName Varchar(50) Yes
Email Email Varchar(254) Yes
Phone Phone Varchar(13) Yes

Request/PaymentInformation/OrderedItem

Name Description Format Required
Code Code Varchar(200) Yes
Name Name Varchar(255) Yes
Price Price Numeric(13,2) en-US format Yes
Vat VAT Numeric(13,2) en-US format Yes
VatRate VAT rate Numeric Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

SkipPay notifications v3

SkipPay URL notification v3 example:
https://example.handler.com/

    {
    "PaymentMethod": "SkipPay",
    "MerchantIdentification": {
    "ProjectId": "4101111111"
    },
    "PaymentInformation": {
    "Amount": {
    "Amount": "25.00",
    "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
    "MerchantReference": "1234567890",
    "PaymentId": "49863043",
    "PaymentRequestId": "1234"
    },
    "Debtor": {
    "Name": "Test name"
    },
    "DebtorAccount": {
    "Iban": "DE35940594210032507931"
    }
    "DebtorAgent": {
    "Bic": "TESTDETT421"
    }
    },
    "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
    }

SkipPay E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Sofort

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Sofort payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Sofort",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Sofort',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Sofort";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "SK";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Sofort Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Localization Char(2) No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Payment (recurring)

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Sofort recurring payment request using direct debit. The debtor's name and IBAN from the original Sofort payment request will be used to initiate the direct debit.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "SepaDirectDebit",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             DueDate = "2022-05-25",
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345",
                 OriginalPaymentRequestId = 73807
             }
             Debtor = new
             {
                 Email = "example@example.org",
                 IpAddress = "1.2.3.4",
             },
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}

function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'SepaDirectDebit',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'DueDate' => '2022-05-25',
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
            'OriginalPaymentRequestId' => '73807'
          ),
         'Debtor' => array(
            'Email' => 'example@example.org'
            'IpAddress' => '1.2.3.4'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "SepaDirectDebit";
            public String DueDate = "2022-05-25";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                        public long OriginalPaymentRequestId = 73807;
                };
                public Object Debtor = new Object(){
                        public String Email = "example@example.org";
                        public String IpAddress = "1.2.3.4";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod SepaDirectDebit Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
DueDate Date to which the transaction should be carried out Varchar(10) No
RemittanceInformation Remittance advice - additional information Varchar(35) No
Amount Amount of the payment Amount Yes
Localization Language Varchar(2) No
References Reference (merchant’s payment identification) References Yes
SepaDirectDebitInformation Mandate information SepaDirectDebit Information No
Debtor Debtor information Debtor No

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
EUR 978 Euro

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes
OriginalPaymentRequestId PaymentRequestId of the original Sofort payment request Numeric(20) Yes
EndToEnd Reference between merchant and client Varchar(35) No

Request/PaymentInformation/SepaDirectDebitInformation

Name Description Format Required
MandateInformation Mandate Information Mandate Information No

Request/PaymentInformation/SepaDirectDebitInformation/MandateInformation

Name Description Format Required
Umr Unique Mandate Reference of mandate to which should this payment be assigned Varchar(35) No

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No
IpAddress Debtor's IP address IPv4 address No

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ErrorCode Id of error that occurred during service call (sent only when call failed) Numeric(10)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Sofort notifications v3

Sofort URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Sofort",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    },
    "Debtor": {
      "Name": "Test name"
    },
    "DebtorAccount": {
      "Iban": "DE35940594210032507931"
    }
    "DebtorAgent": {
      "Bic": "TESTDETT421"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Sofort E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Trustly

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new Trustly payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "Trustly",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "SK",
             Country = "SK",
             References = new
             {
                 MerchantReference = "Order 12345"
             },
             Debtor = new
             {
                FirstName = "John",
                LastName = "Brown",
                Identification = new
                {
                    Id = "123456"
                }
            }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'Trustly',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'SK',
         'Country' => 'SK'
         'References' => array(
            'MerchantReference' => '123456'
          ),
         'Debtor' => array(
            'FirstName' => 'John',
            'LastName' => 'Brown',
            'Identification' => array(
                'Id' => '123456'
            )
         )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "Trustly";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "SK";
                public String Country = "SK"
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
                public Object Debtor = new Object(){
                        public String FirstName = "John";
                        public String LastName = "Brown";
                        public Object Identification = new Object(){
                            public String Id = "123456";
                        };
                };                   
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod Trustly Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Localization Used to pre-select the language on the Trustly page. (ISO 639-1 format) Char(2) Yes
Country Used for pre-selecting the country for the end-user on the Trustly page. (ISO 3166-2 format) Char(2) Yes
References Reference (merchant’s payment identification) References Yes
RemittanceInformation Description of payment Char(127) Yes
Debtor Debtor information Debtor Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
DKK 208 Danish Krone
EUR 978 Euro
NOK 578 Norwegian Krone
SEK 752 Swedish Krona
GBP 826 Pound sterling

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/PaymentInformation/Debtor

Name Description Format Required
FirstName Debtor's first name Varchar Yes
LastName Debtor's last name Varchar Yes
Identification Debtor's identification on the merchant platform Identification Yes
Email Debtor's email address Varchar No

Request/PaymentInformation/Debtor/Identification

Name Description Format Required
Id Identifier of the buyer account on the merchant platform Varchar Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) Yes*
Error URL address to which the customer is redirected after payment processing failed Varchar(256) Yes*
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to the Trustly payment page Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

Trustly notifications v3

Trustly URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "Trustly",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

Trustly E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

WeChatPay

Payment process

Payment

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment

Initiates new WeChatPay payment request.

Request

Payment example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string Payment(string token)
{
   string url = "https://aapi.trustpay.eu/api/Payments/Payment";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         PaymentMethod = "WeChatPay",
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         PaymentInformation = new
         {
             Amount = new
             {
                 Amount = 1.50,
                 Currency = "EUR"
             },
             Localization = "en",
             References = new
             {
                 MerchantReference = "Order 12345"
             }
         },
         CallbackUrls = new
         {
             Success = "https://somedomain.eu/success",
             Cancel = "https://somedomain.eu/cancel",
             Error = "https://somedomain.eu/error",
             Notification = "https://somedomain.eu/notification_handler"
         }
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      var responseData = client.UploadData(url, requestData);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));

      return response["GatewayUrl"];
   }
}


function Payment($token)
{
   $url = 'https://aapi.trustpay.eu/api/Payments/Payment';
   $data = array(
      'PaymentMethod' => 'WeChatPay',
      'MerchantIdentification' => array(
         'ProjectId' => '1234567890'
      ),
      'PaymentInformation' => array(
         'Amount' => array(
            'Amount' => '1.50',
            'Currency' => 'EUR'
          ),
         'Localization' => 'en',
         'References' => array(
            'MerchantReference' => '123456'
          )
      ),
      'CallbackUrls' => array(
         'Success' => 'https://somedomain.eu/success',
         'Cancel' => 'https://somedomain.eu/cancel',
         'Error' => 'https://somedomain.eu/error',
         'Notification' => 'https://somedomain.eu/notification_handler'
      ),
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   $response = json_decode(file_get_contents($url, false, $context), true);
   return $response['GatewayUrl'];
}


This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public String CapturePayment(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public String PaymentMethod = "WeChatPay";
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 4107123456;
            };
            public Object PaymentInformation = new Object(){
                public Object Amount = new Object(){
                        public double Amount = 1.50;
                        public String Currency = "EUR";
                };
                public String Localization = "en";
                public Object References = new Object(){
                        public String MerchantReference = "merch ref. no. #555";
                };
            };
            public Object CallbackUrls = new Object(){
                public String Success = "https://somedomain.eu/success";
                public String Cancel = "https://somedomain.eu/cancel";
                public String Error = "https://somedomain.eu/error";
                public String Notification = "https://somedomain.eu/notification_handler";
            };
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        String response = "";
        try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                response += inputLine;
            }
        }

        Map<String,String> deserialized = JsonParser.readValue(response, Map.class);
        return String.valueOf(deserialized.get("GatewayUrl"));
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}

Initiate response:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}

   
HTML code:

<script type="text/javascript" src="https://mapi.trustpay.eu/mapi5/Scripts/TrustPay/popup.js"></script>
<iframe id="TrustPayFrame" src="https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2"></iframe>
<a href="#" class="show-popup">Pay via TrustPay</a>
    
Name Description Format Required
Token Authorization token Varchar(235) Yes
PaymentMethod WeChatPay Varchar Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
PaymentInformation Payment information PaymentInformation Yes
CallbackUrls Return URLs CallbackUrls No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/PaymentInformation

Name Description Format Required
Amount Amount of the payment Amount Yes
Debtor Debtor information Debtor Information No
Localization Localization Char(2) No
IsRedirect IsRedirect=True parameter is mandatory when the payment gateway is not loaded inside an iframe Boolean No
References Reference (merchant’s payment identification) References Yes

Request/PaymentInformation/Amount

Name Description Format Required
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Yes
Currency Currency of the payment Char(3) Yes

Request/PaymentInformation/Amount/Currency

Use ISO-4217 alphabetical code as a currency, e.g. EUR.

List of currencies

Code ID Name
CNY 156 Yuan Renminbi
EUR 978 Euro

Request/PaymentInformation/Debtor

Name Description Format Required
Email Debtor's email address Varchar No

Request/PaymentInformation/References

Name Description Format Required
MerchantReference Reference (merchant’s payment identification) Varchar(35) Yes

Request/CallbackUrls

Name Description Format Required
Success URL address to which the customer is redirected after successful payment Varchar(256) No
Cancel URL address to which the customer is redirected after payment is canceled Varchar(256) No
Error URL address to which the customer is redirected after payment processing failed Varchar(256) No
Notification URL address to which the notifications regarding this payment should be sent Varchar(256) No

Response

Response example:

{
    "GatewayUrl":"https://aapi.trustpay.eu/Payments/Gateway?paymentRequestId=123123&sig=58B2FA9C45AEE707FFB6A4A0749D2",
    "PaymentRequestId":123123,
    "ResultInfo": {
        "ResultCode": 1001000,
        "AdditionalInfo": "Success"
    }
}
Name Description Format
GatewayUrl URL to site where Customer should be redirected to complete the payment (sent only when call succeeded) Varchar(256)
PaymentRequestId Id of payment request that was just created (sent only when call succeeded) Numeric(20)
ResultInfo Contains result information. ResultInfo

Response/ResultInfo

Name Description
ResultCode Code of the result that occurred. Numeric(10)
AdditionalInfo Description of result that occurred during the service call. Varchar(235)
CorrelationId Correlation Id is only shown when an error occurs. It's a GUID of the error log in our internal system. Varchar(36)

WeChatPay notifications v3

WeChatPay URL notification v3 example:
https://example.handler.com/

{
  "PaymentMethod": "WeChatPay",
  "MerchantIdentification": {
    "ProjectId": "4101111111"
  },
  "PaymentInformation": {
    "Amount": {
      "Amount": "25.00",
      "Currency": "EUR"
    },
    "CreditDebitIndicator": "CRDT",
    "Status": "Paid",
    "References": {
      "MerchantReference": "1234567890",
      "PaymentId": "49863043",
      "PaymentRequestId": "1234"
    }
  },
  "Signature": "013B192245EF81995E3F219E064F42DC1E1F4A6BC67CB546E1CCA6DC35E5CB73"
}

WeChatPay E-mail notification v3: contains the same JSON notification in message body.
Name Description Format Included
PaymentMethod Payment method Varchar(50) Always
MerchantIdentification Identification of merchant MerchantIdentification Always
PaymentInformation Payment information PaymentInformation Always
Signature Signature Char(64) Always

Notification/MerchantIdentification

Name Description Format Included
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Always

Notification/PaymentInformation

Name Description Format Included
Amount Amount of the payment Amount Always
CreditDebitIndicator Values: CRDT or DBIT Varchar(4) Always
Status Status of payment, values: Paid Varchar(50) Always
References Reference (merchant’s payment identification) References Always
Debtor Debtor details Debtor Always
DebtorAccount Debtor's account DebtorAccount Always
DebtorAgent Debtor's agent DebtorAgent Always

Notification/PaymentInformation/Amount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always

Notification/PaymentInformation/References

Name Description Format Included
MerchantReference Reference (merchant’s payment identification) Varchar(512) Always
PaymentId Id of payment Numeric(20) Always
PaymentRequestId Id of payment request Numeric(20) Always
OriginalPaymentId Id of original payment Numeric(20) Refund
OriginalPaymentRequestId Id of original payment request Numeric(20) Refund

Notification/PaymentInformation/Debtor

Name Description Format Included
Name Debtor's name Varchar(140) Always

Notification/PaymentInformation/DebtorAccount

Name Description Format Included
Iban Debtor's Iban Varchar Always

Notification/PaymentInformation/DebtorAgent

Name Description Format Included
Bic Debtor's Bic Varchar Always

Payment State

Get Payment State

API endpoints:
Live - https://aapi.trustpay.eu/api/Payments/Payment/{paymentRequestId}

Lets you check the state of any payment you have made.

Request

Obtain payment state example:

using System;
using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public string GetPaymentState(long paymentRequestId, string token)
{
   using (var client = new WebClient())
   {
      string url = FormattableString.Invariant($"https://aapi.trustpay.eu/api/Payments/Payment/{paymentRequestId}")
      client.Headers = new WebHeaderCollection
      {
          "Authorization: Bearer " + token,
          "Content-Type: application/json"
      }

      JavaScriptSerializer serializer = new JavaScriptSerializer();
      var responseData = client.DownloadData(url);
      var response = serializer.Deserialize<dynamic>(Encoding.UTF8.GetString(responseData));
      return response["PaymentInformation"];
   }
}

$baseUrl = 'https://aapi.trustpay.eu/api/Payments/Payment/';
$paymentRequestId = '0';
$url = $baseUrl.$paymentRequestId
$data = array();

$token = GetToken("abcdef", "123abc");

$options = array(
   'http' => array(
      'header'  => array(
         "Authorization: Bearer $token",
         'Content-type: application/json',
      ),
      'method'  => 'GET',            
      'content' => json_encode($data)
   ),
);
$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$response = json_decode(file_get_contents($url, false, $context), true);
return $response['State'];

This code is using external library Jackson to parse text from and to json format
import org.codehaus.jackson.map.ObjectMapper; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Map; public String PaymentState(long paymentRequestId, String token){ try { URL obj = new URL("https://aapi.trustpay.eu/api/Payments/Payment/" + paymentRequestId); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-type", "application/json"); Object request = new Object() {}; ObjectMapper JsonParser = new ObjectMapper(); String jsonrequest = JsonParser.writeValueAsString(request); con.setDoOutput(true); try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { wr.writeBytes(jsonrequest); wr.flush(); } String response = ""; try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; while ((inputLine = in.readLine()) != null) { response += inputLine; } } Map<String,String> deserialized = JsonParser.readValue(response, Map.class); return String.valueOf(deserialized.get("State")); } catch (Exception ex){ throw new RuntimeException(ex.getMessage()); } }

Response

Response is notifications V3 format of payment method used to make the payment. Additionally, RefundedAmount is present in PaymentInformation.

PaymentInformation/RefundedAmount

Name Description Format Included
Amount Amount of the payment (exactly 2 decimal places) that is already refunded Numeric(13,2) en-US format Always
Currency Currency of the payment Char(3) Always
Response example:

    {
        "PaymentMethod": "Card",
        "MerchantIdentification": {
            "ProjectId": "41071234"
        },
        "PaymentInformation": {
            "Amount": {
                "Amount": 123.45,
                "Currency": "EUR"
            },
            "CreditDebitIndicator": "CRDT",
            "Status": "Rejected",
            "StatusReasonInformation": {
                "Reason": {
                    "Code": "400.100.008",
                    "RejectReason": "General error"
                }
            },
            "References": {
                "MerchantReference": "merchant reference",
                "PaymentId": "12345678",
                "PaymentRequestId": "12345",
                "ClearingSystemReference": "6640.2103.6494"
            },
            "Debtor": {
                "Name": "John Debtor"
            },
            "CardTransaction": {
                "Card": {
                    "MaskedPan": "420000******0000",
                    "ExpiryDate": "12/21",
                    "SubType": "GooglePay"
                }
            },
            "RefundedAmount": {
                "Amount": 10.00,
                "Currency": "EUR"
            }
        }
    }

Statements

Daily Statements

API endpoints:
Live - https://aapi.trustpay.eu/api/Statements/Statement

Retrieves daily statement based on currency and date range.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] Statement(string token)
{
   string url = "https://aapi.trustpay.eu/api/Statements/Statement";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Transactions",
         Format = "PDF",
         FilterInformation = new
         {
            Currency = "EUR",
            DateFrom = "2021-07-10",
            DateTo = "2021-07-20"
         },
         Localization = "sk"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function Statement($token)
{
   $url = 'https://aapi.trustpay.eu/api/Statements/Statement';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Transactions',
      'Format' => 'PDF',
      'FilterInformation' => array(
         'Currency' => 'EUR',
         'DateFrom' => '2021-07-10',
         'DateTo' => '2021-07-20'
      ),
      'Localization' => 'sk'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] Statement(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Statements/Statement");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Transaction";
            public String Format = "PDF";
            public Object FilterInformation = new Object(){
                public String Currency = "EUR";
                public String DateFrom = "2021-07-10";
                public String DateTo = "2021-07-20";
            };
            public String Localization = "sk";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Daily statement type StatementType Yes
Format Statement format StatementFormat Yes
FilterInformation Statement filter information FilterInformation Yes
Localization Language Varchar(2) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
Currency Currency Char(3) Yes
DateFrom Date from Char(10) Yes
DateTo Date to Char(10) Yes

Response

The statement in the requested format (CSV, PDF, XML) or JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1122006,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code AccountCurrencyNotAllowed occurred. AccountCurrencyNotAllowed\r\nReturning result code AccountCurrencyNotAllowed"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Daily statement Types

Value
Transactions
Fees
RollingReserves
Payout
Autorefunds
Frauds
PayPalTransactions
Disputes

Statement Formats

Value Supported types
CSV Transactions, Fees, RollingReserves, Payout, Autorefunds, Frauds, PayPalTransactions, Disputes
PDF Transactions, Fees, RollingReserves, Payout, PayPalTransactions, Disputes
XML Transactions

Payout Statements

API endpoints:
Live - https://aapi.trustpay.eu/api/Statements/Statement

Retrieves payout statement based on currency and payout date or payout reference.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] Statement(string token)
{
   string url = "https://aapi.trustpay.eu/api/Statements/Statement";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Payout",
         Format = "PDF",
         FilterInformation = new
         {
            Currency = "EUR",
            PayoutDate = "2021-07-10"
         },
         Localization = "sk"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function Statement($token)
{
   $url = 'https://aapi.trustpay.eu/api/Statements/Statement';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Payout',
      'Format' => 'PDF',
      'FilterInformation' => array(
         'Currency' => 'EUR',
         'PayoutDate' => '2021-07-10'
      ),
      'Localization' => 'sk'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] Statement(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Statements/Statement");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Payout";
            public String Format = "PDF";
            public Object FilterInformation = new Object(){
                public String Currency = "EUR";
                public String PayoutDate = "2021-07-10";
            };
            public String Localization = "sk";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Payout Varchar Yes
Format Statement format StatementFormat Yes
FilterInformation Statement filter information FilterInformation Yes
Localization Language Varchar(2) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
Currency Currency Char(3) Yes
PayoutDate Date of payout Char(10) No*
PayoutReference Reference of payout Varchar No*

* Either PayoutDate or PayoutReference is mandatory.

Response

The statement in the requested format (CSV, PDF) or JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1122006,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code AccountCurrencyNotAllowed occurred. AccountCurrencyNotAllowed\r\nReturning result code AccountCurrencyNotAllowed"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Autorefunds Statements

API endpoints:
Live - https://aapi.trustpay.eu/api/Statements/Statement

Retrieves autorefunds statement based on date range.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] Statement(string token)
{
   string url = "https://aapi.trustpay.eu/api/Statements/Statement";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Autorefunds",
         Format = "CSV",
         FilterInformation = new
         {
            DateFrom = "2021-07-10",
            DateTo = "2021-07-20"
         },
         Localization = "sk"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function Statement($token)
{
   $url = 'https://aapi.trustpay.eu/api/Statements/Statement';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Autorefunds',
      'Format' => 'CSV',
      'FilterInformation' => array(
         'DateFrom' => '2021-07-10',
         'DateTo' => '2021-07-20'
      ),
      'Localization' => 'sk'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] Statement(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Statements/Statement");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Autorefunds";
            public String Format = "CSV";
            public Object FilterInformation = new Object(){
                public String DateFrom = "2021-07-10";
                public String DateTo = "2021-07-20";
            };
            public String Localization = "sk";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Autorefunds Varchar Yes
Format Statement format StatementFormat Yes
FilterInformation Statement filter information FilterInformation Yes
Localization Language Varchar(2) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
DateFrom Date from Char(10) Yes
DateTo Date to Char(10) Yes

Response

The statement in the requested format (CSV) or JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1042012,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code StatementNotAvailable occurred. StatementNotAvailable\r\nReturning result code StatementNotAvailable"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Frauds Statements

API endpoints:
Live - https://aapi.trustpay.eu/api/Statements/Statement

Retrieves frauds statement based on date range.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] Statement(string token)
{
   string url = "https://aapi.trustpay.eu/api/Statements/Statement";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Frauds",
         Format = "CSV",
         FilterInformation = new
         {
            Currency = "EUR",
            DateFrom = "2021-07-10",
            DateTo = "2021-07-20"
         },
         Localization = "sk"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function Statement($token)
{
   $url = 'https://aapi.trustpay.eu/api/Statements/Statement';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Frauds',
      'Format' => 'CSV',
      'FilterInformation' => array(
         'DateFrom' => '2021-07-10',
         'DateTo' => '2021-07-20'
      ),
      'Localization' => 'sk'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] Statement(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Statements/Statement");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Frauds";
            public String Format = "CSV";
            public Object FilterInformation = new Object(){
                public String DateFrom = "2021-07-10";
                public String DateTo = "2021-07-20";
            };
            public String Localization = "sk";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Frauds Varchar Yes
Format Statement format StatementFormat Yes
FilterInformation Statement filter information FilterInformation Yes
Localization Language Varchar(2) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
DateFrom Date from Char(10) Yes
DateTo Date to Char(10) Yes

Response

The statement in the requested format (CSV) or JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1042012,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code StatementNotAvailable occurred. StatementNotAvailable\r\nReturning result code StatementNotAvailable"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Exports

Export transactions

API endpoints:
Live - https://aapi.trustpay.eu/api/Exports/ExportTransactions

Retrieves transactions export based on the filter criteria. Timestamps are UTC by default. Optionally, when TimeZone parameter is used, the timestamps are converted to the requested timezone.

Request

Request example:

    using System.Net;
    using System.Text;
    using System.Web.Script.Serialization;

    public byte[] ExportTransactions(string token)
    {
    string url = "https://aapi.trustpay.eu/api/Exports/ExportTransactions";
    using (var client = new WebClient())
    {
    client.Headers = new WebHeaderCollection
    {
    "Authorization: Bearer " + token,
    "Content-Type: application/json"
    };
    var request = new
    {
    MerchantIdentification = new
    {
    ProjectId = "1234567"
    },
    Type = "Card",
    State = new[] { "Processed", "Refunded", "Pending", "Rejected", "Chargebacked", "Expired", "Preauthorized", "Authorized", "Canceled" },
    Format = "CSV",
    FilterInformation = new
    {
    Currency = "EUR",
    From = "2021-07-10",
    To = "2021-07-20",
    SearchText = "order",
    AmountFrom = 10m,
    AmountTo = 100m,
    },
    Localization = "en",
    TimeZone = "Central Europe Standard Time"
    };

    JavaScriptSerializer serializer = new JavaScriptSerializer();

    var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
    return client.UploadData(url, requestData);
    }
    }

    function ExportTransactions($token)
    {
    $url = 'https://aapi.trustpay.eu/api/Exports/ExportTransactions';
    $data = array(
    'MerchantIdentification' => array(
    'ProjectId' => '1234567'
    ),
    'Type' => 'Card',
    'State' => array('Processed', 'Refunded', 'Pending', 'Rejected', 'Chargebacked', 'Expired', 'Preauthorized', 'Authorized', 'Canceled'),
    'Format' => 'CSV',
    'FilterInformation' => array(
    'Currency' => 'EUR',
    'From' => '2021-07-10',
    'To' => '2021-07-20'
    'SearchText' => 'order',
    'AmountFrom' = '10.00',
    'AmountTo' = '100.00',
    ),
    'Localization' => 'en'
    'TimeZone' => 'Central Europe Standard Time'
    );

    $options = array(
    'http' => array(
    'header'  => array(
    "Authorization: Bearer $Token",
    'Content-type: application/json',
    ),
    'method'  => 'POST',
    'content' => json_encode($data)
    ),
    );
    $context  = stream_context_create($options);
    return file_get_contents($url, false, $context);
    }

    This code is using external library Jackson to parse text from and to json format

    import org.codehaus.jackson.map.ObjectMapper;
    import javax.net.ssl.HttpsURLConnection;
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.util.Map;

    public byte[] ExportTransactions(String token){
    try {
    URL obj = new URL("https://aapi.trustpay.eu/api/Exports/ExportTransactions");
    HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
    con.setRequestMethod("POST");
    con.setRequestProperty("Authorization", "Bearer " + token);
    con.setRequestProperty("Content-type", "application/json");
    Object request = new Object() {
    public Object MerchantIdentification = new Object(){
    public long ProjectId = 1234567;
    };
    public String Type = "Card";
    public String[] State = new String[] {"Processed", "Refunded", "Pending", "Rejected", "Chargebacked", "Expired", "Preauthorized", "Authorized", "Canceled"};
    public String Format = "CSV";
    public Object FilterInformation = new Object(){
    public String Currency = "EUR";
    public String DateFrom = "2021-07-10";
    public String DateTo = "2021-07-20";
    public String SearchText = "order";
    public double AmountFrom = 10.00;
    public double AmountTo = 100.00;
    };
    public String Localization = "en";
    public String TimeZone = "Central Europe Standard Time";
    };
    ObjectMapper JsonParser = new ObjectMapper();
    String jsonrequest = JsonParser.writeValueAsString(request);
    con.setDoOutput(true);

    try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
    wr.writeBytes(jsonrequest);
    wr.flush();
    }

    InputStream inputStream = con.getInputStream();

    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    byte[] buf = new byte[1024];
    int readBytes = -1;
    while((readBytes = inputStream.read(buf)) > 1) {
    byteArrayOutputStream.write(buf, 0, readBytes);
    }

    return byteArrayOutputStream.toByteArray();
    }
    catch (Exception ex){
    throw new RuntimeException(ex.getMessage());
    }
    }
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Transaction type TransactionType No
State Transaction state Array of TransactionState No
Format Export format ExportFormat Yes
FilterInformation Export filter information FilterInformation Yes
Localization Language Varchar(2) No
TimeZone Language Time zone name (e.g. Central Europe Standard Time) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
Currency Currency Char(3) No
From Date from Char(10) Yes
To Date to Char(10) Yes
SearchText String to search in transaction references Varchar(35) No
AmountFrom Amount from Numeric(13,2) en-US format No
AmountTo Amount to Numeric(13,2) en-US format No

Response

Successful response includes a Transaction export in the requested format (CSV) with all the columns that are also available on the Merchant Portal. Failed response contains a JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1122006,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code AccountCurrencyNotAllowed occurred. AccountCurrencyNotAllowed\r\nReturning result code AccountCurrencyNotAllowed"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Transaction Types

Value
Card
SDD
AircashPay
Bancontact
Blik
CashToCode
CashToCodeEVoucher
EPS
Giropay
HomeCredit
IDeal
Wire
InstantBankTransferFI
InstantBankTransferPL
MbWay
Multibanco
MyBank
NasplatkyTB
OpenBanking
Payconiq
PayPal
Paysafecard
Satispay
SkipPay
Sofort
Trustly
WeChatPay

Transaction States

Value
Processed
Refunded
Pending
Rejected
Chargebacked
Expired
Preauthorized
Authorized
Canceled

Export Formats

Value Supported types
CSV Transactions, Disputes

Export disputes

API endpoints:
Live - https://aapi.trustpay.eu/api/Exports/ExportDisputes

Retrieves disputes export based on the filter criteria. Timestamps are UTC by default. Optionally, when TimeZone parameter is used, the timestamps are converted to the requested timezone.

Request

Request example:

using System.Net;
using System.Text;
using System.Web.Script.Serialization;

public byte[] ExportDisputes(string token)
{
   string url = "https://aapi.trustpay.eu/api/Exports/ExportDisputes";
   using (var client = new WebClient())
   {
      client.Headers = new WebHeaderCollection
      {
         "Authorization: Bearer " + token,
         "Content-Type: application/json"
      };
      var request = new
      {
         MerchantIdentification = new
         {
             ProjectId = "1234567"
         },
         Type = "Visa",
         ChargebackType = new[] { "Chargeback", "ChargebackRefund", "ChargebackAdjustment", "Representment", "RepresentmentRefund", "RapidDisputeResolutionPredispute", "RapidDisputeResolutionReversal" },
         Format = "CSV",
         FilterInformation = new
         {
            Currency = "EUR",
            From = "2021-07-10",
            To = "2021-07-20",
            SearchText = "order",
            AmountFrom = 10m,
            AmountTo = 100m,
         },
         Localization = "en",
         TimeZone = "Central Europe Standard Time"
      };

      JavaScriptSerializer serializer = new JavaScriptSerializer();

      var requestData = Encoding.UTF8.GetBytes(serializer.Serialize(request));
      return client.UploadData(url, requestData);
   }
}

function ExportDisputes($token)
{
   $url = 'https://aapi.trustpay.eu/api/Exports/ExportDisputes';
   $data = array(
      'MerchantIdentification' => array(
         'ProjectId' => '1234567'
      ),
      'Type' => 'Visa',
      'ChargebackType' => array('Chargeback', 'ChargebackRefund', 'ChargebackAdjustment', 'Representment', 'RepresentmentRefund', 'RapidDisputeResolutionPredispute', 'RapidDisputeResolutionReversal'),
      'Format' => 'CSV',
      'FilterInformation' => array(
         'Currency' => 'EUR',
         'From' => '2021-07-10',
         'To' => '2021-07-20'
         'SearchText' => 'order',
         'AmountFrom' = '10.00',
         'AmountTo' = '100.00',
      ),
      'Localization' => 'en'
      'TimeZone' => 'Central Europe Standard Time'
   );  

   $options = array(
      'http' => array(
         'header'  => array(
            "Authorization: Bearer $Token",
            'Content-type: application/json',
         ),
         'method'  => 'POST',            
         'content' => json_encode($data)
      ),
   );
   $context  = stream_context_create($options);
   return file_get_contents($url, false, $context);
}

This code is using external library Jackson to parse text from and to json format

import org.codehaus.jackson.map.ObjectMapper;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Map;

public byte[] ExportDisputes(String token){
    try {
        URL obj = new URL("https://aapi.trustpay.eu/api/Exports/ExportDisputes");
        HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "Bearer " + token);
        con.setRequestProperty("Content-type", "application/json");
        Object request = new Object() {
            public Object MerchantIdentification = new Object(){
                public long ProjectId = 1234567;
            };
            public String Type = "Visa";
            public String[] ChargebackType = new String[] {"Chargeback", "ChargebackRefund", "ChargebackAdjustment", "Representment", "RepresentmentRefund", "RapidDisputeResolutionPredispute", "RapidDisputeResolutionReversal"};
            public String Format = "CSV";
            public Object FilterInformation = new Object(){
                public String Currency = "EUR";
                public String DateFrom = "2021-07-10";
                public String DateTo = "2021-07-20";
                public String SearchText = "order";
                public double AmountFrom = 10.00;
                public double AmountTo = 100.00;
            };
            public String Localization = "en";
            public String TimeZone = "Central Europe Standard Time";
        };
        ObjectMapper JsonParser = new ObjectMapper();
        String jsonrequest = JsonParser.writeValueAsString(request);
        con.setDoOutput(true);

        try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) {
            wr.writeBytes(jsonrequest);
            wr.flush();
        }

        InputStream inputStream = con.getInputStream();

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int readBytes = -1;
        while((readBytes = inputStream.read(buf)) > 1) {
            byteArrayOutputStream.write(buf, 0, readBytes);
        }

        return byteArrayOutputStream.toByteArray(); 
    }
    catch (Exception ex){
        throw new RuntimeException(ex.getMessage());
    }
}
Name Description Format Required
Token Authorization token Varchar(235) Yes
MerchantIdentification Identification of merchant MerchantIdentification Yes
Type Dispute type DisputeType No
ChargebackType Chargeback type Array of ChargebackType No
Format Export format ExportFormat Yes
FilterInformation Export filter information FilterInformation Yes
Localization Language Varchar(2) No
TimeZone Language Time zone name (e.g. Central Europe Standard Time) No

Request/MerchantIdentification

Name Description Format Required
ProjectId Merchant project ID (assigned by TrustPay) Numeric(20) Yes

Request/FilterInformation

Name Description Format Required
Currency Currency Char(3) No
From Date from Char(10) Yes
To Date to Char(10) Yes
SearchText String to search in dispute references Varchar(35) No
AmountFrom Amount from Numeric(13,2) en-US format No
AmountTo Amount to Numeric(13,2) en-US format No

Response

Successful response includes a Dispute export in the requested format (CSV) with all the columns that are also available on the Merchant Portal. Failed response contains a JSON error message.

Error response example:
{
    "ResultInfo" : {
        "ResultCode" : 1122006,
        "CorrelationId" : "39044b15-88bc-43b4-a03f-c71de81021b6",
        "AdditionalInfo" : "Result code AccountCurrencyNotAllowed occurred. AccountCurrencyNotAllowed\r\nReturning result code AccountCurrencyNotAllowed"
    }
}
Name Description Format
ResultInfo Result information ResultInfo

Response/ResultInfo

Name Description Format
ResultCode Result code Numeric Yes
CorrelationId Correlation identifier Char(36) Yes
AdditionalInfo Text description Varchar Yes

Dispute Types

Value
Visa
MasterCard
SDD

Chargeback Types

Value
Chargeback
ChargebackRefund
ChargebackAdjustment
Representment
RepresentmentRefund
RapidDisputeResolutionPredispute
RapidDisputeResolutionReversal

MobileSDK

Overview

Our MobileSDK provides a straightforward solution for integrating payment functionalities into mobile applications. This SDK is available for both Android and iOS platforms, allowing developers to incorporate these payment options into their apps. Currently it supports the following payment methods:

Features

Getting Started

To start using our MobileSDKs, follow the installation instructions provided in the respective SDK documentation. For Android, you will need to add the necessary Gradle dependency to your project, and for iOS, you can install the SDK as Github repository dependency.

Support

For further assistance and support, please refer to our detailed documentation for each platform or contact our support team.



This site uses cookies to provide you with a better browsing experience. By browsing TrustPay websites, you agree with using cookies. Find out more on how we use cookies here.