#commento
1 messages · Page 1 of 1 (latest)
Hi there!
Why do you use CreatePaymentMethod? You should only use SetupIntent whih will create and attach the Payment Method for you.
ok I thought that adding a payment method as a parameter to a setupIntent will reuse the same payment method, not create a new one
Also, the payment method created is not set as a default, is it an issue for invoicing?
If you want to save a customer's payment method to use later, directly create a SetupIntent, as mentionned here: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
Also, the payment method created is not set as a default, is it an issue for invoicing?
If you want the payment method to be automatically used for next invoices, then yes it needs to be set as default. You can do so with an extra API call: https://stripe.com/docs/api/customers/object?lang=php#customer_object-invoice_settings-default_payment_method
ok but if I have only to use it for future off-session invoices, does it make sense to do a setupIntent?
If you want the user to enter their payment details every time there's a new invoice: don't use SetupIntent
If you want the invoice to be paid automatically: use a SetupIntent and set the payment method as the default
ok thanks
sorry last question: how do I retrieve the payment method id of the payment method created with the setup intent? it is not present in the response
for example: seti_1NSwl2Fkdr5S24UDShDbdXNh
it has payment method passed as a parameter and it is also in the response: pm_1NSwl1Fkdr5S24UD0uZ87x0o
but the created payment method is: pm_1NSwl4Fkdr5S24UDr7Srk3n7
do you have an answer about that?
- In seti_1NSwl2Fkdr5S24UDShDbdXNh you are trying to attach pm_1NSwl1Fkdr5S24UD0uZ87x0o to cus_OFReJ1OAwjXG8G
- But if I look at pm_1NSwl1Fkdr5S24UD0uZ87x0o, I see it was created by a SetupIntent: https://dashboard.stripe.com/test/logs/req_Q5hiYG7l9LXj5X
So you are making two SetupIntents in a row? That doesn't make sense.
Use a single SetupIntent to create and attach the payment method.
no that one (pm_1NSwl1Fkdr5S24UD0uZ87x0o) was created with a stripe.CreatePaymentMethod
I am super sure about that
I thought it was possible to use an existing payment_method to do a setupIntent and I had a confirmation because it was returning the same payment_method but I guess this is not possible
sorry to bother you a lot
thanks for the support
No worries, let me double check.
You are correct, it was created by CreatePaymentMethod here: https://dashboard.stripe.com/test/logs/req_50cYcP3YH9UGGc
But then my question is the same: why are you doing this? You could directly create and attach the payment method using just one SetupIntent.
yes you are right I will change the flow
Here's our recommended flow for SetupIntents: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
this is really the last question: if I have a customer with an already registered payment method that is a default (to be precise it was attached using the sources api) should I do a setupIntent or just skip that part for an already registered customer?
if the payment method is already authenticated you can use it and if you had some error during the payment, you may need to use SetupIntent in order to re-collect the PaymentMehtod.