I am working on a application developed on Laravel/Vue having subscription payments on stripe, Currently I require users from stripe/Database whose subscriptions will expires today so that i set their status as expired in database, how can i get those users from Databases using Laravel/Cashier?
Asked
Active
Viewed 759 times
1 Answers
1
Cashier can't really do everything for everyone. There are two ways to go around this:
- Use fixed subscription renewal dates (recommended) that way everyone expires at the same time. Calculating will be a matter of checking no of days till the fixed day in month.
- Create a field in your subscription model like
subscription_expires_at
same way you havetrial_ends_at
. Define a webhook controller to set/update the expiry once a subscription has been created/updated. This way you can query the model normally withwhere('subscrition_expires_at', '>', now())
. The specific events you want to hook arecustomer.subscription.created
andcustomer.subscription.updated

Chibueze Opata
- 9,856
- 7
- 42
- 65