MyGuava Payment SDK is a comprehensive library for Android that simplifies the integration of various payment methods into your application. It provides a customizable UI and handles the complexities of payment processing, allowing you to focus on your core business logic.
- Simple Integration: Get started with just a few lines of code.
- Customizable UI: Easily adapt the look and feel to match your app's branding using Jetpack Compose or Views.
- Multiple Payment Methods: Supports payments via new cards, saved cards, and Google Pay.
| Main Payment Screen | Personal Data Entry | Saved Card Payment |
|---|---|---|
![]() |
![]() |
![]() |
- Android API Level:
21(Android 5.0 Lollipop) or higher - Compile SDK:
36or higher - Java Version:
17or higher - Kotlin Version:
2.1.21or higher
The SDK relies on modern Android libraries to provide a robust and seamless experience.
| Dependency | Version |
|---|---|
| Jetpack Compose | BOM 2025.08.01 |
| OkHttp | 4.12.0 |
| Retrofit | 3.0.0 |
| Kotlinx Serialization | 1.8.1 |
| Google Play Services Wallet | 19.4.0 |
| AndroidX Core | 1.17.0 |
| AndroidX Lifecycle | 2.9.3 |
Approximate SDK Size: The core library adds approximately ~1.2 MB to your app's download size.
First, add the GuavaPay Maven repository to your project's settings.gradle.kts file:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.guavapay.com/public")
name = "GuavaPay Maven Repository"
content {
includeGroupAndSubgroups("com.guavapay.myguava.business")
}
}
}
}Next, add the Payment SDK dependency to your module's build.gradle.kts file:
dependencies {
implementation("com.guavapay.myguava.business:payment-sdk-android:0.6.3")
}
β οΈ Attention Also required desugaring library from Google. Add them into dependencies block and enable desugaring core library:
android {
... other properties
compileOptions {
isCoreLibraryDesugaringEnabled = true
}
... other properties
}
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
}Using MyGuava Payment SDK is very simple, all you need is to call one method and create one model. UI configuration and more detailed customization will require more code, but in general, everything is very simple.
First, create a PaymentGatewayPayload with the necessary data (orderId and sessionToken) that you receive from your backend after creating an order.
β οΈ Warning: Always register orders on your backend. Never expose your API key on the client-side. Only thesessionTokenandorderIdshould be passed to the mobile client.
A minimal configuration is very simple:
val payload = PaymentGatewayPayload(order.id, order.sessionToken)Next, create the gateway instance.
- For View-based projects:
val gateway = PaymentGateway(activity, payload)- For Jetpack Compose projects:
val gateway = rememberPaymentGateway(payload)Launching the SDK is straightforward. Use the provided PaymentGatewayCoroutineScope to handle the lifecycle and receive the result.
PaymentGatewayCoroutineScope().launch {
when (val result = gateway.start()) {
is PaymentResult.Success -> { /* Handle success */ }
is PaymentResult.Unsuccess -> { /* Handle unsuccess */ }
is PaymentResult.Error -> { /* Handle error */ }
is PaymentResult.Cancel -> { /* Handle cancellation */ }
}
}β All done! This way the SDK will be launched, and the user will be able to make a payment.
You can select the environment in two ways:
-
Via Manifest (Recommended for production builds):
<!-- AndroidManifest.xml --> <meta-data android:name="com.guavapay.paymentsdk.environment" android:value="production" /> <!-- or "sandbox" -->
-
Via
PaymentGatewayPayload(Overrides manifest):val payload = PaymentGatewayPayload( orderId = order.id, sessionToken = order.sessionToken, environment = PaymentEnvironment.Sandbox )
The SDK's UI is built with Jetpack Compose, making it highly customizable. To apply your own theme, pass a looknfeel lambda to the PaymentGatewayPayload.
val payload = PaymentGatewayPayload(
// ... other params
looknfeel = PaymentGatewayPayload.PaymentGatewayLooknfeel { content ->
YourAppTheme {
content()
}
}
)For more granular control over component colors and sizes, you can extend PaymentSdkTokens and PaymentSdkSizes and provide them through a CompositionLocalProvider.
val customTheme = PaymentGatewayPayload.PaymentGatewayLooknfeel { content ->
// You can override entire theming by extending theme from PaymentSdkTokens or PaymentSdkSizes:
val customTokens = object : PaymentSdkTokens() { /* ... override colors ... */ }
val customSizes = object : PaymentSdkSizes() { /* ... override sizes ... */ }
// Or override with defaults:
val customSizes = PaymentSdkSizes().button().copy(height = 54.dp /* Overrides button height */)
val customTokens = PaymentSdkTokens().button().copy(containerColor = Color(0xFFFF00FF) /* Overrides button background color */)
CompositionLocalProvider(
LocalTokensProvider provides customTokens,
LocalSizesProvider provides customSizes
) {
YourAppTheme { content() }
}
}
val payload = PaymentGatewayPayload(
// ... other params
looknfeel = customTheme
)- When creating
PaymentGatewayPayloadin Jetpack Compose, wrap it inremember(key1, key2) { ... }to avoid unnecessary recompositions. - Always use the provided
PaymentGatewayCoroutineScope()to launch the payment flow. - Ensure you pass a
ComponentActivityinstance toPaymentGateway, not a genericContext. - Thoroughly test your integration in the sandbox environment before switching to production.



