Guides
These docs are for v1.0.1. Click to read the latest docs for v2.1.0.

TWINT

120

paymentmethod=TWI

Payment ProcessIntegration
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, you will need to download a test app and go through the registration process again. Using the productive TWINT app will not allow you to test TWINT payments. You can open the following links to download the so-called 'TWINT Configurator' and finally the test application:
Configurator Android: dtrx.ch/twint-android 🔗
Configurator iOS: dtrx.ch/twint-ios 🔗

Please select the PAT environment for your tests via Datatrans. To top up your test account you will require voucher codes that are available on request.

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

 1 
[Not supported by viewer]
Customer clicks Pay
Customer clicks Pay
Merchant Website
Merchant Website
Merchant Server
Merchant Server
Payment Page loaded from Datatrans
Payment Page loaded from Datatrans
Twint
Twint
 3 
[Not supported by viewer]
Customer selects Twint
[Not supported by viewer]
 2 
[Not supported by viewer]
 4 
[Not supported by viewer]
Request for Token and QR Code
Request for Token and QR Code
Validates and creates Transaction; returns QR Code and Token
[Not supported by viewer]
Displays QR Token / Waiting Page
Displays QR Token / Waiting Page
Monitors transaction status
Monitors transaction status
9.1
[Not supported by viewer]
 10 
[Not supported by viewer]
Receives Result and Invokes merchant's
POST URL (Webhook)
[Not supported by viewer]
Receives Result 
Receives Result 
 11 
[Not supported by viewer]
Redirects customer back to merchant
Redirects customer back to merchant
Customer gets redirected to merchant page
Customer gets redirected to merchant page
Returns Status of transaction
Returns Status of transaction
User's Device
User's Device
 7 
[Not supported by viewer]
Confirms Transaction
Confirms Transaction
 8 
[Not supported by viewer]
 9 
[Not supported by viewer]
 5 
[Not supported by viewer]
 6 
[Not supported by viewer]

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>