底辺SE奮闘記

年収300万SEブログ

Stripe

【Stripe・Laravel Cashier】newSubscription時に You cannot set the quantity for metered plans. で困った

現象 表題の通り。Stripeのテスト中に、 You cannot set the quantity for metered plans. というよくわからないエラーが出る。 解法 バージョンによっておそらく解法が異なる。両方試すと良い。 解法1 数量を0に指定する。 newSubscription("default", "pri…

【Stripe・Laravel Cashier】Attempt to read property "default_payment_method" on null で困った

現象 表題の通り。Stripeのテスト中に、 Attempt to read property "default_payment_method" on null というよくわからないエラーが出る。 解法 下記を確認 Billableモデル(\App\Models\Userなど)に対応するユーザがStripe上に存在しているか。 Billable…

【Stripe】Cannot create the usage record with this timestamp because timestamps must be after the subscription's last invoice period (or current period start time). に対応する

タイトルの通り、使用量をStripeに登録しようとすると下記のようなエラーが発生。 Cannot create the usage record with this timestamp because timestamps must be after the subscription's last invoice period (or current period start time). 原因は…

【Stripe・Laravel Cashier】Stripe\Exception\InvalidRequestException: You cannot set the quantity for metered plans. エラー対処

現象 サブスクリプションプラン購入の下記コードで表題のエラー $_user->newSubscription("main", $_planId) ->create($_paymentMethod); 環境 Laravel 5.8 Laravel Cashier 10.0 解法 数量を0とする $_user->newSubscription("main", $_planId) ->quantity(…

【PHP・Laravel・Stripe】WebHookのシグネチャをSDKなしで確認する

表題の通りです。 環境 PHP 7.2.1 Laravel 5.8 コード 最小のソースコードを示しますので、ご自分の環境にあった形に修正を行ってください。 getCon…