Skip to content

Commit

Permalink
[12.x] Add extra 10 seconds of trial time (#1160)
Browse files Browse the repository at this point in the history
* Add extra 10 seconds of trial time

* Update SubscriptionBuilder.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
driesvints and taylorotwell authored May 18, 2021
1 parent 2aa2e2b commit 98b7c71
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit 98b7c71

Please sign in to comment.