即时通讯使用laravel 5.1并按照https://laravel.com/docs/5.1/billing中的步骤操作

除了提供者需要2个密钥

'key'    => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),

我在我的.env文件中设置为

STRIPE_KEY=@my_stripe_test_publishable_key
STRIPE_SECRET=@my_stripe_test_secret_key

我的控制器代码是

$creditCardToken = $request->stripeToken; //from stripe documentation
//because the documentation didnt include how to get this variable

$user = User::find(1);

$user->subscription('monthly')->create($creditCardToken);

$user->trial_ends_at = Carbon::now()->addDays(14);

$user->save();

每次我尝试订阅时都会出现错误 . 即使没有$ creditCardToken变量

StripeGateway.php第71行中的ErrorException:

传递给Laravel \ Cashier \ StripeGateway :: __ construct()的参数1必须是Laravel \ Cashier \ Contracts \ Billable的实例,App \ User的实例,在C:\ wamp \ www \ lifesaver \ vendor \ laravel \ cashier中调用第58行的\ src \ Laravel \ Cashier \ Billable.php并定义