#redpanda-methods

1 messages · Page 1 of 1 (latest)

late adder
#

@regal dome not sure I understand, could you elaborate?

regal dome
#

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?

late adder
#

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

regal dome
#

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

late adder
#

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 the pm_xxx ID 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

regal dome
#

Does this way also handle secure auth verification?

late adder
#

as in 3D Secure?

#

the SetupIntent will yes

#

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

regal dome
#

Oh but handling duplication would mean that I

  1. Create a payment method
  2. Query for all cards on the customer
  3. Check for fingerprint duplication
  4. Remove the created payment method again if it's a duplicate
  5. Respond based on duplicate / non-duplicate card
#

And then of course if that succeeds confirming the payment with the payment method id

late adder
#

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

regal dome
#

Yeah but in theory you would still have that payment method added to the customer if you called createPaymentMethod, or not?

late adder
#

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

regal dome
#

Oooooh I see

#

What about payment methods that are not cards?

#

Would it be hash comparison?

late adder
regal dome
#

Thanks again! I'll check back on that one if it becomes relevant

late adder
#

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

regal dome
#

Oh I see, so those payment methods are not really suitable for subscriptions since you need to pay manually

#

I'll try to figure out things with wallets, cards and bank debits then