TWINT

Learn how to accept TWINT payments.

TWINT is a leading mobile payment method in Switzerland that allows customers to pay directly through the TWINT app using their linked bank account or stored balance. At checkout, users typically scan a QR code or confirm the payment in the app, enabling fast and secure transactions. TWINT offers merchants a convenient, widely adopted payment option for reaching customers in Switzerland.

Payment typeMobile
MarketSwitzerland
Customer currenciesCHF
Processing currenciesCHF
RefundsYes

Step 1. Make a transaction request

From your server, make a POST

https://service-sandbox.apmgw-dev.payabl.tech/apm_gw/payment_preauthorize

Request Type: POST
Content-Type: application/x-www-form-urlencoded

Request example (URL-encoded):

merchantid=gateway_test
amount=1.02
currency=CHF
payment_method=201
orderid=Payabl-Test
firstname=Muster
lastname=Mann
[email protected]
url_return=https://webhook.site/eaf4435c-9602-4874-a715-8cc8f7378a2c
url_success=https://webhook.site/0fac567b-4548-4c3b-9b30-ec772a80095a
url_failed=https://webhook.site/0fac567b-4548-4c3b-9b30-ec772a80095a
notification_url=https://webhook.site/0fac567b-4548-4c3b-9b30-ec772a80095a
language=en
signature=514e0de0bb82129e77eb754ff4d37aa370def97d
bankcountry=CHE

cURL example:

curl --location ‘https://<payment-endpoint>’ \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'merchantid=gateway_test \
--data-urlencode 'amount=1.02' \
--data-urlencode 'currency=CHF' \
--data-urlencode 'payment_method=201' \
--data-urlencode 'orderid=Payabl-Test' \
--data-urlencode 'firstname=Muster' \
--data-urlencode 'lastname=Mann' \
--data-urlencode '[email protected]' \
--data-urlencode 'url_return=https://webhook.site/eaf4435c-9602-4874-a715-8cc8f7378a2c' \
--data-urlencode 'url_success=https://webhook.site/0fac567b-4548-4c3b-9b30-ec772a80095a' \
--data-urlencode 'url_failed=https://webhook.site/0fac567b-4548-4c3b-9b30-ec772a80095a' \
--data-urlencode 'notification_url=https://webhook.site/0fac567b-4548-4c3b-9b30-ec772a80095a' \
--data-urlencode 'language=en' \
--data-urlencode 'signature=514e0de0bb82129e77eb754ff4d37aa370def97d' \
--data-urlencode 'bankcountry=CHE'
🚧

Public Sandbox information

Do not use your personal email address, Order ID with sensitive information, real customer details and credit card data in the public Sandbox. For email field you may use [email protected].

To complete the payment, you need to redirect the customer to the correct URL in the response.

Raw Response:

transactionid=4882196928951026956
transid=4882196928951026956
status=2000
errormessage=pending
errmsg=pending
amount=1.02
price=1.02
currency=CHF
orderid=Payabl-Test
payment_method=201
redirect_url=https://mp8tn4c192.execute-api.eu-central-1.amazonaws.com/default/authenticator.html?payment-charge-id=charge_P2NtLkzcUTYQo0w8hzmPx
📘

If status=2000, the payment has been successfully initialized. To complete the payment, redirect the customer to redirect_url.

Raw Failed Response:

transactionid=4882196933608178959
transid=4882196933608178959
status=-6150
errormessage=Not+supported+currency
errmsg=Not+supported+currency
amount=1.02
price=1.02
currency=PLN
orderid=Payabl-Test
payment_method=201

Step 2. Handle the redirect

📘

Redirection to url_return does not confirm that the transaction is successful. Always check the transaction via notification_url or use the diagnose interface to get the final status of the transaction.

After the customer completes the payment on the provider side, they will be redirected to your url_success or url_failed.

Successful Redirect Response:

transactionid=4882205148226291165
timestamp=1778079086
orderid=Payabl-Test
payment_method=201
errormessage=
errorcode=0
type=capture
amount=1.02
currency=CHF
payment_state=credited
security=718ee443dee42deb530edd7ae05d976ddcd732601da80038ee5469a508919865

Failed Redirect Response:

transactionid=4882196928951026956
timestamp=1776073238
orderid=Payabl-Test
payment_method=201
errormessage=Timeout
errorcode=203004
type=order
amount=1.02
currency=CHF
payment_state=not_credited
security=44dda4674341a358c1cdf39a40dda1ed1288e5c1e13e42acd0e9b72e4ce3c7ec

payment_state values:

ValueTransaction Status
not_credited_yetCapture - Accepted
creditedCapture - Successful
not_creditedCapture - Failed

Server-to-Server Notifications (Webhook)

Notification is sent to notification_url.

Successful Capture:

transactionid=4882205148226291165
timestamp=1778079086
orderid=Payabl-Test
payment_method=201
errormessage=
errorcode=0
type=capture
amount=1.02
currency=CHF
payment_state=credited
security=718ee443dee42deb530edd7ae05d976ddcd732601da80038ee5469a508919865

Failed Capture:

transactionid=4882196928951026956
timestamp=1776073215
orderid=Payabl-Test
payment_method=201
errormessage=Timeout
errorcode=203004
type=order
amount=1.02
currency=CHF
payment_state=not_credited
security=2fabeb96a0278b9c40fe5ae216e77b59a7322137518b5119bb71965d157d86f9

Refunds

TWINT supports refunds and can be initiated only on a successful captured transaction.
The request will send a credit note to the authorization system after the customer has already been charged. The refund amount will be credited to the customer and the merchant’s account will be charged.

The refund can be done in two ways:

  • Through API integration
  • Through payabl. dashboard

Endpoint: <sandbox URL>/payment_refund
Request Type: POST
Content-Type: application/x-www-form-urlencoded

Refund Request:

merchantid=gateway_test
amount=1.02
currency=CHF
signature=8765cfe1ad0148a771a6a278cc692ac20c6bae9a
transactionid=4882205148226291165

cURL Request Example:

curl --location 'https://<refund-endpoint>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'merchantid=gateway_test' \
--data-urlencode 'amount=1.02' \
--data-urlencode 'currency=CHF' \
--data-urlencode 'signature=8765cfe1ad0148a771a6a278cc692ac20c6bae9a' \
--data-urlencode 'transactionid=4882205148226291165'

Successful Refund Response:

transactionid=4882205148226291165
transid=4882205148226291165
status=0
errormessage=
errmsg=
amount=1.02
price=1.02
currency=CHF
orderid=Payabl-Test

Failed Refund Response:

transactionid=4882205148226291165
transid=4882205148226291165
status=-117
errormessage=refund+failed+%3A+wrong+currency
errmsg=refund+failed+%3A+wrong+currency
amount=
price=
currency=
orderid=Payabl-Test

Our Technical Support team is there to help you:
Email: [email protected]
Available Monday – Friday between 09:00 and 17:00 CET/CEST