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

ralphmrivera's avatar

Does Spark track a trial period internally or via Stripe?

Does Spark track a trial period internally or via Stripe? I see a trial field in the user table, but I'm not sure if Spark is tracking that or if that is derived from the Trial Date of the Stripe plan.

0 likes
4 replies
willbrowning's avatar

I believe it is internally as the users/teams tables use the trail_ends_at column.

When a user or team subscribes then this column is set to null.

If you check the middleware for user/team subscribed you can see the logic used.

Changing the trail ends at date to a date in the past will make these middleware return false.

1 like
EventFellows's avatar

via Stripe!

You can check that if you create a user with a stripe test account. Check stripe and you will find it in stripe.

Don't be confused: it is also mirrored in the spark database but the stripe data takes precedence (e.g. if you manually overwrite your local database) - the trial always end when it ends on spark (there is a webhook fired)

1 like
jekinney's avatar

@EventFellows definitely does not contact stripe to check.

https://github.com/laravel/cashier/blob/7.0/src/Billable.php

@ralphmrivera stripe uses cashier. So it doesn't add anything on top of that that's different. Cashier has limited calls. It expects you to sync plans etc. only calls to stripe is sign up, cancel and change plans.

Generally one would listen for web hooks from stripe if any changes are made. Same as handling failed reacurring charge or you use stripes dash board to modify something there, you can listen for plans changes and additions coupons etc. . If you wanted to manually update users trial in your app you'll have to code a method to do that. Their API docs are actually really good. Unless I only need subscriptions I generally just use stripes php sdk and create a class to wrap their methods into a more laravel type syntax and keep it out of the controller.

1 like
EventFellows's avatar

@jekinney Not sure what you mean with 'does not contact stripe to check'

But stripe does send the customer.subscription.updated webhook. There is also a customer.subscription.trial_will_end webhook 3 days before that.

And their example says:

Occurs whenever a subscription changes. Examples would include switching from one plan to another, or switching status from trial to active.

You can find it here: https://stripe.com/docs/api#event_types-customer.subscription.updated

Please or to participate in this conversation.