#redpanda-methods
1 messages · Page 1 of 1 (latest)
No problem. Let's say I add multiple payment methods for a customer e.g card and sepa_debit and wanted to have a full overview of all added payment methods in my billing settings. I am looking at https://stripe.com/docs/api/payment_methods/list right now and it seems it only allows querying a customer's payment method per-type, so I would need to end up making multiple requests to achieve what I want?
ah I see, got it
yes you'd have to make multiple requests
the design here when we built this as far as I know was more that we think you'd want to ask the customer "do you want to pay by card or SEPA?" (based on your knowledge of the methods you accept), and then when they pick one, you'd list their saved methods of that type.
but it can be awkward yes
I see. I've also had issues figuring out how to actually determine the fingerprint of a card prior to adding it via setup intents. Not sure if it's worth going through all that complexity if achieving such an overview would cause a ton of requests in the first place.
I assume it would be better to just allow updating a default payment method for the subscription and only display the existing default payment method. Then I don't need to go through worrying about duplication at all
I've also had issues figuring out how to actually determine the fingerprint of a card prior to adding it via setup intents
you have to call createPaymentMethod on the frontend, send thepm_xxxID to the backend, retrieve it with an API call there, and then read it from the response there on the backend
what you say is another option yep
Does this way also handle secure auth verification?
as in 3D Secure?
the SetupIntent will yes
the idea is , usually you call https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-with_element (confirmCardSetup with an Element), which creates a PaymentMethod and immediately confirms the SetupIntent with it and runs 3D Secure if required and attaches the PaymentMethod to the customer
but if you want to look at the PaymentMethod before that happens you need to split the flow(and we don't document this other way, but it does completely work)
i.e. instead, you call https://stripe.com/docs/js/payment_methods/create_payment_method to get a PaymentMethod from the Element, then you can send that ID to your backend server to check the fingerprint as mentioned above, then to proceed with saving the card, go back and call https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-existing (confirmCardSetup with a PaymentMethod ID) , instead, which confirms the SetupIntent with it and runs 3D Secure if required and attaches the PaymentMethod to the customer
Oh but handling duplication would mean that I
- Create a payment method
- Query for all cards on the customer
- Check for fingerprint duplication
- Remove the created payment method again if it's a duplicate
- Respond based on duplicate / non-duplicate card
And then of course if that succeeds confirming the payment with the payment method id
Remove the created payment method again if it's a duplicate
well no, I would just go back to the frontend and tell the user "You've already added that card!" or something, and that's it
Yeah but in theory you would still have that payment method added to the customer if you called createPaymentMethod, or not?
no you wouldn't
it's confirming the SetupIntent that attaches the PaymentMethod to the customer
just creating it does nothing beyond 'tokenize' the card information into an API object
Oooooh I see
What about payment methods that are not cards?
Would it be hash comparison?
should be mostly the same, they have fingerprints too https://stripe.com/docs/api/payment_methods/object#payment_method_object-sepa_debit-fingerprint for example
Some don't seem to have one or it's not documented https://stripe.com/docs/api/payment_methods/object#payment_method_object-giropay
Thanks again! I'll check back on that one if it becomes relevant
well you can't save a Giropay payment method to a customer
it's a one time thing, most of those redirect payment methods are, they don't really have state or anything you'd charge directly afterwards, since every payment attempt means creating a new PaymentMethod and handling a redirect for the customer to authenticate
ones that can be saved/re-used generally convert into bank details that you use with SEPA(which has fingerprints) instead(like iDEAL https://stripe.com/docs/payments/ideal/set-up-payment)