Overview
The lite Android SDK lets customers pay without leaving your app. It provides two integration options:- Payment Sheet: a complete checkout presented over your existing interface.
- Embeddable payment form: the same lite-managed checkout UI placed inside your Jetpack Compose layout.
How it works
- Your server creates a checkout session with the lite API and receives a session secret.
- Your app gives the session secret to the SDK.
- The SDK loads the session and displays the payment methods enabled for it.
- The customer enters a new card or selects a saved card.
- The SDK encrypts new card data, tokenizes it, and submits the payment.
- If required, the SDK presents and completes 3D Secure automatically.
- Your server confirms the final payment result before fulfilling the order.
Before you begin
You need:- A lite account with a configured channel.
- Valid lite API keys on your server.
- A backend endpoint that creates lite checkout sessions.
- An Android app using API 26 or later.
compileSdk35 or later and Java 17.
Integrate the SDK
1. Install the SDK
Make sure Maven Central is available in your dependency repositories:2. Create a checkout session
Your server must create a checkout session using your lite API credentials and return its session secret to the app. Do not generate the session secret in the app and do not include your lite API keys in application resources orBuildConfig.
client_secret to your app, where the SDK takes it as clientSecret. Keep the session id on your server so you can confirm the payment afterwards.
The session determines the amount, currency, enabled card networks, and eligible saved cards. Create a new session for each checkout attempt.
3. Present the Payment Sheet
The Payment Sheet is the recommended integration. It manages its own checkout UI and 3D Secure lifecycle:present from an Activity. The SDK attaches its 3D Secure presenter for the duration of the Payment Sheet and removes its UI when checkout finishes.
Only one Payment Sheet can be presented at a time. A second presentation attempt returns a failure with the error code already_presenting.
The available card layouts are:
4. Embed the payment form
UseLitePaymentForm when checkout must appear inside your own Compose screen. Own Lite as an Activity ViewModel and wrap the form in LiteHost:
clientSecret starts the SDK automatically. LiteHost attaches the built-in 3D Secure presenter while its content is composed and detaches it when the content is removed.
If you do not use LiteHost, attach and detach the same Lite instance manually:
LiteHost and manual attach/detach together for the same instance.
You can observe initialization and payment state through StateFlow:
5. Save and reuse cards
When the session contains eligible saved cards, the Payment Sheet and embeddable form display them automatically. The customer can select a saved card or enter a new one. For a new card, the form includes a Save card for future purchase control. Saved cards are available only when the customer and checkout session are eligible for them. Your server remains responsible for creating the session with the correct customer context.6. Handle 3D Secure
No separate 3D Secure implementation is required. The SDK presents the issuer challenge in a secured in-app WebView and resumes payment processing after it closes. For the Payment Sheet, attachment is automatic. For the embeddable form, useLiteHost or call lite.attach(activity) as shown above. If no Activity is attached when 3D Secure is required, the payment fails instead of waiting indefinitely.
Keep the Activity and checkout screen alive until the result callback runs. Do not fulfill the order from the 3D Secure callback or redirect alone; wait for the lite payment result and verify it from your server.
7. Handle the result
The callback receives aLite.PayResult:
The built-in form disables its pay button while a payment is in progress. Keep your checkout screen mounted until the result callback runs.
8. Confirm the payment on your server
A client-side success result is not sufficient for order fulfillment. The app can close, lose connectivity, or be modified. Always retrieve the checkout session or payment from your server and verify its final state before fulfilling the order.Clean up
The Payment Sheet clears card fields when it closes. For an embeddable integration, the ActivityViewModel owns Lite. Reset it when the customer abandons checkout or when you intentionally restart the flow:
reset() cancels the active SDK payment job and removes the loaded session, collected card fields, selected saved card, and previous result.
Test your integration
Use lite test API keys and test cards to verify:- Successful card payments.
- Declined and unsupported cards.
- 3D Secure success, failure, and cancellation.
- Processing payments.
- Saved-card display and payment.
- Saving a new card for future use.
- Payment Sheet dismissal.
- Activity recreation and rotation.
- Reopening a completed session.