#Oigen
1 messages ยท Page 1 of 1 (latest)
Hi ๐
I am pretty sure it will go straight to either incomplete or past_due. However, you can test this out yourself to verify this flow.
You would create the Customer and sign up for the Subscription with a valid test Card but then update the card via the API to the one that fails with Insufficient funds.
Yeah, I've tried that with time clock.
But at the end of trial subscription moved to active status and created draft invoice, when I moved time on one hour after, invoice was finalized and and subscription moved to past_due.
I also was thinking that it should be moved directly to past_due, maybe it's a time clock bug?
Oh wait. no that makes sense. The invoice it cut so that you can use it to collect payment and a new Payment Method
So that actually makes sense
Ah, ok ok. I have a business requirement to cancel subscription if payment fails when trial ends. And I was thinking to manually cancel it via API call inside webhook handler on the backend if previous status was trialing and currenct past_due. But looks like it's impossible because previous status will be active
Maybe you have an idea how it can be accomplished?
I would isten to invoice.payment_failedevent https://stripe.com/docs/api/events/types?lang=dotnet#event_types-invoice.payment_failed, check if this was the first invoice by checking the billing_reason https://stripe.com/docs/api/events/types?lang=dotnet#event_types-invoice.payment_failed and then cancelling if it is the first invoice
Correct if I'm wrong, but Stripe generates an invoice with amount 0.0$ during subscription creation in trial mode
So it cann't be the first invoice ๐ค
Ah yes, the trial period does goof that up.
Wait a sec
Have you tested this behavior using the trial_settings.end_behavior.missing_payment_method? If you set it to cancel will that cancel the subscription or leave it in past_due? https://stripe.com/docs/api/subscriptions/object#subscription_object-trial_settings-end_behavior-missing_payment_method
let me check, but I was thinking it's a bit another thing. It's when customer didn't provide paymenth_method at all
In my case he provided payment_method, but there are no enough available funds
That is true
Just checked, in that case subscription was moved to canceled directly from trial
but it's a different thing ๐
Okay but does that take care of the business requirement?
Yes, I want to achieve the same behavior if a valid payment method was provided, but there was not enough money
Hi @mossy moat I'm taking over, give me a sec to catch up.
So basically you want to cancel the subscription if the payment of the first invoice is failed, am I right?
https://stripe.com/docs/billing/subscriptions/overview#settings I'd recommend you to configure the subscription settings to cancel subscription if all retries fail.
Yeah, I use this setting for unpaid subscriptions, after some retries we cancel it
In current case I have a business requirement to cancel the subscription if the payment fails when the trial ends. Not sure it's the first invoice, because when subscription starts in trial mode Stripe generates invoice with 0$ amount, so basically it's a second invoice
In that case it's not a regular cancelation with retries. I want to cancel subscription immediately, so I need to know somehow, that subscription was in trialing status and payment failed, so I can manually cancel it