This page explains how to add TWINT to your existing Drop-in integration.
The focus of this page is on describing how to use the TwintComponent
of the native Twint SDK to enable Twint payments on Drop-in.
Requirements
Requirement | Description |
---|---|
Integration type | Make sure that you have built your Drop-in integration. |
Setup steps | Before you begin, add TWINT in your test Customer Area. |
How it works
-
When a shopper on your app clicks the button to pay with Twint,
TwintComponent
makes a /payments request which containssubtype: sdk
. TheActionComponent
is triggered, which determines the transaction flow. -
The shopper is redirected to the Twint app on their device (or an error is displayed if a Twint app is not installed).
-
After the payment is processed, Twint app will return back to your app using the
redirectURL
, contained in the payment result. -
If the payment is successful a /payments/details request is made that contains
paymentData
, otherwise an error is shown.
Drop-in configuration
Add the following configuration:
-
Create a
TwintPaymentMethod
instance from your payment methods list. -
Create the
TwintComponent
with thepaymentMethod
and the configuration. -
Set your
AdyenSession
instance as the delegate to let it handle the flow. -
Your app must configure a
callbackAppScheme
so that it is reopened when the payment is done. -
Your app should call the
RedirectComponent
in theAppDelegate
by adding below method. -
Register all the apps that will be opened by your app by adding the following entries to your App’s
Info.plist file
. If this is not done, then TWINT SDK will not find any installed TWINT app.
Recurring payments
To make recurring payments for TWINT, you need to:
Create a token
To create a token, include in your /payments request:
storePaymentMethod
: true- shopperReference: Your unique identifier for the shopper (minimum length three characters).
When the payment details have been stored, you receive a webhook containing:
eventCode
: RECURRING_CONTRACToriginalReference
: ThepspReference
of the initial payment.pspReference
: This is the token you need to make recurring payments for this shopper.
Make sure that your server is able to receive RECURRING_CONTRACT as part of your standard webhooks. If you have not requested this additional configuration yet, contact our Support Team.
Make a payment with a token
To make a payment with the token, include in your /payments request:
-
paymentMethod.storedPaymentMethodId
: ThepspReference
from the RECURRING_CONTRACT webhook.You can also get this value using the /listRecurringDetails endpoint.
-
shopperReference
: The unique shopper identifier that you specified when creating the token (minimum length three characters). -
shopperInteraction
: ContAuth. -
recurringProcessingModel
: Subscription or UnscheduledCardOnFile.
For more information about the shopperInteraction
and recurringProcessingModel
fields, refer to Tokenization.