#storm-default-paymentmethod
1 messages · Page 1 of 1 (latest)
Hi 👋
Do you have an example Payment Intent I can review? The Payment Intent ID is all I need. They start with pi_.
pi_3MUvSbKi1arGZw8p0IC8GiKZ
Thanks, taking a look
Thanks so much
Okay this one is odd
Yeah... I had a feeling...
You clearly updated the Customer's default payment method here: https://dashboard.stripe.com/test/logs/req_IpVQ9qwfgCgs8c
Before the invoice was created here: https://dashboard.stripe.com/test/logs/req_vbNvJqP0RBk9ts
Yes. We set it up to set the default payment method when the payment intent for a subscription purchase succeeds via webhooks
Yes that's generally a reliable approach. Is this invoice the first for this subscription?
No. The subscription invoice is this one: pi_3MUvJmKi1arGZw8p0gnjxS0S
But then how is it that the Customer's payment methods were only updated ~10 minutes before the Invoice was created?
The subscription invoice succeeding is what we look for in the webhooks to set the default payment method. The new invoice that happened roughly 10 min later is a new charge that we were trying to do to test the default payment method
The two invoices are separate/unrelated
Oh okay
Yes, sorry for the confusion
Right so you configured the Subscription to automatically set the default PM for the customer on successful payment of the first invoice.
https://dashboard.stripe.com/test/logs/req_BmJG9sX74Tk3RL
Yes, correct
Okay but that should have done it by itself, without the webhook
Right... So the payment method was being stored to use for the subscription without an issue from what we could tell, but the payment method could not be used for any additional charges that were unrelated to the subscription. From what we could tell, we needed to store the payment method in another field of the customer object as the default payment method which is what we were trying to do with the webhooks
We are using the invoice_settings.default_payment_method field because we will be working with the Payment Method API in the near future
Or at least we are trying to use the invoice_settings.default_payment_method field
storm-default-paymentmethod
but the payment method could not be used for any additional charges that were unrelated to the subscription
@median isle what do you mean by that? Like what was the exact error you got?
The status of any new payment intents become "requires payment method"
Sure but that can mean many different things. Can you give me a concrete example?
Yes. So here: https://dashboard.stripe.com/test/logs/req_IpVQ9qwfgCgs8c we successfully stored the payment method as a default payment method for customer: cus_NFQARNgA6WxzDW. This is the invoice in question: https://dashboard.stripe.com/test/logs/req_vbNvJqP0RBk9ts. It is showing the invoice as incomplete with no default payment method as null
Okay, sorry I'm struggling a bit to follow your train of thoughts. So you aren't doing any one-time payment via the PaymentIntents API yourself. Instead you always use Subscriptions or Invoices?
the request you mentioned is simply an Invoice creation. That has no payment attempt, the invoice is not even finalized yet, so this is all expected
Understood. It is a rather confusing issue. Yes, that is what we are doing. Okay so for a customer to make a purchase for something unrelated to their subscription in real time, we would instead have to use payment intents?
No you don't have to, using Invoices is totally fine. But you have to understand the lifecycle of an Invoice first
Okay. I suppose that's the issue then. Okay so based on this invoice lifecycle, is it normal for the default payment to be null when an invoice is finalized? We have been able to finalize the invoice but payment is failing
yeah sorry you're mixing up many small things all together here. An Invoice can have a specific default payment method set up in the API. You can pass default_payment_method: 'pm_123' on creation if you want and in that case in the response it will have default_payment_method: 'pm_123' too. If you don't pass it, then it's null.
If it's null (most common case), it will attempt to use the Customer's global default payment method for Invoices as set up in invoice_settings[default_payment_method]
Oh okay. Understood
So once the invoice is in step 3 (status is open), how do we get the payment to go through? We set the option for charge_automatically but the invoice in question has remained open
1/ Create an Invoice
2/ Finalize an Invoice
3/ Wait for us to charge it async later. Or optionally call https://stripe.com/docs/api/invoices/pay
Ah okay. Thank you so much for your help. Following your advice, we were able to get it to work using the CLI. Thank you so much for all of your help. Both you @agile fulcrum and @mild isle, I truly appreciate it