#sushbhat
1 messages · Page 1 of 1 (latest)
hi there,
AFAIK, you can't do that using Stripe APIs, but you can do something in your frontend using Stripe Card Element.
You can check this quick demo for that:
https://jsfiddle.net/nwyf587t/
I am using payment element on front end injected by stripe.js. (ngx-stripe)
anyidea how to achieve it on that?
Using Payment Elements no,
either you switch using Card Element/Card Number Element, or when you create a PaymentMethod, Stripe returns the brand and a list of networks the card can run on. So you can do the check on those values later.
https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-brand
https://stripe.com/docs/api/payment_methods/object#payment_method_object-card-networks-availablehttps://stripe.com/docs/api/payment_methods/object#payment_method_object-card-networks-available
More details can be found here,
https://stripe.com/docs/card-brand-choice#identify-the-available-card-networks
is it configurable at account level
No, this is something you do it at runtime in your integration, when the customer enter his card details.
ngx stripe has StripePaymentElementChangeEvent, can we use that to do runtime check
its basically inside StripePaymentElementOptions
I think no, because that event is related to Elements and not to Cards, it is mapping this JS event:
https://stripe.com/docs/js/element/events/on_change?type=paymentElement
You should use Card Element and monitor the corresponding event in ngx of this one:
https://stripe.com/docs/js/element/events/on_change?type=cardElement#element_on_change-handler-brand
ok and what is this 2nd approach you mentioned? 'when you create a PaymentMethod'
Because i don't think we are explicitly doing this, we first build a paymentIntent and then confirm pay with client secret
For 2nd approach, you need to create the PaymentMethod using the stripe.createPaymentMethod method in StripeJs
https://stripe.com/docs/js/payment_methods/create_payment_method
You check the card network, then you confirm the payment using the stripe.confirmPayment with the client secret:
https://stripe.com/docs/js/payment_intents/confirm_card_payment
But same here you need to use Card Element and not Element
ok