I'm integrating stripe in my android app with custom UI using the stripe provided views.
I'm having problems finding the right view for displaying card selection options to customer.
My settings are the following:
I have a validated customer session (the customer has previously paid with and saved other cards)
I have an ephemeral key returning from my server that represents the current customer
I have a valid payment session
I don't know what view to use for displaying previously used card options for the user.
In my xml I have a CardFormView which can be used to add new cards. (this view does not have the capability to display previously used cards)
I'm configuring my stripe implementation for subscriptions (with optional recurring billing)
I don't want to use the paymentSession.presentPaymentMethodSelection() as it starts a new activity (which breaks with the app's UI/UX I want to achieve)
I've been surfing the sea of information on stripe Api documentation, but can't find the answer yet. Thanks in advance!
Current Implementation code: activity:
PaymentConfiguration.init(
context = this,
publishableKey = "pk_test_..."
)
CustomerSession.initCustomerSession(this, MyEphemeralKeyProvider())
val paymentSession = PaymentSession(this, Payment().createPaymentSessionConfig())
paymentSession.init(Payment().MyPaymentSessionListener())
fun createPaymentSessionConfig(): PaymentSessionConfig = PaymentSessionConfig.Builder()
.setShippingInfoRequired(false)
.setShippingMethodsRequired(false)
.setPaymentMethodTypes(listOf(PaymentMethod.Type.Card))
.build()
inner class MyPaymentSessionListener : PaymentSession.PaymentSessionListener {
override fun onPaymentSessionDataChanged(data: PaymentSessionData) {
data.paymentMethod?.let { paymentMethod ->
// Display information about the selected payment method
}
if (data.isPaymentReadyToCharge) {
//TODO implement
}
}
override fun onCommunicatingStateChanged(isCommunicating: Boolean) {
}
override fun onError(errorCode: Int, errorMessage: String) {
}
}
xml:
<com.stripe.android.view.CardFormView
android:id="@+id/my_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
...
/>