laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.37k stars 667 forks source link

Improvement: End the generic trial instead of clearing it when a subscription is started #1654

Closed AntonioDiPassio-AppSys closed 6 months ago

AntonioDiPassio-AppSys commented 6 months ago

Since v15.1.0 the generic trial of a user is cleared when he starts a subscription.

This was done because: "As soon as a customer starts their subscription there's no need for the trial to continue since they have started paying."

Imho ending the trial instead of clearing it would be more accurate, and it achieves the same goal.

This can be done by changing lines 102-105 in src\Http\Controllers\WebhookController.php

// Terminate the billable's generic trial if it exists...
if (! is_null($user->trial_ends_at)) {
    $user->update(['trial_ends_at' => null]);
}

to

// End the billable's generic trial if it exists...
if ($user->onGenericTrial()) {
    $user->update(['trial_ends_at' => now()]);
}
driesvints commented 6 months ago

Ok, I think this one is reasonable. Feel free to send that in as a PR 👍