The Android SDK makes it easy to integrate payment flows into your Android app.Documentation Index
Fetch the complete documentation index at: https://docs.y.uno/llms.txt
Use this file to discover all available pages before exploring further.
Additional resources
- Access the Release notes or the Yuno Android SDK repository to verify the latest SDK version available.
Requirements
- Minimum SDK Version:
minSdkVersion21 or above - Java: Java 8 enabled
- AndroidX: Use AndroidX instead of older support libraries
- Android Gradle Plugin: 4.0.0 or above
- ProGuard: 6.2.2 or above
- Kotlin Gradle Plugin: 1.4.0 or above
- ELF Page Size Support: Compliant with Google’s 16 KB ELF page alignment requirements (Android 15 / ARMv9 ready)
ProGuard / R8 Configuration
If your project hasminifyEnabled = true, add these rules to your proguard-rules.pro file to ensure the SDK works correctly, especially with AGP 8.x+ R8 full mode.
Official Yuno ProGuard / R8 rules
Official Yuno ProGuard / R8 rules
Why are these rules necessary?
AGP 8.x+ enables R8 full mode by default, which aggressively strips generic type signatures. Without-keepattributes Signature, Gson’s TypeToken<T> can fail at runtime with java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType.Include the library in your project
The first step is including the library in your project. Add the Yuno Android SDK to your project through Gradle. Add the repository source and dependency:Parameters
For the full list of parameters and YunoConfig details, see the Android SDK Common Reference.| Parameter | Description |
|---|---|
checkoutSession | Checkout session ID from your backend (Create checkout session API). Required. |
countryCode | ISO country code (e.g. US). Required. |
callbackPaymentState | Callback: payment state (e.g. SUCCEEDED, FAIL, PROCESSING, REJECT). |
merchantSessionId | Optional merchant session identifier. |
YunoConfig (initialize) | Optional: saveCardEnabled, keepLoader, language, styles. See Common Reference. |
full-checkout
Implement Full (Android): customizable UI, payment method management, fraud prevention, and checkout flows. More feature-rich than Headless, which focuses on core payment processing. See Requirements above.Step 1: Include the library in your project
Follow the steps in Include the library in your project above.Step 2: Initialize SDK with the public key
Retrieve your public API keys from the Yuno Dashboard. If you haven’t implemented a custom application, create one. In theonCreate() method of your application class, call the initialize function (Yuno.initialize):
YunoConfig to customize the SDK’s behavior. Include this configuration when calling Yuno.initialize(). The available options are:
YunoConfig options
Customization options:| customization option | Description |
|---|---|
saveCardEnabled | Enables the Save card checkbox on card flows. Check the Save card section for more information. |
keepLoader | When true, the SDK loader persists from OTT generation until continuePayment() is called. For details, see keepLoader Parameter. |
language | Defines the language to be used in the payment forms. You can set it to one of the available language options:
|
styles | Enables SDK-wide UI customization. Use it to define global visual styles like font family and button appearance (color, padding, radius, typography) through a YunoStyles object. For more information, check the styles section. |
Step 3: Create the checkout session
Each payment requires a newcheckout_session. Use the Create checkout session endpoint to create one; use that session to initiate the payment.
If your payment flow sends users to an external browser (e.g., for 3DS authentication or bank redirects), set the callback_url when creating your checkout session. See Handle external browser return (callback_url) for details.
Step 4: Start the checkout process
Call thestartCheckout method inside the onCreate() function of the activity that initializes the SDK to start a new payment process with Full (Android):
callbackPaymentState:
| State | Description | Additional action required |
|---|---|---|
SUCCEEDED | The transaction or payment process was successfully completed without any errors. | No. |
FAIL | The transaction failed due to errors such as data validation issues, server connection failures, or technical/network problems. | Yes. Investigate the cause of failure (validation, network, server) and take corrective measures. |
PROCESSING | The transaction is currently in progress, awaiting approval or verification. | No. |
REJECT | The transaction was rejected due to reasons like insufficient funds or suspected fraudulent activity. | Yes. Inform the user of the rejection, provide the reason if possible, and suggest actions. |
INTERNAL_ERROR | An unexpected internal error occurred within the system handling the payment process. | Yes. Requires technical intervention to review the system, fix internal issues, and retry or inform the user. |
CANCELED | The user voluntarily canceled the transaction or abandoned the payment process. | No. |
Payment status validation
This section explains how the SDK handles payment status when users cancel or leave payment flows, and how the SDK status relates to the backend payment status in these scenarios.Sync payment methods (Google Pay)
For synchronous payment methods like Google Pay, when a user cancels or closes the wallet UI before a payment service provider (PSP) response is received:- SDK Status: Returns
CANCELED(CANCELLED_BY_USER) - Backend payment status: Remains
PENDINGuntil PSP timeout or merchant cancellation - Important: The SDK will not return
REJECTorPROCESSINGin this scenario
Async payment methods (PIX and QR-based methods)
For asynchronous payment methods like PIX, when a user closes the QR code window (clicks X) before completing the payment:- SDK Status: Returns
PROCESSING, optionally with a sub-status such asCLOSED_BY_USER - Backend payment status: Remains
PENDINGand the QR code remains valid until expiry - Checkout session reuse: Re-opening the same checkout session can display the same valid QR code
- No Automatic Cancellation: The PIX payment is not automatically cancelled when the user closes the QR window
Expired async payments
If a PIX QR code expires naturally:- Backend Status: Updated to
EXPIRED - SDK Status: SDK callbacks and polling endpoints return
EXPIREDconsistently
Step 5: Add the SDK view to the checkout
Use thePaymentMethodListViewComponent to display the available payment methods when implementing Full (Android) with Jetpack Compose. This component provides callbacks to notify your app when to enable or disable the pay button, and when an enrolled payment method is successfully removed.
Component signature
Component options
activity: Activity: CurrentActivitywhere the component is hosted. Required for payment flows.modifier: Modifier?(optional): Layout and appearance (e.g. padding, spacing). Defaults tonull.onPaymentSelected: (Boolean) -> Unit: Invoked when a payment method is selected or deselected (true= method selected, enable pay button;false= none selected).onUnEnrollSuccess: (Boolean) -> Unit(optional): Invoked when a stored payment method is successfully removed.
Example
ImportantAlways wrap the component in a
Column with .verticalScroll(rememberScrollState()). Without this, the list of payment methods may not render or scroll properly when there are multiple methods available.Step 6: Initiate the payment process
Call thestartPayment() method to start a payment process:
Options
Configure the payment with the following options:| Parameter | Description |
|---|---|
showStatusYuno | A boolean that specifies whether the payment status should be displayed within the Yuno interface. |
callbackOTT | A required function that returns the updated one-time token (OTT) needed to complete the payment process. This token is required to complete the payment. |
callBackTokenWithInformation | A function that supplies detailed information about the one-time token, wrapped in a OneTimeTokenModel object, allowing for comprehensive handling of token details. |
OneTimeTokenModel
ThecallBackTokenWithInformation callback provides detailed information about the one-time token through the OneTimeTokenModel object:
Step 7: Get the one-time token (OTT)
After the customer fills out the requested data in Yuno’s payment forms, you will obtain the one-time token, a required parameter to create a payment using the Yuno API. The one-time token will be shared by Yuno using thecallbackOTT function you provided in Step 6 when initiating the payment. The one-time token will be available in the onActivityResult.
A loader can be shown while the one-time token is generated. Use Yuno’s default or implement your own with the required configuration.
Step 8: Create the payment
After receiving the one-time token from Step 7, create the payment using the Create payment endpoint. Use thecheckout_session from Step 3 and the one-time token to create the payment.
The response from the Create payment endpoint will include the parameter sdk_action_required, which defines if additional actions are required to finish the payment based on the payment type.
Step 9: Continue payment
Yuno requires integrating the SDK’scontinuePayment method after the payment is created, as certain asynchronous payment methods require additional customer actions to complete. The response from the Create payment endpoint, from Step 8, will include an sdk_action_required field. If it returns TRUE, you need to call the continuePayment() function to show additional screens that allow the customer to complete the payment. Otherwise, this step is not necessary. Call the continuePayment method:
FALSE in the showPaymentStatus parameter. Then, get the payment state by callback.