Quick Start
The PayBito Android SDK is a professional-grade fintech solution for seamless crypto and fiat payment integration. Built on a reactive architecture, it bridges native Android environments with the PayBito payment gateway.
Key Features
Reactive Cart Engine
Real-time state synchronization using Kotlin StateFlow for live cart updates across your UI.
Dynamic Branding
Automatically fetches broker-specific names and configurations for white-label support.
Secure Checkout
Mobile-optimized WebView with 3D Secure authentication for bank-grade payment security.
Easy Integration
Single-line checkout initiation and automated cart lifecycle management out-of-the-box.
Installation
Add JitPack Repository
Add the JitPack repository to your settings.gradle:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add SDK Dependency
Add the SDK to your app/build.gradle dependencies block:
dependencies {
implementation 'com.github.arunava2804.PayBito-Payments-Android-SDK:library:v1.1.2'
}
Initialization
The SDK is a singleton and must be initialized once at the application level. This ensures that even if the app is killed and restarted, the SDK can restore the user's cart token from SharedPreferences.
Application Class Setup
Create or modify your Application class to initialize the SDK with your merchant credentials:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
val config = PayBitoConfig(
merchantId = 26660L,
publicKey = "pk_your_public_key",
brokerId = "your_broker_id",
origin = "https://your-domain.com/",
enableDebugLogs = true
)
PayBitoSdk.init(this, config)
}
}
Configuration Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
merchantId |
Long | Yes | Your PayBito merchant account ID |
publicKey |
String | Yes | Your public API key from the merchant portal |
brokerId |
String | Yes | Broker identifier for white-label branding |
origin |
String | Yes | Whitelisted origin URL in the merchant portal |
enableDebugLogs |
Boolean | No | Enable verbose SDK logging (disable in production) |
Core API
The SDK provides a clean reactive API for managing the shopping cart and triggering checkout. All network calls and local persistence are handled automatically.
A. Add to Cart
Use PayBitoSdk.addToCart() to add products. The SDK handles all network calls and local persistence automatically.
val product = PayBitoProduct(
productId = "P001",
name = "Studio Headphones",
price = 89.99,
imageUrl = "https://example.com/image.jpg"
)
lifecycleScope.launch {
PayBitoSdk.addToCart(product)
}
B. Observe Cart State (Reactive)
Collect the cartState Flow to automatically update your UI whenever the cart changes. This is the recommended pattern for keeping badges and totals in sync.
lifecycleScope.launch {
PayBitoSdk.cartState.collect { state ->
// Runs automatically whenever the cart changes
binding.tvCartCount.text = state.count.toString()
binding.tvTotalAmount.text = "$" + state.total
adapter.updateItems(state.items)
}
}
C. Update Item Quantity
For existing cart items, use updateQuantity() rather than re-adding the product:
// Increment or decrement quantity for an existing item
lifecycleScope.launch {
PayBitoSdk.updateQuantity(productId = "P001", newQty = 3)
}
D. Open Cart UI
The SDK provides a built-in BottomSheet cart drawer that can be launched from any FragmentActivity:
PayBitoSdk.openCart(this) // Requires FragmentActivity
E. Clear Cart
Call clearCart() after a successful payment to reset the user's cart for the next session:
PayBitoSdk.clearCart()
clearCart() inside your PaymentResultActivity after a confirmed successful checkout to guarantee a clean state for the next purchase.Checkout Flow
The checkout process is initiated with a single method call. The SDK handles the complete secure payment flow, including 3D Secure verification and post-payment deep linking.
Launching Checkout
PayBitoSdk.checkout(this)
Checkout Activity Internals
Mobile-Optimized WebView
The SDK opens a custom PayBitoCheckoutActivity that forces a mobile-optimized viewport for all payment pages, ensuring a native-feeling user experience.
3D Secure Support
The WebView is pre-configured to handle 3D Secure popups required by modern banks. No additional configuration is needed on your end.
Success Deep Linking
When the web-based payment completes, the gateway redirects to paybito://checkout/success. Your app captures this via an <intent-filter> in the manifest.
<activity android:name=".payment.PaymentResultActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="paybito"
android:host="checkout"
android:pathPrefix="/success" />
</intent-filter>
</activity>
Demo App Guide
The TechStore Demo App demonstrates best practices for building a premium e-commerce experience with the PayBito SDK using MVVM-lite architecture and reactive programming.
App Architecture
ViewBinding
Type-Safe UI
StateFlow
Reactive
Material 3
Dark Theme
Glide
Images
Core Implementation Steps
Global Configuration — MyApplication.kt
Initialize the SDK once at the application level using real credentials. The SDK restores cart state automatically from SharedPreferences on app restart.
Reactive UI Sync — MainActivity.kt
Instead of manually updating the UI on every button click, observe PayBitoSdk.cartState. This pattern keeps badges and totals synchronized across all screens automatically.
Product Grid — ProductAdapter.kt
Uses a GridLayoutManager (2 columns). The adapter distinguishes two actions: addToCart() for new items and updateQuantity() for the +/- stepper on existing items. Images are loaded via Glide with placeholders.
Success Handling — PaymentResultActivity.kt
A deep-link activity that catches paybito://checkout/success, renders the success confirmation card, and calls PayBitoSdk.clearCart() to reset state.
Key Files to Study
- com.example.paybitodemo.MainActivity — Central hub for UI logic and cart observation
- com.example.paybitodemo.ProductAdapter — Complex RecyclerView with add/update logic
- com.example.paybitodemo.payment.PaymentResultActivity — Post-checkout deep link handler
UI Design Principles
Adaptive Dimensions
Uses sdp for dimensions and ssp for text scaling, ensuring consistent layouts across all Android screen densities.
Dark Mode First
Premium dark palette reduces eye strain and makes product visuals pop — ideal for a fintech or e-commerce context.
ProGuard & Security
If your app uses code obfuscation (recommended for production releases), add the following rules to your proguard-rules.pro to prevent the SDK models from being stripped or renamed.
# Keep PayBito SDK models intact
-keep class com.paybito.sdk.models.** { *; }
-dontwarn com.paybito.sdk.**
ClassNotFoundException crashes in production. Always test a release build before submitting to the Play Store.Security Best Practices
Credential Management
Store Keys Securely
Use Android Keystore, encrypted SharedPreferences, or a remote config service — never commit raw keys to Git.
Disable Debug Logs in Production
Set enableDebugLogs = false (or omit it) in your production PayBitoConfig to prevent sensitive data exposure in Logcat.
Whitelist Your Origin
Ensure your origin URL is correctly registered in the PayBito Merchant Portal to avoid 500 errors at checkout.
Distribution & JitPack
The SDK is distributed via JitPack.io. This section explains how the library is configured for publication and how to create new versioned releases.
Library build.gradle Configuration
For JitPack to correctly build the library, the library/build.gradle must include the maven-publish plugin:
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'maven-publish'
}
android {
publishing {
singleVariant('release') {
withSourcesJar()
}
}
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
groupId = 'com.github.arunava2804.PayBito-Payments-Android-SDK'
artifactId = 'library'
version = project.findProperty('version') ?: '1.1.2'
}
}
}
}
Creating a New Release
Push to Main
Commit all changes and push to the main branch. Ensure android.useAndroidX=true is set in gradle.properties.
Create a GitHub Release
Go to Releases on your GitHub repo and create a new tag (e.g., v1.1.3).
Trigger JitPack Build
Visit JitPack.io and look up arunava2804/PayBito-Payments-Android-SDK. Click the new tag version to trigger the build.
FAQ & Troubleshooting
Common integration issues and their solutions.
The origin URL in your PayBitoConfig must be whitelisted in the PayBito Merchant Portal. Ensure the URL matches exactly (including trailing slash) what is registered under your merchant account.
Verify that the scheme and host in your AndroidManifest.xml <intent-filter> match the redirect URL configured on your server. The scheme must be paybito and the host must be checkout.
Unsplash image URLs require an active internet connection. Verify your device or emulator has network access. Also confirm your app declares the INTERNET permission in the manifest and is not blocked by a network security config.
Add the required ProGuard rules to your proguard-rules.pro: -keep class com.paybito.sdk.models.** { *; } and -dontwarn com.paybito.sdk.**. This prevents the SDK model classes from being stripped during obfuscation.
These credentials are available in your PayBito Merchant Portal under the API / SDK settings section. Visit paybito.com/gateway-integration for the full onboarding guide.
The SDK is written in Kotlin and uses Coroutines and StateFlow. While interoperability with Java is technically possible, you will need the Kotlin coroutine interop adapters (kotlinx-coroutines-jdk8). A pure Kotlin implementation is strongly recommended.

