3

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?

1 Answers1

1

Cashier can't really do everything for everyone. There are two ways to go around this:

  1. 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.
  2. Create a field in your subscription model like subscription_expires_at same way you have trial_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 with where('subscrition_expires_at', '>', now()). The specific events you want to hook are customer.subscription.created and customer.subscription.updated
Chibueze Opata
  • 9,856
  • 7
  • 42
  • 65