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")
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:2.1.2")
}
// for stagging
dependencies {
implementation ("com.github.XStakCommerce:XPay-Element-Android-Native-SDK:stage-2.1.2")
}
<aside> 💡 Most of these permissions are auto-merged when you include the XPay SDK. However, if you still face any errors, manually adding them as shown below should resolve the issue.
</aside>
If you encounter any foreground service permission-related errors when using the XPay SDK, please make sure the following permissions are added in your app’s AndroidManifest.xml
file:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
Additionally, for notification-related functionality, you may optionally add:
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />