How to Manage Credit Resets for Yearly Subscriptions?

0
0
Asked By TechieGal123 On

I'm facing a challenge with my SaaS app regarding credit resets for yearly subscriptions using Stripe. Typically, when a user on a monthly plan pays their invoice, I reset their credits — for example, they get 500 AI task executions per month, so I reset it to 500 with each `invoice.paid` event.

However, for yearly subscribers, Stripe only sends that payment event once a year, which complicates things. I could give users a lump sum of 6000 credits upfront for the year, but I'm concerned that a user might use more than 500 credits in a single month, which could lead to abuse.

I'm considering using a cron job to reset credits every month for those on the yearly plan. Is there a better or more efficient way to manage this? Also, if anyone knows of good open-source SaaS projects with similar payment setups, I'd love to check out their code. I've found one project, cal[.]com, but they don't have yearly plans.

3 Answers

Answered By CodeWizard99 On

It might be beneficial to keep track of credits paid, credits issued, and credits consumed separately. While cron jobs are a valid approach, they do carry a risk if something goes wrong with them. As long as you maintain accurate records of all relevant data, and ensure your cron jobs have a solid retry mechanism, you should be fine.

Answered By YearlyGuru On

I've managed both yearly and monthly credits using cron jobs for the annual ones while utilizing Stripe's webhook events for monthly subscriptions. I just reset credits for yearly users each month to keep it balanced.

Answered By DevEnthusiast88 On

I’m curious about this too! It’s definitely a tricky situation.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.