admin管理员组文章数量:1192764
I am trying to implement a subscription with Laravel Cashier and Stripe. I've created a product in my Stripe dashboard and cut and pasted the product id and price id into the newSubscription method. See code below. But every time I try and run it, it returns the error message "No such price: 'price_1Qkgr4Az8wYmHt8vp5njDBoF'" But that price exists. What's the problem and solution?
Route::get('/subscribe', function (Request $request) {
return $request->user()
->newSubscription('prod_Rdyo9nUDWFaX3h', 'price_1Qkgr4Az8wYmHt8vp5njDBoF')
->checkout([
'success_url' => route('subscribe-success'),
'cancel_url' => route('subscribe-cancel'),
])->create($request->paymentMethodId);
})->name('subscribe');
I am trying to implement a subscription with Laravel Cashier and Stripe. I've created a product in my Stripe dashboard and cut and pasted the product id and price id into the newSubscription method. See code below. But every time I try and run it, it returns the error message "No such price: 'price_1Qkgr4Az8wYmHt8vp5njDBoF'" But that price exists. What's the problem and solution?
Route::get('/subscribe', function (Request $request) {
return $request->user()
->newSubscription('prod_Rdyo9nUDWFaX3h', 'price_1Qkgr4Az8wYmHt8vp5njDBoF')
->checkout([
'success_url' => route('subscribe-success'),
'cancel_url' => route('subscribe-cancel'),
])->create($request->paymentMethodId);
})->name('subscribe');
Share
Improve this question
edited Jan 25 at 2:40
Andrew Koper
asked Jan 24 at 7:39
Andrew KoperAndrew Koper
7,1998 gold badges44 silver badges53 bronze badges
1 Answer
Reset to default 1In Stripe, you have three dashboards and environments: regular, sandbox and test mode. They each have their own API key and API secret_key. You've put one set of keys in your .ENV file but made your product in another other, so your application's request is going to an environment where the product and its price_id don't exist. Put the correct/matching API keys in your .ENV.
本文标签: phpNo such price 39price1Qkgr4Az8wYmHt8vp5njDBoF39Stack Overflow
版权声明:本文标题:php - No such price: 'price_1Qkgr4Az8wYmHt8vp5njDBoF' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738439070a2086850.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论