0

我刚刚将我的项目更新到 Laravel 5.2 和 Cashier 6.0。
我已经按照文档添加了新subscriptions表,但是当我测试它时,收银员没有设置试用结束列。

在我的条带计划中,我有 14 天的试用期,在我的条带帐户中,我可以看到,如果我今天添加一个新客户,则第一次计费是在 14 天后设置的。

这是我的订阅代码:

// Create the user
$user = $this->create( $request->all() );

// Find the plan in the DB
$plan = Plan::find( $request->get( 'plan' ) );

// Charge the user ( 14 days trial )
$user->newSubscription( $plan->slug , $plan->stripe_id )->create( $request->get( 'stripeToken' ), 
[
     'email'       => $request->get( 'email' ),
     'description' => ''
] );

$plan->slug是我与我的计划相关联的名称,例如annual$plan->stripe_id我在 Stripe 仪表板上设置的名称相同。

如果我注册了一个新客户,但trials_ends_at已经ands_at设置好了。

我究竟做错了什么?

4

1 回答 1

3

我自己想通了。
新的 Casher 代码需要手动设置试用期:

trialDays($trialDays)

所以我的代码应该是:

$user->newSubscription( $plan->slug , $plan->stripe_id )->trialDays(14)->create( $request->get( 'stripeToken' ), 
[
     'email'       => $request->get( 'email' ),
     'description' => ''
] );
于 2016-01-24T09:35:59.820 回答