#Eranga-webhook
1 messages ยท Page 1 of 1 (latest)
@potent ginkgo Sorry, it seems to be working.
Glad to hear!
Anyway I have another question
Now I see that an invoice is scheduled to be charged in one hour
I mean finalized in one hour
Can I finalize it now manually using the CLI? So that I can test this quickly without waiting an hour?
Yeah you have the Finalize API to finalize it immediately
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
hmm using CLI
let me see
I think this is the syntax
stripe invoices finalize_invoice <in_xxx>
Thank you @potent ginkgo for your time ๐
I finalized the invoice
And the customer has no payment method
Ideally, I would expect the payment failure webhook to be triggered
Instead, I am seeing this in Stripe invoice
Could you be able to explain to me if I miss something in the process?
Yes, so the Invoice was meant to finalized and collect payment in 1 hour later, however if you call the Finalize API, it will finalize immediately, but not trying to collect. You would need to call Pay API to collect payment separatedly
Or it will still wait until that 1 hour mark
stripe invoices pay in_xxx
Ah haaa... So finalizing means that it is uneditable. Not that it will try to attempt the payment
yeah that's separated steps
Thank you ๐ป
I tried this and it works perfectly.
However, in the dashboard, I see the following details for the invoice under subscription
According to subscription lifecycle (https://stripe.com/docs/billing/subscriptions/overview#subscription-lifecycle) I was hoping that my subscription would be in incomplete status
However, I can see that it is in past_due
I'm guessing the reason is that the subscription has two invoices. It looks like the when the subscription starts, there is an invoice for the trial period which is 0$. Could you explain what am I doing wrong here?
Hi, yes it normally has an $0 invoice for trial period
It looks like the "real" Invoice is still waiting for payment
Did you call Pay API on the correct Invoice Id?
Yeah, I used the Stripe-CLI
But I got an error
Let me show you
Payment attempt failed
I have a webhook to listen to payment failure as well. So I received the failure event with attempt_count = 1
Ah yeah so it's expected, isn't it? Because the customer doesn't have a Payment Method
Yes, correct.
But according to the subscription lifecycle, I was hoping the subscription would have transitioned to incomplete
Cool, thank you ๐
Yes so it will wait for 7 days to retry. How about removing those 2 rules? I think the Subscription will become incomplete as you want
If I remove that rule, it means I will be going for smart retries, right?
You can just leave the check box as the second options, but click on the x button
Ah haaa... Okay, let me try
After saving this, I would have to redo the things again like creating the subscription, finalize the invoice, and then pay?
Or will it be updated to the existing one?
I think you will need to redo ๐ค
let's try and see how it goes with existing one
Okay, no problem. Yeah, I will redo if it doesn't work
Then the subscription got canceled after the failed payment
As you can see, since there is no valid payment source, and there is no retry scheduled, ideally the subscription should be canceled, right?
I'm wondering whether I misunderstood the subscription lifecycle document ๐
I think the subscription should be on past_due based on this diagram
Since the first invoice was for the trial, from the second invoice onwards, the subscription should be on past_due if the latest invoice payment is failed
So my thought earlier is wrong
"the subscription should go to
incompletestatus after the payment failure after the trial"
Let's clarify a few thing
What's the Subscription status for now? and what is the Invoice status for now?
Can you give me the Subscription Id?
Subscription status: canceled, Invoice status: failed
Subcription Id: sub_1JmssXC8JGuaUdU6bEDxUbZr
Do you want my account ID?
No, just Sub Id is okay
So the Subscription was active, then we changed the retry rules, then call Finalize and Pay API again, and now it transited from active to cancel
Actually, I created the subscription from the scratch
After I changed the retry rules
Subscription was on trialing -> active -> canceled
Earlier I thought it should be on incomplete but now when I read again, I think it should be past_due
But I understand why it got canceled. It is because there is no retries for the failed payment, right?
And I have setup the subscriptions to be canceled if all the retries are failed
yes (where is that setup the subscription to be canceled if all the retried are failed , out of curiousity?)
ahh
yeah so it's expected to transited to canceled
So to summarize, if I start a subscription with a trial, if the first payment after the trial fails, it will be on past_due (assuming we have more than one retries enabled)
If the subscription does not have a trial, then it should be on incomplete if the first payment fails
Do you think this is correct? ๐ผ
"Yes" for the first sentence. "It depends" for the second sentence due to this
by default, you create a Subscription with payment_behavior = default_incomplete
Got it. I didn't change the default, so in that scenario, it will be incomplete and the customer have about a day to enter the proper card information
yeah
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
More in here
Use allow_incomplete to create subscriptions with status=incomplete if the first invoice cannot be paid. Creating subscriptions with this status allows you to manage scenarios where additional user actions are needed to pay a subscriptionโs invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the SCA Migration Guide for Billing to learn more. This is the default behavior.
Great ๐. I think I solved all my questions. Thank you for all your help @potent ginkgo.