#gunwant_PaymentMethod

1 messages ยท Page 1 of 1 (latest)

delicate temple
#

This is expected because the PaymentMethod is already been used once.

#

You should attach the PaymentMethod to a customer before using it for payment,

unreal nest
#

Is there any way set this payment method for customer?

delicate temple
unreal nest
#

At that time I don't have a payment method.
I have got a payment method after confirmPayment.

#

My working flow.

  1. create customer
  2. Create invoice items
  3. Create an invoice
  4. finalize the invoice
    when the invoice finalize I have used payment_intent.client_secret for initializing the stripe payment element and paying it using confirmPayment.
    After successful payment, I have set the payment method for the customer.
delicate temple
#

OK. I'll suggest to change your flow a bit

  1. Create a customer
  2. Use SetupIntent API to collect a PaymentMethod for this customer
  3. Set the collected PaymentMethod to customer's invoice_settings.default_payment_method
  4. Create invoice items
  5. Create the invoice with customer and set auto_advance to true
  6. Finalize the invoice -> the invoice will be paid with the default Payment method.
unreal nest
#

Okay.

#

I'll check it.

delicate temple
#

There's another flow that you can consider

  1. create customer
  2. Create invoice items
  3. Create an invoice
  4. finalize the invoice
  5. Set the invoice's PaymentIntent's setup_future_usage to off_session
  6. Proceed with your current implementation and call stripe.confirmPayment at frontend
  7. The paymentmethod will be automatically attached to the customer
unreal nest
#

Please open this thread.

unreal nest
unreal nest
#

Payment method attached of the customer.

#

But it doesn't set as the default payment method

ornate galleon
#

๐Ÿ‘‹ Taking over from Jack

unreal nest
#

Hello

#

Please check it about message.

ornate galleon
unreal nest
#

OKay.
I have tried it working now.

#

Thank you so much.

ornate galleon
#

Awesome! Great to hear that it works for you ๐Ÿ™‚

unreal nest
#

Thanks again.
Nice to talk with you.