2016-10-27 3 views
2

ストライプテストでこの問題が発生します。すべてがテストで動作するように使用されるが、私はストライプの新しい計画を作成し、オリジナルのものを削除したとき、私は今、次のエラーを取得:このような計画はありません:毎月; 1つは月ごとの名前で存在しますが、そのIDはプライマリですLaravelキャッシャー

No such plan: monthly; one exists with a name of monthly, but its ID is primary. 

コントローラ

$user->newSubscription('primary', 'monthly')->create($token, [ ]); 

プランの詳細を

ID: primary 
Name: monthly 
Price: $19.99 USD/month 
Trial period: No trial 

php artisan config:clearは役に立ちません。私はLaravel 5.2とCashier 6.0を使用しています。

.envファイル

STRIPE_KEY=pk_test_... 
STRIPE_SECRET=sk_test_.... 

のconfig/services.php

'stripe' => [ 
    'model' => App\User::class, 
    'key' => env('STRIPE_KEY'), 
    'secret' => env('STRIPE_SECRET'), 
], 
+0

あなたの質問にあなたの答えを加えないでください。それに答えを加えてください。 –

答えて

0

代わりに、この使用:ドキュメントから

$user->newSubscription('primary', 'primary')->create($token, [ ]); 

を:

The first argument passed to the newSubscription method should be the name of the subscription. The second argument is the specific Stripe plan the user is subscribing to. This value should correspond to the plan's identifier in Stripe.

したがって、2番目の引数は、私のStripeプランのID値と等しくなければなりません!この場合、その値はmonthlyではなく、primaryです。

関連する問題