Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sairum's avatar

Stripe subscription help

If subscription renewal is denied from stripe for any reason like insufficient fund or card goes expired etc then our system make that person to trial version again i am doing via stripe invoice.payment_failed event if this event triggered from stripe then i am turning that user account to trial package but i have an issue in this if that person is try to upgrade the plan to other and in this case payment failed for xyz reason then stripe also trigger the same event payment invoice.payment_failed in which case i am turning that user to trial also there is no significant difference in both case i have to implement this if user is upgrading the package and that failed then that user back to whatever package they have previously how can i handle this scenario?

0 likes
2 replies
bobbybouwmann's avatar

Maybe you can set some session that tells you that the user is working on upgrading the plan. If that session is set and the callback comes in you don't change the plan.

kensmithzzz's avatar

Session probably won't work, because I don't think the webhook would see it. He'll probably need to store something in the user table itself.

Please or to participate in this conversation.