条纹 - 未定义的方法 Stripe\Subscription::create()

Stripe - undefined method Stripe\Subscription::create()

所以我在创建条带付款时遇到了问题,并且一直收到此错误。

<br />↵<b>Fatal error</b>: Call to undefined method Stripe\Subscription::create() in <b>D:\username\Programs\xampp\htdocs\myapp\services\sec.php</b> on line <b>219</b><br />

这是代码。

} else if($stripetoken != "") {
    $customer = \Stripe\Customer::create(array(
        "email" => $email,
        "source" => $stripetoken,
    ));


    if ($term == "1") {
        \Stripe\Subscription::create(array(    <-- line 219
            "customer" => $customer->id,
            "plan" => "monthly-sub-test",
        ));                        
    }

我相信我已经按照文档中的说明设置了代码

https://stripe.com/docs/subscriptions/quickstart

您使用的是 Stripe's PHP library. The \Stripe\Subscription::create() method was added in version 3.13.0 的旧版本。确保您使用的是此版本或更新的版本。