Home > Back-end >  How to delete cards with Stripe in node backend
How to delete cards with Stripe in node backend

Time:12-21

I am interacting with Stripe from a node application and using SetupIntent to allow a custoner to add a card for future payments. SetUpIntent creates a paymentMethod for the card. So one question is, is it intended that a new SetupIntent API call should be made to add each new card - (this is how I am doing it at the moment) or should new cards be added to the existing Intent?

The second issue is, how do you delete a payment method using the Stripe node module. I see that there is a card delete enfpoint in the Stripe API but there seems to be no method in the node module to reach it - has anyone done this?

Many thanks!

CodePudding user response:

You will want to create a new SetupIntent for each new card you collect.

To remove a PaymentMethod from a customer, you can call the stripe.paymentMethods.detach call[1].

[1]https://stripe.com/docs/api/payment_methods/detach

  • Related