This documentation provides instructions on adding the XPay Android Native SDK to an android project. It covers setup for both Kotlin and Java languages, event handling, UI customization, and payment processing.

Prerequisite Dependancy

implementation("com.squareup.okhttp3:okhttp:4.9.2")

E2E Integration Sample Repo

https://github.com/XStakCommerce/XPay-Element-Android-SDK

Gradle Configuration Add JitPack in the dependency resolution management section:

repositories {
    mavenCentral()
    maven { url '<https://jitpack.io>' }
}

For Older Gradle Versions:

allprojects {
    repositories {
        mavenCentral()
        maven { url '<https://jitpack.io>' }
    }
}

Add the XPay SDK Dependency

// for production
dependencies {
  implementation ("com.github.XStakCommerce:XPay-Element-Android-Native-SDK:1.0.1")
}

// for stagging

dependencies {
  implementation ("com.github.XStakCommerce:XPay-Element-Android-Native-SDK:stage-1.0.1")
}

Configuring XML Layout

Define a ViewGroup in your activity or fragment XML to host the SDK UI components:

Using LinearLayout

<LinearLayout
    android:id="@+id/elementView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
</LinearLayout>

Using FrameLayout

<FrameLayout
    android:id="@+id/elementView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
</FrameLayout>