#icurrytheteam

1 messages ยท Page 1 of 1 (latest)

exotic walrusBOT
radiant cosmos
#

Hi

I'd like to give users the ability to update one of their saved payment methods
What do you want to update exactly ?

bright python
#

A user can save a card for future payments (subscriptions). Say, I would like a user to update one of the cards they saved.

#

I'm building a site that has a wallet in their settings and users can save different cards (payment methods).

#

As for what details, a user should be able to change the card details, exp, name, cvc, and etc.

radiant cosmos
loud hatch
bright python
#

Could I simulate this functionality by deleting and re-adding the card?

#

Exactly like as if I was adding a new payment method that is.

loud hatch
#

Correct, that would be the approach you want to use.

bright python
#

May I ask, how would I know which payment method to delete on the backend?

#

That seems a little vague, sorry let me better phrase that.

#

So when a user clicks on a payment method to "update", I must go through the process of passing a client secret to the frontend so they can enter in the new details. However, before I can do that, the backend has to know which payment method to "update" or delete. Does this make sense?

loud hatch
#

It does, but if you're listing the Payment Methods to your customer then it seems likely you've already retrieved a list of their Payment Methods and have the corresponding IDs for each one.

bright python
#

Correct, I can list the payment id's for each customer.

#

I just dont know which one to remove.

#

So if I have 3 payment methods saved for example, how will I know which of the 3 to remove.

#

I'm guessing that a payment method can be passed to me in the request body when a user clicks on it and I can map it to the right payment id, then proceed with deleting it? Could this work?

loud hatch
#

That sounds like a reasonable approach, but as it sounds like you're talking about how to have your frontend communicate with your backend the decision is largely yours to make on how you want to implement that. Your backend will need to pass enough information about the Payment Methods to your frontend so they can be displayed, when you do you can pass an ID that your frontend sends back to indicate which should be deleted.

bright python
#

Exactly this!

#

I can sleep now. thanks

loud hatch
#

Happy to help!