TWINT
Payment Process | Integration | ||
---|---|---|---|
Authorization | ✔️ | Payment Page | ✔️ |
Deferred Settlement | ✔️ | Split Mode | ✔️ |
Refund | ✔️ | Mobile SDK | ✔️ |
Cancel | ✔️ | ||
Alias | ✔️ |
Description
With the TWINT app, you can make payments easily and conveniently: in online shops, at supermarket cash registers, in canteens, and at vending machines. With TWINT, you can transfer money in real-time – easily from smartphone to smartphone. And you can also request and receive money from friends and family.
Datatrans gives you with the option to integrate TWINT in your web shop and in your native mobile applications. Additionally, Datatrans supports the tokenization of TWINT - User on File.
Payment Method provider website 🔗
WebView To App Switch
In case you are using a WebView in your mobile applications to process payments with TWINT and not our mobile SDKs, you will need to modify your request to allow a smooth switch from your app to TWINT. Please contact us if you wish to allow an App Switch from your WebView to Twint.
Test Environment
To test Twint payments, you will need to download a test app and go through the registration process again using a Swiss mobile phone number. Productive Twint apps will not allow you to test Twint payments. To install the test Twint app, you will have to download the so-called 'TWINT Configurator'. Once you have installed TWINT Configurator, open the app, and select the PAT environment for your Twint tests via Datatrans. To top up your test account, you will require voucher codes.
Please contact us to receive the link to download the TWINT Configurator and receive test vouchers for Twint. For some payment flows to work, you may have to complete an account verification at Twint and contact their support to activate your Twint account.
Registering a TWINT wallet
To register a TWINT wallet so that you are able to debit an account without user interaction, you will need to create a dedicated registration. This can be done by sending the amount parameter set to 0 (amount=0) and useAlias to 'yes' (useAlias=yes). After a registration was successfully created, we will return the TWINT token in our response parameter aliasCC.
For registrations to work, you need to make sure that your TWINT account has the option 'User on File (UoF)' activated. This can be activated upon request from your TWINT account manager. Please make sure to upload a merchant logo to your TWINT store configuration, or you might run into bugs within the app. You can refer to the section Create an Alias of our docs for further information in how to create an alias.
Web payment flow
Server to Server API calls
After a transactionId or aliasCC value was received by completing a payment or registration, the following server to server API calls can be used to do further actions.
Authorization
Requirement: User on File (UoF)
Please make sure to have the option 'User on File' activated in your account to be able to use the Authorization API with TWINT. Make sure to also add a logo to your store configuration to avoid issues in production.
Request
curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_authorize.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<authorizationService version="4">
<body merchantId="1100004624">
<transaction refno="1234987abc">
<request>
<amount>100</amount>
<currency>CHF</currency>
<aliasCC>42f4a45f-0e7d-4d7a-8af6-be4558e42f99</aliasCC>
<pmethod>TWI</pmethod>
</request>
</transaction>
</body>
</authorizationService>
EOF
Response
<?xml version='1.0' encoding='UTF-8'?>
<authorizationService version='4'>
<body merchantId='1100004624' status='accepted'>
<transaction refno='1234987abc' trxStatus='response'>
<request>
<amount>100</amount>
<currency>CHF</currency>
<aliasCC>42f4a45f-0e7d-4d7a-8af6-be4558e42f99</aliasCC>
<pmethod>TWI</pmethod>
<reqtype>NOA</reqtype>
</request>
<response>
<responseCode>01</responseCode>
<responseMessage></responseMessage>
<uppTransactionId>200624134928081409</uppTransactionId>
<authorizationCode>928101410</authorizationCode>
<acqAuthorizationCode>4c9ad75f-58ab-4e5c-b36d-609b149af92a</acqAuthorizationCode>
</response>
</transaction>
</body>
</authorizationService>
Settlement
Request
curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_processor.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<paymentService version="2">
<body merchantId="1100004624">
<transaction refno="1234987abc">
<request>
<amount>100</amount>
<currency>CHF</currency>
<uppTransactionId>200624134928081409</uppTransactionId>
</request>
</transaction>
</body>
</paymentService>
EOF
Response
<?xml version='1.0' encoding='UTF-8'?>
<paymentService version='2'>
<body merchantId='1100004624' status='accepted'>
<transaction refno='1234987abc' trxStatus='response'>
<request>
<amount>100</amount>
<currency>CHF</currency>
<uppTransactionId>200624134928081409</uppTransactionId>
<reqtype>COA</reqtype>
<transtype>05</transtype>
</request>
<response>
<responseCode>01</responseCode>
<responseMessage>settlement succeeded</responseMessage>
</response>
</transaction>
</body>
</paymentService>
Cancel
Request
curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_processor.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<paymentService version="2">
<body merchantId="1100004624">
<transaction refno="1234987abc-cancel">
<request>
<amount>100</amount>
<currency>CHF</currency>
<uppTransactionId>200624134928081409</uppTransactionId>
<reqtype>DOA</reqtype>
</request>
</transaction>
</body>
</paymentService>
EOF
Response
<?xml version='1.0' encoding='UTF-8'?>
<paymentService version='2'>
<body merchantId='1100004624' status='accepted'>
<transaction refno='1234987abc-cancel' trxStatus='response'>
<request>
<amount>100</amount>
<currency>CHF</currency>
<uppTransactionId>200624134928081409</uppTransactionId>
<reqtype>DOA</reqtype>
<transtype>05</transtype>
</request>
<response>
<responseCode>01</responseCode>
<responseMessage>cancellation succeeded</responseMessage>
</response>
</transaction>
</body>
</paymentService>
EOF
Refund
Request
curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_processor.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<paymentService version="2">
<body merchantId="1100004624">
<transaction refno="1234987abc-refund">
<request>
<amount>100</amount>
<currency>CHF</currency>
<uppTransactionId>200624134928081409</uppTransactionId>
<transtype>06</transtype>
</request>
</transaction>
</body>
</paymentService>
EOF
Response
<?xml version='1.0' encoding='UTF-8'?>
<paymentService version='2'>
<body merchantId='1100004624' status='accepted'>
<transaction refno='1234987abc-refund' trxStatus='response'>
<request>
<amount>100</amount>
<currency>CHF</currency>
<uppTransactionId>200624134928081409</uppTransactionId>
<transtype>06</transtype>
<reqtype>COA</reqtype>
</request>
<response>
<responseCode>01</responseCode>
<responseMessage>credit succeeded</responseMessage>
<uppTransactionId>200624135801433286</uppTransactionId>
<authorizationCode>805493340</authorizationCode>
<acqAuthorizationCode>0</acqAuthorizationCode>
</response>
</transaction>
</body>
</paymentService>
Status
Request
curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_status.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<statusService version="5">
<body merchantId="1100004624">
<transaction>
<request>
<uppTransactionId>200624134928081409</uppTransactionId>
<reqtype>STX</reqtype>
</request>
</transaction>
</body>
</statusService>
EOF
Response
<?xml version='1.0' encoding='UTF-8'?>
<statusService version='5'>
<body merchantId='1100004624' status='accepted'>
<transaction trxStatus='response'>
<request>
<uppTransactionId>200624134928081409</uppTransactionId>
<reqtype>STX</reqtype>
</request>
<response itemNr='1'>
<responseCode>2</responseCode>
<responseMessage>Trx debit waiting for daily settlement process</responseMessage>
<refno>1234987abc</refno>
<amount>100</amount>
<currency>CHF</currency>
<authorizationCode>928101410</authorizationCode>
<pmethod>TWI</pmethod>
<uppTransactionId>200624134928081409</uppTransactionId>
<maskedCC></maskedCC>
<aliasCC>42f4a45f-0e7d-4d7a-8af6-be4558e42f99</aliasCC>
<expm></expm>
<expy></expy>
<trxDate>20200624</trxDate>
<trxTime>134928</trxTime>
<trtype>05</trtype>
<settledAmount>100</settledAmount>
<acqAuthorizationCode>4c9ad75f-58ab-4e5c-b36d-609b149af92a</acqAuthorizationCode>
<uppStatus3D></uppStatus3D>
</response>
</transaction>
</body>
</statusService>
Updated 20 days ago