On this page, you can find additional configuration for adding Twint to your integration.
The integration works out of the box for sessions implementation. Check out the integration guide here.
There is no additional configuration required. Follow the Advanced flow integration guide.
Use the following module and component names:
- To import the module use
twint
.
implementation "com.adyen.checkout:twint:YOUR_VERSION"
- To launch and show the Component use
TwintComponent
.
val component = TwintComponent.PROVIDER.get(
activity = activity, // or fragment = fragment
checkoutSession = checkoutSession, // Should be passed only for sessions
paymentMethod = paymentMethod,
configuration = checkoutConfiguration,
componentCallback = callback,
)
Make sure to follow the Android Components integration guide for sessions integration here.
Make sure to follow the Android Components integration guide for advanced integration here.
CheckoutConfiguration(
environment = environment,
clientKey = clientKey,
..
) {
twint {
setShowStorePaymentField(true)
setActionHandlingMethod(ActionHandlingMethod.PREFER_NATIVE)
}
}
setShowStorePaymentField
allows you to specify if a switch is shown that enables shoppers to store their details for faster future payments.
setActionHandlingMethod
allows you to specify how the action returned from the /payments
call will be handled. ActionHandlingMethod.PREFER_NATIVE
will try to use a native flow and ActionHandlingMethod.PREFER_WEB
will try to use a web/browser based flow.
- Include the
storedPaymentMethodMode
andshopperReference
parameter in your/sessions
request. - The API response will contain a list of the shopper's stored payment methods.
- For drop-in, pass the API response as explained in the integration guide and it will show the stored payment methods.
- For components, get the Twint
StoredPaymentMethod
from the list and pass it when creating theTwintComponent
:
val storedPaymentMethods = checkoutSession.sessionSetupResponse.paymentMethodsApiResponse?.storedPaymentMethods
val storedPaymentMethod = storedPaymentMethods?.firstOrNull { TwintComponent.PROVIDER.isPaymentMethodSupported(it) }
val component = TwintComponent.PROVIDER.get(
activity = activity, // or fragment = fragment
checkoutSession = checkoutSession,
storedPaymentMethod = storedPaymentMethod,
configuration = checkoutConfiguration,
componentCallback = callback,
)
- When a shopper chooses to pay, they will be provided with the option to store their payment details. To remove the option to store payment details, add
setShowStorePaymentField(false)
when configuring Twint. - The
PaymentComponentState
will contain the shopper's choice indata.storePaymentMethod
. - Include
storePaymentMethod
andshopperReference
in the/payments
request. - Include the
shopperReference
in the/paymentMethods
request and the response will contain a list of the shopper's stored payment methods. - For drop-in, pass the API response as explained in the integration guide and it will show the stored payment methods.
- For components, get the Twint
StoredPaymentMethod
from the list and pass it when creating theTwintComponent
:
val storedPaymentMethods = paymentMethodsApiResponse?.storedPaymentMethods
val storedPaymentMethod = storedPaymentMethods?.firstOrNull { TwintComponent.PROVIDER.isPaymentMethodSupported(it) }
val component = TwintComponent.PROVIDER.get(
activity = activity, // or fragment = fragment
storedPaymentMethod = storedPaymentMethod,
configuration = checkoutConfiguration,
componentCallback = callback,
)