#idhruv-payment-method

1 messages ยท Page 1 of 1 (latest)

weak plover
#

๐Ÿ‘‹ Happy to help

#

Looking into it now

winter niche
#

thanks river

#

i am calling stripe.paymentMethods.detach while removing the already saved cards from our ui

#

after using the same card again to pay it throws this error mentioned above

weak plover
#

So that no additional attach request is required

winter niche
#

okay but now how can i reuse this card
? it is the test card

#

and while testing i had some failed attempts previously where i paid without attaching the customer first

#

this is where it was attached and then i removed it

weak plover
#

Based on cus_KnJ92zEgAonAPr [0], these two cards are already attached to the customer.

In order to use saved card, the steps will be:

  1. Get the payment methods of the customer: https://stripe.com/docs/api/payment_methods/customer_list
  2. Let the customer choose the payment method and pass its Payment Method ID (pm_xxx) in the Payment Intent Create request: https://stripe.com/docs/payments/save-during-payment?platform=web#charge-saved-payment-method

[0] https://dashboard.stripe.com/test/customers/cus_KnJ92zEgAonAPr

winter niche
#

okay this is already happening

#

but my question is

#

i am trying to use a different card here because of which the error is getting triggered

#

it is this card that ends with 3220 that triggers the error, how i can i reuse it

#

Also another question. this is our current workflow:

  1. create payment intent (on backend nodejs)
  2. confirm card payment (on ui)
  3. create customer (on backend)
    3.1. attach payment method
    to this customer
  4. acknowledge payment done in our db on final response

is this flow correct?

#

We cannot create customer without payment_method which we get from paymentIntent, so we are forced to create a paymentIntent with customer value pointing to null and then we try to attach payment method generated to the customer. Is this correct as well?

weak plover
#

In order to save card onto the customer, the payment method must not be used for any payment. In your current workflow, payment method has been used in Step 1 and 2 before Step 3 that causing payment method attachment to the customer at Step 3 to fail.

#

The correct way will be:

  1. Create a customer
  2. Create a payment intent and set customer, setup_future_usage: 'off_session'

Payment methods will be attached to the customer with above steps. For more details, you can refer to the doc here: https://stripe.com/docs/payments/save-during-payment

winter niche
#

ok

#

let me go through n revert

#

thanks

weak plover
#

No problem! Happy to help ๐Ÿ™‚