#icurrytheteam
1 messages · Page 1 of 1 (latest)
So to give some background information, I have a website where users can subscribe to vendors for their content. In the subscription flow, it'll automatically use their default payment (should it exist) or they'll enter in some card/bank info.
Hi there, I don't quite understand the requirement, can you bring in a use case so that I can better understand you?
Yeah, sure.
So say for a example a customer wants to subscribe to a vendor. They click the subscribe button and enter their payment information. On the backend, I'm passing the clientSecret to the frontend so that I can do "confirmPayment". Thing is, there are instances where it takes some time load and if the user closes the page (or something like that, maybe power goes out), then the subscription invoice status will be left in pending. So I'm asking if Stripe handles instances like these or do I need to have a webhook or cron job that handles this. Does this make a little more sense or no?
then the subscription invoice status will be left in pending. -> Do you have example that I can take a look?
How would I show you? Would I recreate these actions?
So it's just a hypothesis, not a problem that you are currently solving, am I right?
I'll admit, this is going to sound rather strange but this is an issue that my associate/coworker is reporting and I'm not understanding.
OK, do you have the invoice ID or subscription ID?
I can get it for you, but I'll need a second. Is that ok?
Sure
Great, thanks.
Ok, so he's not answering at the moment but I believe that this is the invoice ID - in_1Mb8zFKwCfM7dUhHoho8W6uO
OK, so this invoice's status is open and it's not yet paid.
Yes
Im not sure if the default payment method was provided before the subscription was created, but if it was, then it shoudlve used that
If not, then it wouldve allowed the user to enter a payment method.
And it's auto_advance is set to false, which means Stripe won't automaticlly advance it.(https://stripe.com/docs/invoicing/integration/automatic-advancement-collection)
Auto_advance? May I have a second to read this?
Is this something that I must do while I call stripe.Subscription.create()? I can access the invoice from the subscription and modify it.
I'm seeing that this can be used for modifying the invoice directly.
Let's take a step back. What's the problem that you want to solve here?
So far I only see you create a subscription, and it's first invoice is not yet paid.
I want to create a subscription and pay its first invoice
OK, how do you intent to pay it?
By either using the customer's default payment method (should it exist), or by letting the user enter card/bank details
This particular customer doesn't have a invoice_setting.default_payment_method set yet. https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#collect-payment You can follow this doc to collect payment from customer for the 1st invoice
May I ask why that's the case even though I see, in the dashboard, a default payment method listed?
What's the ID of the customer that you are looking at?
cus_NLqMaaIIoOHuJI
When I create the subscription, I check the default_source and invoice_setting.default_payment_method fields.
I see, this customer has a default_source field set.
Yes, so when creating the subscription, shouldn't the default_source be the payment method used?
Let me take a look
Thanks for waiting.
Yeah, np
If you have already set the customer's default_source, and you wish to use this source to pay the invoices generated by subscription. You should set payment_behavior to allow_incomplete instead of default_incomplete
By setting payment_behavior to allow_incomplete, Stripe will automatically attempt the first invoice with available payment_method after subscription creation.
I have an if statement that checks the default_source and invoice_setting.default_payment_method fields. If both are empty, then I want the user to enter their card/bank info. I'm using default_incomplete to achieve this functionality. Are you saying that I should switch it to allow_incomplete instead?
Let me summarize
- If your customer has a default_source or invoice_setting.default_payment_method, set payment_behavior to allow_incomplete
- Otherewise, set payment_behavior to default_incomplete
Correct. What I'm trying to do is always use a customer's "default payment method" for a subscription. However, there are cases where they may not have one saved, so I want to let them enter payment info for the transaction to be completed.
Is what I'm doing making sense?
It looks good to me
Ok and I have a frontend setup using stripe elements.
I can use confirmPayment to complete the payment.
But when I inspect the status of the payment intent, say it's processing.
What happens if I close my browser while the status of the payment intent is still processing?
Do you have the PaymentIntent ID?
The status of this PI is requires_payment_method
so it acts as if the payment method was never captured?
Am i going to have to handle this using a webhook or cronjob?
No, I don't see this PI went to processing status at all.
https://stripe.com/docs/payments/intents This is the lifecycle of a PaymentIntent. In most of cases a card paymentIntent won't go into processing status. The processing is for paymentIntent that was paid with certain payment method which payment result can't be confirmed immediately (i.e., ACH)
Let me take a look a tthis
How long does it take for transactions to process if purchasing a subscription with a us bank account?
Since we are accepting bank payments, how would we handle a situation where bank transactions take multiple days?
https://stripe.com/docs/billing/subscriptions/ach-debit there's a dedicated doc for this. Go through it and let me know if you have questions
ok great