我已经创建了一个包含一些数据的Plans表。当我试图订阅这些计划时,Laravel-Cashier说:没有这样的计划。
我错过了什么?
我也通过条纹仪表板创建了一个计划,但什么都没有改变。我如何克服这个问题?
下面是我的代码:
计划表格包含以下字段:
protected $fillable = [
'id',
'name',
'stripe_plan',
'cost',
'interval',
'currency',
'description'
];控制器代码是:
public function create(Request $request)
{
// Getting choosed plan
$plan = Plans::findOrFail($request->plan);
$entity->newSubscription($plan->id,$plan->stripe_plan)->create($request->stripeToken);
//I tried put hardcoded plans, but still same error
// $entity->newSubscription('phone', 'phone')->create($request->stripeToken);
return redirect()->route('plans')->with('success', 'Your plan subscribed successfully');
}发布于 2018-12-21 11:54:58
我将plan_id作为newSubscription方法的第二个参数传递,该方法是我在条带门户中创建的,工作正常。另外,传递plan-name不起作用,所以我像这样传递了plan的id
$entity->newSubscription(‘主’,'plan_EBttg1ziShQ51I')->create($request->stripeToken,);
但这对我来说很奇怪,因为如果我们有多个计划,那么我如何通过不同的计划……
https://stackoverflow.com/questions/53863958
复制相似问题