This guide is aimed at advanced users who want to create adyen integration for their custom android application.
You also need to install Spree Adyen extension before.
Note
The list of available library versions can be found on Official Adyen Documentation for Android integration Current newest version available at the moment of writing the tutorial is 5.13.1. This doc will be referring to the library version as YOUR_VERSION.Resources
- Official Adyen Documentation for Android integration
- Spree Adyen API docs - create payment_session and get payment_session
- Official Adyen example for Android integration
Overview
The integration consists of two main components:- Spree Adyen: Provides API for your client and receive payment result from Adyen
- Your Android client app: Shows the Drop-in UI and handles payment flow
Step 1: Import the library
Import the compatibility module:Import the module with Jet Compose
Import without Jet Compose
Step 2: Create a checkout session
Create session using this endpoint.sessionData
- available asadyen_data
in payment_session API responseid
- available asadyen_id
in payment_session API response
Step 3
callCheckoutSessionProvider.createSession
passing serialized session data (sessionModel
) and dropInConfiguration
dropInConfiguration example:
environment
- enum: live
or test
clientKey
- client_key
from payment_sessions endpoint
shopperLocale
- shopper locale in ISO format
Step 4: Launch and show Drop-in
Step 5: Create the Drop-in launcher
DropIn.startPayment, passing:dropInLauncher
- The Drop-in launcher objectcheckoutSession
- result ofCheckoutSessionProvider.createSession
dropInConfiguration
- Your Drop-in configuration
Get payment outcome
- Wait for backend to process the payment
- Continue shopping experience
1. Wait for backend to process the payment
backend will change the state ofpayment_session
to one of the following state
pending
- chosen payment method can take a while to completecompleted
- payment resulted in success, order completedcanceled
- payment canceled, payment isvoid
refused
- payment failed