#deputycheese
1 messages ยท Page 1 of 1 (latest)
Let me explain
sure
So basically the user books a monthly subscription on our website. He can change the subscription status every time he wants during that month (= renew or end at the current cycle).
But if an off session payment then fails after a month we want to automatically cancel his subscription on our side. That's why I am listening to those events.
He then always has the possibility to book a new subscription on our website, but we dont want to deal with the renewal if a payment fails.
You still there?
no problem
Another question would be: if a renewal payment (off session) cannot be made because the credit card is stolen or because the user has to confirm it via 3d secure (we also want it to be cancelled in that case), is it enough to listen to invoice.finalization_failed, invoice.payment_failed and invoice.payment_action_required to cancel the subscription?
I'm with you now
will read through your messages and reply asap
why not leverage the settings in the dashboard https://dashboard.stripe.com/settings/billing/automatic#:~:text=Manage failed payments to cancel the subscription
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
then you only need to listen to customer.subscription.deleted to stop the subscription from your side
What exactly do you mean by that?
basically instead of canceling the subscription yourself
Ah you mean to remove the payment retries?
you can let Stripe automatically cancel the subscription after the payment fails
you can keep as many retries as you want and configure when to retry as well
But I dont want the user to go to stripe
they won't
Thats why I wanted to cancel the subscription as soon as the payment fails
you decide what the flow is
How would they confirm 3ds in a renewal case?
are you in India?
No, Germany
Is it correct that in this case if the payment fails I get the customer.subscription.deleted event and I can ignore everything else?
(I removed the retries)
ok why do they need to do 3DS for each invoice then?
yes
No they wont, but your colleague told me that 3ds can happen during off session renewals too and in that case I want the subscription to fail so he can book a new one on our website
He said 3ds can occur also for those automatic renewals
And then we would like the customer to just book a new subscription where he pays again on our website
ok
(and confirms 3ds during checkout if it happens there, on session)
but you know that you can do another workflow in that case
which one?
where you just take the PI of the invoice and send the customer an email with a link to your website where they only need to authenticate 3DS
Yes but we dont want that at the moment (because we dont know if and when he will confirm/pay). we would rather have the subscription cancelled until he really pays
up to you
Okay thanks but that helped already
Is there a way to differentiate between a subscription that has normally ended (because the user paused it) and a subscription that has ended due to a payment error? I think in both cases the event customer.subscription.deleted gets called?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
let me know if you need any more help
Thats it for now, thanks!
Last question: the subscription.deleted event will also be called when a subscription is paused?
for example: the user has booked 1 months, paused it and then after 30 days I get the event too so I can disable his subscription?
Okay that will be called after 30 days, not when he pauses it, right?
no
it will be called when you "pause" the subscription for the customer
He can pause it anytime (= change the status if the subscription should be renewed after a month). but what event would I listen to to disable his subscription on our side after the 30 days (if its paused then)?
you don't have another event that happens 30 days after a susbcription is paused
you need to create a cron job that looks at the paused subscriptions for more than 30 days
No at the day the subscription ends I mean
and cancel them
Example: user books 1 month. after 5 days he changes the status to pause (so not to be renewed after a month). he then uses his subscription for 25 more days. and then after 30 days his subscription ends -> here I wont get a notification about it?
that's not really how pausing works with Stripe
I thought that if he pauses the subscription he wont be charged after the current cycle ends?
Ah sorry
My fault
We dont pause
We just use cancel_at_period_end
And use subscriptions->update with that
Sorry for the confusion
customer.subscription.deleted would fire at the end of the period
Sure!
If the customer paid at 12am on January 1st (monthly). Will we get notified before 12am on February 1st if the payment fails/subscription ended?
We'd attempt payment ~1 hour after the billing_period_end timestamp
How do we handle the 1 hour gap in that case?
Because officially he hasnt paid and it ended
Which gap?
And 1hour later the payment attempt is tried and we only then get the notification
~1 hour after the billing_period_end
Is this in a scenario where cancel_at_period_end: true?
You can't really. Only thing you can try is to manually finalize yourself on receipt on invoice.created. That will ~immediately attempt payment
Mmmh okay