【问题标题】:Laravel Cashier undefined method meteredPrice()Laravel Cashier 未定义方法meteredPrice()
【发布时间】:2021-09-16 04:43:17
【问题描述】:

我尝试在 Laravel Cashier 中使用meteredPrice() 函数。对于我需要它 - 例如,如果我在 01.06 签署订阅,我想在 01.07 付款,所以在 1 个月后。 为此,我尝试在文档中使用meteredPrice(),但收到错误“调用未定义的方法 Laravel\Cashier\SubscriptionBuilder::meteredPrice()”

$request->user()->newSubscription($plan_id, [])
                ->meteredPrice($value)
                ->create($paymentMethodId->main_payment_method);

立即支付的类似代码可以正常工作:

$request->user()->newSubscription($plan_id, $value)
                ->create($paymentMethodId->main_payment_method);

你有什么想法吗?

【问题讨论】:

    标签: php laravel stripe-payments payment-gateway laravel-cashier


    【解决方案1】:

    您是否使用低于 13.0 的 laravel/cashier-stripe 版本?

    仅从 13.0 开始,"plans" are renamed to "prices"。试试:

    $request->user()->newSubscription($plan_id, [])
        ->meteredPlan($value)
        ->create($paymentMethodId->main_payment_method);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-06-15
      • 1970-01-01
      • 1970-01-01
      • 2022-12-23
      • 1970-01-01
      • 1970-01-01
      • 2018-01-11
      相关资源
      最近更新 更多