Android SDK
Plexy Drop-in and Components for Android apps
Android SDK
The official Plexy client-side SDK for Android. Build full Drop-in checkout or use individual Components, with first-class support for Jetpack Compose and traditional Views.
Requirements
- Android 7.0 (API 24)+
- Kotlin 1.9+
- Gradle 8.0+
Installation
Add the dependency to your module's build.gradle:
Jetpack Compose:
dependencies {
implementation 'money.plexy.checkout:drop-in-compose:1.0.0'
}Views:
dependencies {
implementation 'money.plexy.checkout:drop-in:1.0.0'
}Make sure Maven Central is in your repositories:
repositories {
mavenCentral()
}Quick Start (Compose)
import money.plexy.checkout.dropin.compose.PlexyCheckout
@Composable
fun CheckoutScreen(sessionId: String, sessionData: String) {
val checkoutLauncher = rememberPlexyCheckoutLauncher(
callback = { result ->
when (result) {
is PlexyCheckoutResult.Finished -> { /* handle */ }
is PlexyCheckoutResult.Error -> { /* handle */ }
is PlexyCheckoutResult.Cancelled -> { /* handle */ }
}
}
)
Button(onClick = {
checkoutLauncher.start(
checkoutSession = CheckoutSession(
id = sessionId,
sessionData = sessionData
),
configuration = checkoutConfiguration()
)
}) {
Text("Pay 100 KZT")
}
}Quick Start (Views)
class CheckoutActivity : AppCompatActivity() {
private lateinit var checkoutLauncher: PlexyCheckoutLauncher
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
checkoutLauncher = PlexyCheckoutLauncher(this) { result ->
handleResult(result)
}
findViewById<Button>(R.id.payButton).setOnClickListener {
startCheckout()
}
}
private fun startCheckout() {
checkoutLauncher.start(
checkoutSession = CheckoutSession(id, sessionData),
configuration = checkoutConfiguration()
)
}
}Configuration
val configuration = CheckoutConfiguration(
environment = Environment.TEST,
clientKey = BuildConfig.PLEXY_CLIENT_KEY,
shopperLocale = Locale("en", "KZ"),
amount = Amount(value = 10000, currency = "KZT"),
) {
card {
setHolderNameRequired(true)
setShowStorePaymentField(true)
}
googlePay {
setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
}
}Components
Use individual Components for a custom checkout flow:
val cardComponent = CardComponent.PROVIDER.get(
activity = this,
paymentMethod = cardPaymentMethod,
configuration = cardConfiguration,
callback = { state ->
if (state.isValid) {
submitPayment(state.data)
}
}
)
binding.cardView.attach(cardComponent, this)Google Pay
Add the dependency:
implementation 'money.plexy.checkout:google-pay:1.0.0'Then enable in configuration:
val googlePayConfig = GooglePayConfiguration.Builder(
locale = Locale("en", "KZ"),
environment = Environment.TEST,
clientKey = BuildConfig.PLEXY_CLIENT_KEY
)
.setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
.setAmount(Amount(value = 10000, currency = "KZT"))
.build()ProGuard
The SDK ships with consumer ProGuard rules — no manual configuration is required.
Error Handling
private fun handleResult(result: PlexyCheckoutResult) {
when (result) {
is PlexyCheckoutResult.Finished -> {
Toast.makeText(this, "Success: ${result.resultCode}", LENGTH_SHORT).show()
}
is PlexyCheckoutResult.Error -> {
Log.e("Plexy", "Error: ${result.errorMessage}", result.exception)
}
is PlexyCheckoutResult.Cancelled -> {
// User cancelled
}
}
}