#morey-payment-method

1 messages · Page 1 of 1 (latest)

small hare
#

This is not about the testing card used, it is more about how payment_method behave in Stripe API.

All the payment_method are single use in nature; once it is used for payment, it could no longer to used again and its status will go to consumed state.

To reuse the payment_method, it needs to be attached to the customer. And to create payment, you will need to pass both the customer id with the payment_method ID.
Once the payment_method is detached from the customer, it will enter the consume status and could not be used anymore.

#

you will need to create a new payment_method again

rough imp
#

On front-end I have:

      payment_method: {
        card: cardElement,
        billing_details: {
          name: cardHolderName,
          address: {
            line1: cardHolderAddress1,
            line2: cardHolderAddress2,
            country: cardHolderCountry,
            city: cardHolderCity,
            postal_code: cardPostalCode,
            state: cardHolderState,
          },
        },```
That will also trigger my backend

```stripe.paymentMethods.attach(
        paymentMethodId,
        {
          customer: customer.data().customer_id,
        }
      );```
#

It Should attach?

small hare
#

does your setup_intent has a customer?

#

setupIntent will auto-attach payment_method to customer if you provide one

rough imp
#

Hmm it auto attaches? Let me check.

#

I guess the intent didn't make it

#

I guess let me read through the docs in abit more detail. seems something failed on my end while setting things up 😄