【问题标题】:laravel 5.5 billing set short trial period for testing recurringlaravel 5.5 计费设置短期试用期以进行重复测试
【发布时间】:2018-02-24 06:58:07
【问题描述】:

测试 laravel 5.5 和收银台。

需要非常短的试用期来测试定期付款和 webhook。

在文档示例中,试用期仅设置为天:

$user->newSubscription('main', 'monthly')
        ->trialDays(10)
        ->create($creditCardToken);

我如何设置试用一秒或一分钟??

【问题讨论】:

    标签: laravel billing


    【解决方案1】:

    由于在线应用程序的常见做法主要是在几天内设置最短订阅时间,因此设置分钟和秒在这方面没有意义。以及 laravel 收银员不提供方法trialInMins。你可以看看 SubscriptionBuilderhttps://github.com/laravel/cashier/blob/58efad0548d307426be6d4efbba0193f49285408/src/SubscriptionBuilder.php#L99

    不过,您可以尝试 trialUntil 使用 Carbon 对象和时间

    【讨论】:

      【解决方案2】:

      你可以使用trailUntil:

      $user->newSubscription('main', 'monthly')
          ->trialUntil(Carbon::now()->addSecounds(60))
          ->create($creditCardToken);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-07-07
        • 1970-01-01
        • 2018-03-09
        • 2018-05-06
        • 1970-01-01
        • 1970-01-01
        • 2019-06-03
        相关资源
        最近更新 更多