Download OpenAPI specification:
Welcome to the Datatrans API reference. This document is meant to be used in combination with https://docs.datatrans.ch. All the parameters used in the curl and web samples are described here. Reach out to support@datatrans.ch if something is missing or unclear.
Last updated: 08.01.26 - 15:58 UTC
The following steps describe how transactions are processed with Datatrans. We separate payments in three categories: Customer-initiated payments, merchant-initiated payments and after the payment.
We have three integrations available: Redirect, Lightbox and Secure Fields.
transactionId to the init endpoint.https://pay.sandbox.datatrans.com/v1/start/transactionId
<script src="https://pay.sandbox.datatrans.com/upp/payment/js/datatrans-2.0.0.js">
payButton.onclick = function() {
Datatrans.startPayment({
transactionId: "transactionId"
});
};
datatransTrxId in the response.<script src="https://pay.sandbox.datatrans.com/upp/payment/js/secure-fields-2.0.0.js">
var secureFields = new SecureFields();
secureFields.init(
{{transactionId}}, {
cardNumber: "cardNumberPlaceholder",
cvv: "cvvPlaceholder",
});
redirect property inside the data
object will indicate the URL that the customer needs to be redirected to.To retry identical requests with the same effect without accidentally performing the same operation more than needed,
you can add the header Idempotency-Key to your requests. This is useful when API calls are disrupted or you did not
receive a response. In other words, retrying identical requests with our idempotency key will not have any side effects.
We will return the same response for any identical request that includes the same idempotency key.
If your request failed to reach our servers, no idempotent result is saved because no API endpoint processed your request. In such cases, you can simply retry your operation safely. Idempotency keys remain stored for 60 minutes. After 60 minutes have passed, sending the same request together with the previous idempotency key will create a new operation.
Please note that the idempotency key has to be unique for each request and has to be defined by yourself. We recommend
assigning a random value as your idempotency key and using UUID v4. Idempotency is only available for POST requests.
Idempotency was implemented according to the "The Idempotency HTTP Header Field" Internet-Draft
| Scenario | Condition | Expectation |
|---|---|---|
| First time request | Idempotency key has not been seen during the past 60 minutes. | The request is processed normally. |
| Repeated request | The request was retried after the first time request completed. | The response from the first time request will be returned. |
| Repeated request | The request was retried before the first time request completed. | 409 Conflict. It is recommended that clients time their retries using an exponential backoff algorithm. |
| Repeated request | The request body is different than the one from the first time request. | 422 Unprocessable Entity. |
Example:
curl -i 'https://api.sandbox.datatrans.com/v1/transactions' \
-H 'Authorization: Basic MTEwMDAwNzI4MzpobDJST1NScUN2am5EVlJL' \
-H 'Content-Type: application/json; charset=UTF-8' \
-H 'Idempotency-Key: e75d621b-0e56-4b71-b889-1acec3e9d870' \
-d '{
"refno" : "58b389331dad",
"amount" : 1000,
"currency" : "CHF",
"paymentMethods" : [ "VIS", "ECA", "PAP" ],
"option" : {
"createAlias" : true
}
}'
Authentication to the APIs is performed with HTTP basic authentication. Your
merchantId acts as the username. To get the password, login
to the dashboard
and navigate to the security settings under UPP Administration > Security.
Create a base64 encoded value consisting of merchantId and password (most HTTP clients are able to handle the base64 encoding automatically) and submit the Authorization header with your requests. Here’s an example:
base64(merchantId:password) = MTAwMDAxMTAxMTpYMWVXNmkjJA==
Authorization: Basic MTAwMDAxMTAxMTpYMWVXNmkjJA==
All API requests must be done over HTTPS with TLS >= 1.2.
Datatrans uses HTTP response codes to indicate if an API call was successful or resulted in a failure.
HTTP 2xx status codes indicate a successful API call whereas HTTP 4xx status codes
indicate client errors or if something with the transaction went wrong - for example a decline.
In rare cases HTTP 5xx status codes are returned. Those indicate errors on Datatrans side.
Here’s the payload of a sample HTTP 400 error, showing that your request has wrong values in it
{
"error" : {
"code" : "INVALID_PROPERTY",
"message" : "init.initRequest.currency The given currency does not have the right format"
}
}
After each authorization Datatrans tries to call the configured Webhook (POST) URL. The Webhook URL
can be configured within the dashboard.
It is also possible to overwrite the configured webhook URL with the init.webhook property.
The Webhook payload contains the same information as the response of a Status API call.
If you want your webhook requests to be signed, setup a HMAC key in your merchant configuration.
To get your HMAC key, login to our dashboard and navigate to the Security settings in your
merchant configuration to view your server to server security settings.
Select the radio button Important parameters will be digitally signed (HMAC-SHA256) and sent with payment messages.
Datatrans will use this key to sign the webhook payload and will add a Datatrans-Signature HTTP request header:
Datatrans-Signature: t=1559303131511,s0=33819a1220fd8e38fc5bad3f57ef31095fac0deb38c001ba347e694f48ffe2fc
On your server, calculate the signature of the webhook payload and finally compare it to s0.
timestamp is the t value from the Datatrans-Signature header, payload represents all UTF-8 bytes
from the body of the payload and finally key is the HMAC key you configured within the dashboard.
If the value of sign is equal to s0 from the Datatrans-Signature header,
the webhook payload is valid and was not tampered.
Java
// hex bytes of the key
// if Java version < 17, a 3rd-party library like apache-commons can be used
byte[] key = Hex.decodeHex(key);
// if Java version >= 17, the built in HexFormat class can be used
byte[] key = HexFormat.of().parseHex(key);
// Create sign with timestamp and payload
String algorithm = "HmacSha256";
SecretKeySpec macKey = new SecretKeySpec(key, algorithm);
Mac mac = Mac.getInstance(algorithm);
mac.init(macKey);
mac.update(String.valueOf(timestamp).getBytes());
byte[] result = mac.doFinal(payload.getBytes());
String sign = Hex.encodeHexString(result);
Python
# hex bytes of the key
key_hex_bytes = bytes.fromhex(key)
# Create sign with timestamp and payload
sign = hmac.new(key_hex_bytes, bytes(str(timestamp) + payload, 'utf-8'), hashlib.sha256)
birthdate formatPLU on Cancel APIQrData propertyaccountFunding)PFP)3D property in authorize api for network tokensAirReservationDetails, Vouchers and OtherDeliveryAddressesMPX to the authorize apiALIAS requestsauthorize and initialize APIs to be able to receive a DCC optionMFG to the status API.card on file processingcardOnFile property to the init, authorize and validate apiPLU parameterscard.3D.authenticationResponse)Get alias card artcard.type feature to the INIT API (same as for the AUTHORIZE API)DEVICE_TOKEN as possible card type in the Authorize APIpaycard to MFA/MFXPLUcardholder to alias patch requestfingerprint implementation for TWIoption.storeCustomerData to the authorize APIMFG to the screen APIavs object to the status apiELV object to the status apimandateId and iban are returned if availablePLUCUVMFG support for the authorize APIinit.option.storeCustomerDataMPX paycard number to the status APIairlineData to the Authorize Split API3RIMPA and MPGauthorize.card.3D.threeDSTransactionIdMBP (MobilePay) payment methoduniqueRefno handling to the init APIUNKNOWN_ERRORVPS (Vipps) payment methodSWP to the authorize APIimageUrl to the article property for KLNmarketplace propertyUNKNOWN_ERRORaccertifyrefno to 40 charactersMCP properties to support static MCPcard types PlainCard, AliasCard and NetworkTokenCard for the authorize and init endpointwebhook.url for mobile flowsstatusResponse.statusstatus.language in the status responseqrData to MPX and MFX in the status API responseKLN train reservationsairPlus propertiesELV request properties to the API docs (init and authorize API)MCP sample request/response examples in the api docsairPlus propertiesmerchantId to the status API responseSWH (Swish) payment methodmessageExtensions to init.card.3dauthorizeResponse.card to the API docsGFT (MFG Gift Card) payment methodCBL (Cartes Bancaires) payment methodHPC (Hipercard) payment methodairPlus to the init API requestinit.language API docsorder.article propertycredit apicard object is returned in the alias info response if the content is emptyexternalCode for INT transactionsinit api if init.number is set with plain card numberairlineData date format issuesinit.webhook for more information.GET /v1/multicurrency/rates API to fetch the MCP rates.init.mcp propertyauthorize.mcp propertymcp property in the status response if available for the transactionGET /v1/aliases/{alias} response./v1/transactions/{transactionId}/increase to increase the amount for an authorized transaction (credit cards only).invoiceOnDelivery when using MFX or MPX as payment method.MFX and MPX when invoiceOnDelivery=true was used.KLN hotel extended merchant data (EMD)ESYmarketplace object now accepts an array of splits.debit and credit the Status API now also returns prepaid in the card.info.type property.merchantClientIdPAP.orderTransactionId to be a stringPAP.fraudSessionId (PayPal FraudNet)POST /v1/transactions/screen API to check a customer's credit score before sending an actual authorization request.
Currently only INT (Byjuno) is supported.GET /v1/aliases API to receive more information about a particular alias.MDPsubPaymentMethod to subtype (subPaymentMethod still works)subtype (pay_now, pay_later, pay_over_time, direct_debit, direct_bank_transfer)
from the Status APIcustomData and firstRateAmounttransactionId (if available) for a failed Refund API call.language propertycard.3D.transStatusReason and card.3D.cardholderInfo was not returnedfailed after it timed outoption.rememberMe not returning the Alias from the Status APIcard.3D.transStatusReason (if available) from the Status APIcard.3D.cardholderInfo (if available) from the Status APIALPKLNSWBSecurely send all the needed parameters to the transaction initialization API. The result of this API call is a HTTP 201 status code with a transactionId in the response body and the Location header set. This call is required to proceed with our Redirect and Lightbox integration
| amount | integer <int64> The amount of the transaction in the currency’s smallest unit. For example use 1000 for CHF 10.00. Can be omitted for use cases where only a registration should take place (if the payment method supports registrations) |
| currency required | string = 3 characters 3 letter ISO-4217 character code. For example |
| refno required | string [ 1 .. 40 ] characters The merchant's reference number. It should be unique for each transaction. |
| refno2 | string [ 0 .. 40 ] characters Optional customer's reference number. Supported by some payment methods or acquirers. |
object (CustomerRequest) Whenever the payment method supports customer details, the | |
object (BillingAddress) | |
object (ShippingAddress) The address where the article(s) should be sent to. | |
object (OrderRequest) If supported by the payment method, an order with one or more articles can be defined. | |
| autoSettle | boolean Whether to automatically settle the transaction after an authorization or not. If not present with the init request, the settings defined in the dashboard ('Authorisation / Settlement' or 'Direct Debit') will be used. Those settings will only be used for web transactions and not for server to server API calls. |
object (OptionRequest) | |
| language | string = 2 characters Enum: "en" "de" "fr" "it" "es" "el" "fi" "hu" "ko" "nl" "no" "da" "pl" "pt" "ru" "ja" "sk" "sl" "sv" "tr" "zh" This parameter specifies the language (language code) in which the payment page should be presented to the cardholder. The ISO-639-1 two letter language codes listed above are supported |
object (RedirectRequest) The redirect object is used to customize the browser behaviour when using the payment page (Redirect or Lightbox Mode) to do a transaction. | |
object (theme) The theme (including configuration options) to be used when rendering the payment page. | |
object (WebhookRequest) Used to define the webhook configuration. If not set, the webhook configuration from the merchant configuration will be used. | |
| paymentMethods | Array of strings = 3 characters [ items = 3 characters ] Items Enum: "ACC" "ALP" "APL" "AMX" "AZP" "BAC" "BON" "CBL" "CFY" "CSY" "CUP" "DEA" "DIN" "DII" "DIB" "DIS" "DNK" "ECA" "ELV" "EPS" "ESY" "GFT" "GPA" "HPC" "INT" "JCB" "JEL" "KLN" "MAU" "MDP" "MFA" "MFX" "MPA" "MFG" "MPG" "MPX" "MYO" "PAP" "PAY" "PEF" "PFC" "PSC" "REK" "SAM" "SWB" "SCX" "SWP" "TWI" "UAP" "VIS" "WEC" "SWH" "VPS" "MBP" "CUV" "GEP" "PLU" "DVI" "PFP" "PYL" An array of payment method shortnames. For example |
object (CardInit) | |
object (AlipayRequest) Alipay+ specific parameters | |
object (AmazonPayRequest) Amazon Pay specific request parameters | |
object (BoncardRequest) Boncard specific request parameters | |
| DVI | object (DeltaVistaData) DVI has no specific request parameters but we need an empty object here to handle it as a DVI request. |
object (ElvInitRequest) ELV specific payment parameters. | |
object (EpsRequest) EPS specific request parameters | |
object (ESY) | |
object (GPARequest) Giropay specific request parameters | |
object (ByjunoAuthorizeRequest) | |
object (KlarnaInitRequest) | |
object (MobilePayRequest) MobilePay specific parameters | |
object (MDPInitRequest) | |
object (MfaAuthorizeRequest) MFA specific parameters. At least an empty MFA object is required if MFA should be processed. Even if no additional parameters are sent. | |
object (MFXRequest) MFX specific parameters | |
object (MPXRequest) MPX specific parameters | |
object (PayPalInitRequest) PayPal specific parameters | |
object (PfcInitRequest) | |
object (PostfinancePayInitRequest) | |
object (SBBHalbtaxPlusInitRequest) | |
object (PaysafecardRequest) Paysafecard specific request parameters | |
object (RekaRequest) Reka card specific parameters | |
object (SwissBillingRequest) Swissbilling specific parameters. | |
object (SwishRequest) Swish specific parameters | |
object (SwissPassRequest) SwissPass specific parameters | |
object (TwintInitRequest) | |
object (VippsRequest) Vipps specific parameters | |
object (WeChatRequest) WeChat specific parameters | |
object (DccInitRequest) For DCC data obtained from a previous DCC request for a given credit card, currency, and amount, use | |
object (InitMcpRequest) | |
object (Metadata) Merchant reference data | |
object (AirlineDataRequest) The airline data including ticket details. | |
| accertify | object (Accertify) Accertify decision (Accepted, Review, Declined |
object (ThreeRIData) | |
| extensions | object (Extension) An object for additional data for customized processes. |
initRequest1
{- "amount": 1337,
- "currency": "CHF",
- "refno": "JHv8njc73",
- "redirect": {
}
}initResponse
{- "transactionId": "260108170006704540"
}Proceed with the steps below to process Secure Fields payment transactions:
transactionId. The success result of this API call is a HTTP 201 status code with a transactionId in the response body.SecureFields JavaScript library with the returned transactionId:var secureFields = new SecureFields();
secureFields.init(
transactionId, {
cardNumber: "cardNumberPlaceholder",
cvv: "cvvPlaceholder",
});
success event of the secureFields.submit() call. Example success event data:{
"event":"success",
"data": {
"transactionId":"{transactionId}",
"cardInfo":{"brand":"MASTERCARD","type":"credit","usage":"consumer","country":"CH","issuer":"DATATRANS"},
"redirect":"https://pay.sandbox.datatrans.com/upp/v1/3D2/{transactionId}"
}
}
redirect property will indicate the URL that the browser needs to be redirected to.transactionId to check the status and to settle, cancel or credit (refund) an transaction.| amount | integer <int64> The amount of the transaction in the currency’s smallest unit. For example use 1000 for CHF 10.00. |
| currency required | string = 3 characters 3 letter ISO-4217 character code. For example |
| returnUrl required | string [ 1 .. 4000 ] characters The URL where the browser will be redirected after the 3D authentication process. |
| returnMethod | string Default: "POST" Enum: "GET" "POST" The preferred HTTP method for the redirect request ( |
object (InitMcpRequest) | |
object (SecureFieldsThreeDSecure) Refer to the official EMVCo. specifications for parameter requirements. |
secureFieldsInitRequest1
{- "amount": 100,
- "currency": "CHF",
- "returnMethod": "GET"
}secureFieldsInitResponse
{- "transactionId": "260108170007654574"
}An existing alias can be validated at any time with the transaction validate API. No amount will be blocked on the customers account. Only credit cards (including Apple Pay and Google Pay), PFC, KLN and PAP support validation of an existing alias.
Validate an alias
| refno required | string [ 1 .. 40 ] characters The merchant's reference number. It should be unique for each transaction. |
| refno2 | string [ 0 .. 40 ] characters Optional customer's reference number. Supported by some payment methods or acquirers. |
| currency required | string = 3 characters 3 letter ISO-4217 character code. For example |
object (CardValidateRequest) The card object to be submitted when validating with an existing credit card alias. | |
object (PfcValidateRequest) PostFinance Card specific parameters | |
object (KlarnaValidateRequest) Klarna specific parameters | |
object (PayPalValidateRequest) PayPal specific parameters for the validate request. | |
object (GooglePayValidateRequest) Google Pay specific parameters for the validate request. | |
object (ApplePayValidateRequest) Apple Pay specific parameters for the validate request. | |
object (EasyPayValidateRequest) Swisscom Pay specific parameters |
validateRequest1
{- "refno": "3sZwO2Ce7",
- "currency": "CHF",
- "card": {
- "alias": "424242SKMPRI4242",
- "expiryMonth": "06",
- "expiryYear": "28"
}
}validateResponse
{- "transactionId": "260108170009414641",
- "acquirerAuthorizationCode": "170009",
- "card": {
- "masked": "424242xxxxxx4242"
}
}Use this API to increase the authorized amount for a transaction. The transaction must be in status authorized. The transactionId is needed to increase the amount for an authorization. Only credit cards support increase of the authorized amount.
| transactionId required | integer <int64> The transactionId received after an authorization. |
Increase authorization amount
| amount required | integer <int64> The amount of the transaction in the currency’s smallest unit. For example use 1000 for CHF 10.00. |
| currency required | string = 3 characters 3 letter ISO-4217 character code. For example |
| refno required | string [ 1 .. 40 ] characters The merchant's reference number. It should be unique for each transaction. |
object (Metadata) Merchant reference data |
authorizeIncreaseRequest
{- "amount": 1000,
- "currency": "GBP",
- "refno": "JPjdgcjlC"
}authorizeIncreaseResponse
{- "increasedAmount": 2000
}Check the customer's credit score before sending an actual authorization request. No amount will be blocked on the customers account. Currently, only invoicing method INT support screening.
Screen request
| amount required | integer <int64> The amount of the transaction in the currency’s smallest unit. For example use 1000 for CHF 10.00. |
| currency required | string = 3 characters 3 letter ISO-4217 character code. For example |
| refno required | string [ 1 .. 40 ] characters The merchant's reference number. It should be unique for each transaction. |
object (CustomerRequest) Whenever the payment method supports customer details, the | |
object (BillingAddress) | |
object (ShippingAddress) The address where the article(s) should be sent to. | |
object (ByjunoScreenRequest) | |
object (MfaAuthorizeScreenRequest) MFA has no specific request parameters but we need an empty object here to handle it as a MFA request. | |
| DVI | object (DeltaVistaScreenRequest) DVI has no specific request parameters but we need an empty object here to handle it as a DVI request. |
screenRequest
{- "amount": 2000,
- "currency": "CHF",
- "refno": "axQDEtvOj",
- "customer": {
- "id": "10067822",
- "title": "Herr",
- "firstName": "Max",
- "lastName": "Mustermann",
- "street": "Bahnstrasse",
- "street2": "1",
- "city": "Schwerzenbach",
- "country": "CH",
- "zipCode": "8603",
- "phone": "0448111111",
- "cellPhone": "0448222222",
- "gender": "male",
- "birthDate": "1986-05-14",
- "language": "DE",
- "type": "P",
- "ipAddress": "213.55.184.229"
}, - "INT": {
- "subtype": "INVOICE",
- "verifiedEmail": true,
- "emailVerificationType": "MERCHANT",
- "mobileVerificationType": "MERCHANT",
- "verifiedMobile": true,
- "loggedIn": true,
- "isAbove18": true,
- "docValidTill": "2022-01-01",
- "permitType": "B",
- "inSwitzerlandSince": "2020-01-01",
- "nationality": "ES",
- "phoneBusiness": "0923452345",
- "payoutInfo": "e17cb58c-e896-4754-834a-74e9806ec1a1",
- "downpaymentToMerchantAmount": 15,
- "subscriptionType": "MONTHLY",
- "customerInfo2": "info2",
- "deliveryMethod": "PICK-UP",
- "transactionChannel": "WEB",
- "integrationModule": "Wally 2.0",
- "deviceFingerprintId": "c65cee1d-664e-4546-a8dd-af90103e4862",
- "sessionIpPort": "127.0.0.1:8080",
- "sessionId": "4d465ca4-8e0c-4870-90e1-11d1e6abd89c",
- "paperInvoice": false,
- "siteId": "site-1",
- "customData": [
- "data1",
- "data2"
], - "customerConsents": [
- {
- "consentType": "CEMBRAPAY-TC",
- "consentProvidedAt": "MERCHANT",
- "consentDate": "2026-01-08T17:00:13+01",
- "consentReference": "Y3A="
}
]
}
}screenResponse
{- "transactionId": "260108170014084799",
- "INT": {
- "subtypes": [
- "SINGLE-INVOICE",
- "CEMBRAPAY-INVOICE",
- "INSTALLMENT_12",
- "INSTALLMENT_24",
- "INSTALLMENT_3",
- "INSTALLMENT_36",
- "INSTALLMENT_6",
- "INSTALLMENT_4",
- "INSTALLMENT_48",
- "CEMBRAPAY-INVOICE-RISKONMERCHANT",
- "BYJUNO-INVOICE",
- "INVOICE",
- "INSTALLMENT"
]
}
}The Settlement request is often also referred to as “Capture” or “Clearing”. It can be used for the settlement of previously authorized transactions. Only after settling a transaction the funds will be credited to your bank account. The transactionId is needed to settle an authorization. This API call is not needed if autoSettle was set to true when initializing a transaction.
| transactionId required | integer <int64> The transactionId received after an authorization. |
| amount required | integer <int64> The amount of the transaction in the currency’s smallest unit. For example use 1000 for CHF 10.00. |
| currency required | string = 3 characters 3 letter ISO-4217 character code. For example |
| refno required | string [ 1 .. 40 ] characters The merchant's reference number. Most payment methods require you to have a unique reference for a transaction. In case you must change the reference number in settlement, ensure first it is supported by the dedicated payment method. |
| refno2 | string [ 0 .. 40 ] characters Optional customer's reference number. Supported by some payment methods or acquirers. |
object (AirlineDataRequest) The airline data including ticket details. | |
object (MarketPlaceSettle) | |
object (SettleMcpRequest) | |
object (MultiplePartialCapture) Can be used to do the settlement in partial steps. | |
| extensions | object (Extension) An object for additional data for customized processes. |
object (SBBHalbtaxPlusSettleRequest) SBB Halbtax Plus specific parameters for settle | |
object (OrderRequest) If supported by the payment method, an order with one or more articles can be defined. |
settleRequest1
{- "amount": 1000,
- "currency": "CHF",
- "refno": "V6eGFHxBc"
}settleErrorResponse
{- "error": {
- "code": "INVALID_PROPERTY",
- "message": "settle transactionId length must be 18 digits"
}
}Cancel requests can be used to release a blocked amount from an authorization. The transaction must either be in status authorized or settled. The transactionId is needed to cancel an authorization
| transactionId required | integer <int64> The transactionId received after an authorization. |
object (SBBHalbtaxPlusCancelRequest) SBB Halbtax Plus specific parameters for cancel |
{- "PLU": {
- "reserved": "string",
- "token": "string",
- "pointOfSale": 0,
- "pointOfDistribution": 0
}
}cancelErrorResponse
{- "error": {
- "code": "TRANSACTION_NOT_FOUND",
- "message": "transactionId not found"
}
}Refund requests can be used to credit a transaction which is in status settled or transmitted. The previously settled amount must not be exceeded.
| transactionId required | integer <int64> The transactionId received after an authorization. |
Credit a transaction
| amount | integer <int64> The amount of the transaction in the currency’s smallest unit. For example use 1000 for CHF 10.00. |
| currency required | string = 3 characters 3 letter ISO-4217 character code. For example |
| refno required | string [ 1 .. 40 ] characters The merchant's reference number. It should be unique for each transaction. |
| refno2 | string [ 0 .. 40 ] characters Optional customer's reference number. Supported by some payment methods or acquirers. |
object (AirlineDataRequest) The airline data including ticket details. | |
object (MarketPlaceCredit) | |
| extensions | object (Extension) An object for additional data for customized processes. |
object (CreditMcpRequest) | |
object (SBBHalbtaxPlusCreditRequest) SBB Halbtax Plus specific parameters for credit | |
object (Metadata) Merchant reference data | |
object (OrderRequest) If supported by the payment method, an order with one or more articles can be defined. |
creditRequest
{- "amount": 1000,
- "currency": "CHF",
- "refno": "ykw7WE8Jv"
}authorizeResponse
{- "transactionId": "260108170006234526",
- "acquirerAuthorizationCode": "170006"
}Returns the DCC values for a given credit card, currency and amount. This data can be used to create a DCC UI for the customers. The received DCC correlation ID can be used in a sub sequent transaction either through the initialize or the authorize API endpoints.
| cardNumber required | string Merchants that have the option to store card information on their end can use the |
| currency required | string = 3 characters 3 letter ISO-4217 character code. For example |
| amount required | integer <int64> The amount of the transaction in the currency’s smallest unit. For example use 1000 for CHF 10.00. |
dccRequest
{- "cardNumber": "5232050000010003",
- "currency": "CHF",
- "amount": 100
}dccResponse
{- "dccAvailable": true,
- "originalOption": {
- "amount": 100,
- "currency": "CHF",
- "exponent": 2
}, - "dccOption": {
- "amount": 107,
- "currency": "USD",
- "exponent": 2
}, - "baseRate": "wholesale",
- "rate": 1.06015,
- "margin": 2.97,
- "correlationId": "ecb37255-5ab8-4b84-9250-4338b7fae97f"
}Use this API to update a Secure Fields transaction. This action is only allowed before the 3D process. At least one property must be updated.
| transactionId required | integer <int64> The |
| amount | integer <int64> The newly to be used amount in the currency’s smallest unit. For example use 1000 for CHF 10.00. |
| currency required | string = 3 characters 3 letter ISO-4217 character code. For example |
object (SecureFieldsThreeDSecure) Refer to the official EMVCo. specifications for parameter requirements. |
secureFieldsUpdateRequest
{- "amount": 1338
}secureFieldsUpdateErrorResponse
{- "error": {
- "code": "INVALID_TRANSACTION_STATUS"
}
}The API endpoint status can be used to check the status of any transaction, see its history, and retrieve the card information.
| transactionId required | integer <int64> The transactionId received after an authorization. |
curl -i -X GET https://api.sandbox.datatrans.com/v1/transactions/260108170009044622 --user {merchantId}:{password}
statusResponse
{- "transactionId": "260108170009044622",
- "merchantId": "1000001111",
- "type": "payment",
- "status": "authorized",
- "currency": "CHF",
- "refno": "cSfy3WP5z",
- "paymentMethod": "VIS",
- "detail": {
- "authorize": {
- "amount": 1000,
- "acquirerAuthorizationCode": "170009"
}
}, - "card": {
- "masked": "424242xxxxxx4242",
- "expiryMonth": "06",
- "expiryYear": "28",
- "info": {
- "brand": "VISA CREDIT",
- "type": "credit",
- "usage": "consumer",
- "country": "GB",
- "issuer": "DATATRANS"
}
}, - "history": [
- {
- "action": "authorize",
- "amount": 1000,
- "source": "api",
- "date": "2026-01-08T16:00:09Z",
- "success": true,
- "ip": "172.30.59.198"
}
]
}object (CardholderData) | |
| usage | string Enum: "SIMPLE" "REGISTRATION" |
object (ApplePaySettings) | |
object (GooglePaySettings) |
{- "cardholder": {
- "ipAddress": "string",
- "phoneNumber": "string",
- "emailAddress": "string"
}, - "usage": "SIMPLE",
- "applePay": {
- "merchantName": "string",
- "currency": "str",
- "country": "st",
- "amount": 0
}, - "googlePay": {
- "currency": "str",
- "country": "st",
- "amount": 0,
- "allowedAuthMethods": [
- "PAN_ONLY"
]
}
}{- "transactionId": "string"
}The aliases API gives you complete control over a Datatrans alias, be it a card number alias or an alias of a non-card payment method such as PayPal, Postfinance etc.
Note that the operations of this API apply only to the most recent Datatrans alias format. Please reach out to support@datatrans.ch if you are not sure which alias format you have in use.
By default, only the merchant that created the alias has access to it. Contact us, if you have a use case where you need to share the alias.
Get alias info.
| alias required | string Example: AAABeCBPbiHssdexyrAAAYkaznYWAPYt An alias (token) received from a previous transaction if |
curl -i -X GET https://api.sandbox.datatrans.com/v1/aliases/AFBWv1fWAAEAAAGbnlX3ky-WPhLaACIG --user {merchantId}:{password}
aliasInfoResponse
{- "alias": "AFBWv1fWAAEAAAGbnlX3ky-WPhLaACIG",
- "fingerprint": "F-e5-sH1dWRS1onhDWSmmIgP",
- "type": "CARD",
- "masked": "424242xxxxxx4242",
- "dateCreated": "2026-01-08T16:00:00Z",
- "validUntil": "2030-12-13T16:00:00Z",
- "card": {
- "usage": "SIMPLE",
- "last4": "4242",
- "bin": "424242",
- "panRemoved": false,
- "cardInfo": {
- "brand": "VISA CREDIT",
- "type": "credit",
- "usage": "consumer",
- "country": "GB",
- "issuer": "DATATRANS"
}
}
}Delete an alias with immediate effect. The alias will no longer be recognized if used later with any API call.
| alias required | string Example: AAABeCBPbiHssdexyrAAAYkaznYWAPYt An alias (token) received from a previous transaction if |
curl -i -X DELETE https://api.sandbox.datatrans.com/v1/aliases/AFBWv1fWAAEAAAGbnlYLrV4hI84FAPqZ --user {merchantId}:{password}
deleteErrorResponse
{- "error": {
- "code": "ALIAS_NOT_FOUND"
}
}Update existing aliases and provision Network Tokens.
| alias required | string |
| removePlain | boolean Remove the pan from storage. |
| expiryMonth | string = 2 characters \d{2} The expiry month of the card. |
| expiryYear | string = 2 characters \d{2} The expiry year of card. |
object (CardholderData) | |
| createNetworkToken | boolean Create a Network Token. |
object (CardOnFile) Card On File | |
object (CardHolderNameVerification) Cardholder name |
aliasPatchRequest
{- "removePlain": false,
- "expiryMonth": "12",
- "expiryYear": "30",
- "createNetworkToken": true
}aliasPatchResponse
{- "alias": "AFBWv1fWAAEAAAGbnlYbAeYQB1D8AGWa",
- "fingerprint": "F-fnlcOgqPqxSdNfyYY0vXHk",
- "type": "CARD",
- "masked": "434343xxxxxx4345",
- "dateCreated": "2026-01-08T16:00:00Z",
- "validUntil": "2030-12-13T16:00:00Z",
- "card": {
- "usage": "REGISTRATION",
- "expiryMonth": "12",
- "expiryYear": "30",
- "last4": "4345",
- "bin": "434343",
- "panRemoved": false,
- "cardInfo": {
- "brand": "VISA",
- "type": "credit",
- "usage": "consumer",
- "country": "UA",
- "issuer": "JSC UKRSIBBANK"
}, - "cardOnFile": { },
- "networkToken": {
- "expiryMonth": "07",
- "expiryYear": "27",
- "status": "ACTIVE",
- "paymentAccountReference": "V0010013021088278311713045741",
- "tokenRequestorId": "40010080572",
- "token": "4001290104763246"
}
}
}Currently, only Card, PostFinance, Twint, PayPal, Byjuno and Reka aliases can be converted.
| type required | string Default: "CARD" Legacy alias type. |
| expiryMonth | string = 2 characters \d{2} The expiry month of the credit card behind alias. |
| expiryYear | string = 2 characters \d{2} The expiry year of the credit card behind the alias |
| legacyAlias required | string The legacy alias |
aliasConvertRequest
{- "legacyAlias": "424242SKMPRI4242",
- "type": "CARD"
}aliasConvertResponse
{- "alias": "AFBWv1fWAAEAAAGbnlYK-sUuBIsxAHMb"
}Tokenize cards, CVVs and custom fields. It supports single and bulk tokenization for batches of requests.
required | Array of objects (TokenizeRequest) List of tokenization requests. |
bulkTokenizeRequest
{- "requests": [
- {
- "type": "CARD",
- "pan": "4343434343434345",
- "expiryMonth": "05",
- "expiryYear": "21",
- "cardholder": {
- "ipAddress": "127.0.0.1",
- "phoneNumber": "123456789",
- "emailAddress": "[email protected]"
}, - "networkTokenOptions": {
- "createNetworkToken": true
}
}, - {
- "type": "CVV",
- "cvv": "123"
}, - {
- "type": "CVV",
- "cvv": "invalid-value"
}, - {
- "type": "CUSTOM",
- "custom": "customValue"
}
]
}bulkTokenizationResponse
{- "overview": {
- "total": 4,
- "successful": 3,
- "failed": 1
}, - "responses": [
- {
- "type": "CARD",
- "alias": "AFBWv1fWAAEAAAGbnlX493zqZ9bqAFmj",
- "maskedCC": "434343xxxxxx4345",
- "fingerprint": "F-fnlcOgqPqxSdNfyYY0vXHk",
- "validUntil": "2030-12-13T15:59:53Z",
- "networkToken": {
- "status": "ACTIVE",
- "tokenCreated": true
}
}, - {
- "type": "CVV",
- "alias": "FIoq6qmDQwiDPC8ycINVUN8C",
- "expiryDate": "2027-08-31T15:59:53Z"
}, - {
- "error": {
- "code": "INVALID_CVV",
- "message": "Not numeric.",
- "localizedMessage": "INVALID_CVV"
}, - "type": "CVV"
}, - {
- "type": "CUSTOM",
- "alias": "DoKcvE0NQNKslJQe0y0a8Q=="
}
]
}Detokenize cards, CVVs and custom fields. It supports single and bulk detokenization for batches of requests.
required | Array of objects (DetokenizeRequest) List of detokenization requests. |
bulkDetokenizeRequest
{- "requests": [
- {
- "type": "CARD",
- "alias": "AAABcH0Bq92s3kgAESIAAbGj5NIsAHWC"
}, - {
- "type": "CARD",
- "alias": "invalid-value"
}, - {
- "type": "CVV",
- "alias": "sNl6mLdzSGq7AgBxxYv1sRYb"
}, - {
- "type": "CUSTOM",
- "alias": "pvjyVb4xTtuwLljWVfFG0w=="
}
]
}bulkTokenizationResponse
{- "overview": {
- "total": 4,
- "successful": 3,
- "failed": 1
}, - "responses": [
- {
- "type": "CARD",
- "pan": "4242424242424242"
}, - {
- "error": {
- "code": "INVALID_ALIAS",
- "localizedMessage": "INVALID_ALIAS"
}, - "type": "CARD"
}, - {
- "type": "CVV",
- "cvv": "123",
- "validUntil": "2026-01-08T16:29:58Z"
}, - {
- "type": "CUSTOM",
- "custom": "customValue"
}
]
}Receive card assets such as the image of the card. Works only when a Network Token is mapped to the alias.
| alias required | string Example: AAABeCBPbiHssdexyrAAAYkaznYWAPYt An alias (token) received from a previous transaction if |
curl -i -X GET https://api.sandbox.datatrans.com/v1/aliases/AFBWv1fWAAEAAAGbnlYZs_85Lho3AGdY/card-art --user {merchantId}:{password}
aliasCardArtResponse
{- "mimeType": "image/png",
- "encodedData": "encoded data"
}If you are a merchant using our reconciliation services, you can use this API to confirm a sale. The matching is based on the transactionId. The status of the transaction will change to compensated
| date | string <date-time> The date when the transaction happened. |
| transactionId | string The transactionId received after an authorization. |
| currency | string 3 letter ISO-4217 character code. For example |
| amount | integer <int64> The amount of the transaction in the currency’s smallest unit. For example use 1000 for CHF 10.00. |
| type | string Enum: "payment" "credit" "card_check" The type of the transaction |
| refno | string The merchant's reference number. It should be unique for each transaction. |
saleReportRequest
{- "date": "2026-01-08T16:00:10.590+00:00",
- "transactionId": "260108170009884659",
- "currency": "CHF",
- "amount": 1000,
- "type": "payment",
- "refno": "Cu9WA5nSB"
}saleReportResponse
{- "transactionId": "260108170009884659",
- "saleDate": "2026-01-08T16:00:10.590+00:00",
- "reportedDate": "2026-01-08T16:00:10.692+00:00",
- "matchResult": "MATCHED"
}If you are a merchant using our reconciliation services, you can use this API to confirm multiple sales with a single API call. The matching is based on the transactionId. The status of the transaction will change to compensated
Array of objects (SaleReportRequest) A list of sale objects. |
bulkSaleRequest
{- "sales": [
- {
- "date": "2026-01-08T16:00:11.371+00:00",
- "transactionId": "260108170011004706",
- "currency": "CHF",
- "amount": 1000,
- "type": "payment",
- "refno": "VidFkfeAF"
}, - {
- "date": "2026-01-08T16:00:11.626+00:00",
- "transactionId": "260108170011434713",
- "currency": "CHF",
- "amount": 1000,
- "type": "payment",
- "refno": "cprjiCIHg"
}
]
}bulkSaleResponse
{- "sales": [
- {
- "transactionId": "260108170011004706",
- "saleDate": "2026-01-08T16:00:11.371+00:00",
- "reportedDate": "2026-01-08T16:00:11.720+00:00",
- "matchResult": "MATCHED"
}, - {
- "transactionId": "260108170011434713",
- "saleDate": "2026-01-08T16:00:11.626+00:00",
- "reportedDate": "2026-01-08T16:00:11.746+00:00",
- "matchResult": "MATCHED"
}
]
}To get current rates call this endpoint. It will return all available rates for the configured merchant. Note: These rates are Acquirer specific, need a specific acquiring contract and need to be set up by Datatrans.
curl -i -X GET https://api.sandbox.datatrans.com/v1/multicurrency/rates --user {merchantId}:{password}
authorizeResponse
{- "requestId": "58ea4f7f-cc99-4136-98af-c1497ac5bb16",
- "reportDetail": {
- "transactionDate": "2026-01-08T16:00:03Z",
- "retrievalReferenceNumber": "600862787632"
}, - "rates": [
- {
- "currency": "AED",
- "currencyCode": "784",
- "decimalPlaces": 2,
- "roundUnit": 0,
- "value": 4.04110286546522
}
]
}