我首次在Laravel 5.1中整合条带支付,并且我参考了本教程Simple Payments with Stripe and Laravel并完成了所有步骤。在Laravel 5.1中存储条带支付详细信息
付款后,我收到此错误:
在条纹的日志,它告诉我做成功付款。
我在这个函数收到此错误:
public function createStripeCustomer($token)
{
\Stripe\Stripe::setApiKey(env('STRIPE_SECRET'));
$customer = \Stripe\Customer::create(array(
"description" => Auth::user()->email, <-- Error at this line
"source" => $token
));
//Auth::user()->stripe_id = $customer->id;
Auth::user()->save();
return $customer;
}
我已经创建了波纹管架构的用户,但不明白其中的细节需要存储:
Schema::table('users', function ($table) {
$table->string('stripe_id')->nullable();
$table->string('card_brand')->nullable();
$table->string('card_last_four')->nullable();
$table->timestamp('trial_ends_at')->nullable();
});
因为您还没有授权用户,并且Auth :: user()返回false,请登录并重试。 –
@VaheGalstyan我正在尝试,因为你解释了我,但你能告诉我哪些细节我必须存储在这个领域:'stripe_id,card_brand,card_last_four,trial_ends_at'。 –
使用教程,我在答案中添加。 –