Stripe-android: PaymentMethod card image

Created on 18 Dec 2019  路  4Comments  路  Source: stripe/stripe-android

Summary

I can't find the method to retrieve selected payment method card image in PaymentSession.PaymentSessionListener onPaymentSessionDataChanged().

SDK version

I'm using Stripe 12.8.0.

Other information

On the other hand this property is present in iOS SDK with call paymentContext.selectedPaymentOption?.image

triaged

Most helpful comment

@Wajahat-Jawaid I just put up a PR that introduces a class CardBrand that should help with this. Assuming you have a PaymentMethod instance, paymentMethod, you can do the following:

val brandIcon = ContextCompat.getDrawable(
   context,
   CardBrand.fromCode(paymentMethod.card?.brand).icon
)

All 4 comments

I have the same issue. On iOS, we can easily get the card image but on Android it looks like the feature is missing. Hopefully an update will come soon!

@Wajahat-Jawaid I just put up a PR that introduces a class CardBrand that should help with this. Assuming you have a PaymentMethod instance, paymentMethod, you can do the following:

val brandIcon = ContextCompat.getDrawable(
   context,
   CardBrand.fromCode(paymentMethod.card?.brand).icon
)

This is now available in 12.8.2

Thanks @mshafrir-stripe for the resolution!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GuillaumeWrobel picture GuillaumeWrobel  路  8Comments

OleksandrGrument picture OleksandrGrument  路  10Comments

mckn picture mckn  路  9Comments

andrewmunn picture andrewmunn  路  4Comments

odedharth picture odedharth  路  10Comments