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

[12.x] Add extra 10 seconds of trial time #1160

Merged
merged 2 commits into from
May 18, 2021
Merged
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
3 changes: 2 additions & 1 deletion src/SubscriptionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ public function checkout(array $sessionOptions = [], array $customerOptions = []
// Checkout Sessions are active for 24 hours after their creation and within that time frame the customer
// can complete the payment at any time. Stripe requires the trial end at least 48 hours in the future
// so that there is still at least a one day trial if your customer pays at the end of the 24 hours.
$minimumTrialPeriod = Carbon::now()->addHours(48);
// We also add 10 seconds of extra time to account for any delay with an API request onto Stripe.
$minimumTrialPeriod = Carbon::now()->addHours(48)->addSeconds(10);

$trialEnd = $this->trialExpires->gt($minimumTrialPeriod) ? $this->trialExpires : $minimumTrialPeriod;
} else {
Expand Down