Hosted Checkout Page
The Hosted Checkout Page provides a unified payment UI with three options:
- Google Pay
- Instant Bank Transfer
- Pay by Card
Flow: user taps Pay → Hosted Checkout Page opens → user selects a payment method → result is returned via PBLPaymentResult.
Integration
- Fetch session configuration
private suspend fun fetchSessionConfiguration(): PBLConfiguration {
val response = apiClient.initPayment()
return PBLConfiguration(
sessionId = response.sessionId,
ephemeralKey = response.ephemeralKey,
userId = "user_id_from_app",
environment = PBLEnvironment.SANDBOX
)
}- Launch the Hosted Payment Page
private var payablSDK: PayablSDK? = null
private fun placeOrderWithSessionInit() {
lifecycleScope.launch {
val configuration = fetchSessionConfiguration()
payablSDK = PayablSDK.init(configuration)
payablSDK?.start(supportFragmentManager) { result ->
handlePaymentResult(result)
}
}
}- Handle results
private fun handlePaymentResult(result: PBLPaymentResult) {
when (result) {
is PBLPaymentResult.Completed -> {
// Payment successful
}
is PBLPaymentResult.Canceled -> {
// User cancelled
}
is PBLPaymentResult.Failed -> {
// Payment failed
}
}
payablSDK = null
}Updated about 15 hours ago
