Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Document trialEndsAt #6420

Merged
merged 3 commits into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions billing.md
Original file line number Diff line number Diff line change
Expand Up @@ -890,18 +890,24 @@ Cashier refers to this type of trial as a "generic trial", since it is not attac
// User is within their trial period...
}

You may also use the `onGenericTrial` method if you wish to know specifically that the user is within their "generic" trial period and has not created an actual subscription yet:

if ($user->onGenericTrial()) {
// User is within their "generic" trial period...
}

Once you are ready to create an actual subscription for the user, you may use the `newSubscription` method as usual:

$user = User::find(1);

$user->newSubscription('default', 'price_monthly')->create($paymentMethod);

To retrieve the user's trial ending date, you may use the `trialEndsAt` method. This method will return a Carbon date instance if a user is on a trial or `null` if they aren't. You may also pass an optional subscription name parameter if you would like to get the trial ending date for a specific subscription other than the default one:

if ($user->onTrial()) {
$trialEndsAt = $user->trialEndsAt('main');
}

You may also use the `onGenericTrial` method if you wish to know specifically that the user is within their "generic" trial period and has not created an actual subscription yet:

if ($user->onGenericTrial()) {
// User is within their "generic" trial period...
}

<a name="extending-trials"></a>
### Extending Trials

Expand Down
18 changes: 12 additions & 6 deletions cashier-paddle.md
Original file line number Diff line number Diff line change
Expand Up @@ -695,12 +695,6 @@ Cashier refers to this type of trial as a "generic trial", since it is not attac
// User is within their trial period...
}

You may also use the `onGenericTrial` method if you wish to know specifically that the user is within their "generic" trial period and has not created an actual subscription yet:

if ($user->onGenericTrial()) {
// User is within their "generic" trial period...
}

Once you are ready to create an actual subscription for the user, you may use the `newSubscription` method as usual:

$user = User::find(1);
Expand All @@ -709,6 +703,18 @@ Once you are ready to create an actual subscription for the user, you may use th
->returnTo(route('home'))
->create();

To retrieve the user's trial ending date, you may use the `trialEndsAt` method. This method will return a Carbon date instance if a user is on a trial or `null` if they aren't. You may also pass an optional subscription name parameter if you would like to get the trial ending date for a specific subscription other than the default one:

if ($user->onTrial()) {
$trialEndsAt = $user->trialEndsAt('main');
}

You may also use the `onGenericTrial` method if you wish to know specifically that the user is within their "generic" trial period and has not created an actual subscription yet:

if ($user->onGenericTrial()) {
// User is within their "generic" trial period...
}

> {note} There is no way to extend or modify a trial period on a Paddle subscription after it has been created.

<a name="handling-paddle-webhooks"></a>
Expand Down