当我使用下面的代码时出现此错误:此客户没有附加的付款来源或默认付款方式。
我必须在哪里设置付款方式?
如何给我一个代码示例?
'email' => $email,
'description' => 'printloop stripe customer',
]);
$plan = $this->API->plans->create([
'amount' => $price * 100,
'currency' => 'usd',
'interval' => 'month',
'product' => 'prod_HOeoRj9boHP28C',
]);
$this->API->subscriptions->create([
'customer' => $customer->id,
'items' => [
[
"price" => $plan->id,
]
],
]);
我已使用此代码。
$customer = $this->API->customers->create([
'email' => $email,
'description' => 'printloop stripe customer',
]);
$plan = $this->API->plans->create([
'amount' => $price * 100,
'currency' => 'usd',
'interval' => 'month',
'product' => 'prod_HOeoRj9boHP28C',
]);
$this->API->subscriptions->create([
'customer' => $customer->id,
'items' => [
[
"price" => $plan->id,
]
],
]);