#icstzel
1 messages · Page 1 of 1 (latest)
You may follow this guide to create a payment method first and determine card brand, then submit the payment later after checking the card brand: https://stripe.com/docs/payments/build-a-two-step-confirmation
Thanks for this, I've seen this before and noticed that its all on client-side.
We currently have a somewhat "disjointed" payment flow where we make an API call to our backend server to create an invoice, process it internally (create records, logging, etc.), finalise the invoice, and return it as the client secret for our frontend (client-side) to confirmCardPayment for the given payment_intent.
In that way, at the backend we don't really know the payment method until/since its done through the client-side confirmCardPayment .
Hence, that's why we are wondering if it would be possible to do that check at the stripe product level without really reworking the entire payment flow
Are you using Card Element or Payment Element?
Payment Element~~ I believe~~
confirmCardPayment can only be used with Card Element or Payment Request Button. If Card Element is used, you can listen to change event to detect the card brand that the customer input and only allow customer to complete payment if the card brand check passes: https://stripe.com/docs/js/element/events?type=cardElement
If Payment Element is used, the create payment method first guide can still be applied. The steps will be:
- Create the invoice and return client secret to the frontend
- Create the payment method at Step 4 of the guide and check the card brand
- Only when the card brand is the allowed one, then update it to the payment intent
oh thanks for this! let me check in with our fe devs (sorry! backend guy here)
follow up question - in addtion to card brand, would it be possible to know the issuer?
i.e. the bank
Stripe doesn't return issuer in the Payment Method of the response. I'd recommend checking with Support https://support.stripe.com/contact if it's possible to get issuer returned
thanks very much for your help river!
No problem! Happy to help 😄