#Kamesh
1 messages · Page 1 of 1 (latest)
hello! if you want to get the card type on the client side, you can look into using the card element : https://stripe.com/docs/payments/accept-card-payments?platform=web&ui=elements
Thanks. Can you please point out how I can access the card type using card element?
gimme a sec to find the relevant docs
Thanks
is this only applicable to US and Canadian cards?
it's applicable to cards from any issuing country
Thanks. Sorry if I missed anything obvious, but this doc is explaining capturing card information and process later. Where can I find how to get the card type before i process the payment?
when you create a PaymentMethod, you will be able to get the card type
do you mean, that once the payment method is created, we can get payment intent details which will contain the payment card type information?
when the PaymentMethod is created, you can get the PaymentMethod details which will contain the card type information : https://stripe.com/docs/api/payment_methods/object#payment_method_object-card
Thanks. Is there any reason why we cannot use payment element to capture the card and charge later?
sure, you can use the payment element to capture the card and charge later, but you can't do it purely on the client side.
https://stripe.com/docs/payments/save-and-reuse - you'll need to create a SetupIntent on your backend first
will this flow work?
- UI calls backend to create payment intent
- backend calls stripe to create payment intent and pass the client secret to UI
- UI captures the credit card using payment element and call stripe to create payment menthod
*UI then calls stripe to get payment method to get card type info - UI calcualtes additional surcharge based on card type and updates the payment intent with additional amount
*UI then calls stripe to make the payment.
- UI calls backend to create SetupIntent
- backend calls stripe to create SetupIntent and pass the client secret to UI
- UI captures the credit card using payment element and PaymentMethod is created
- UI calculates additional surcharge based on card type and creates the PaymentIntent to charge off_session