2017-01-09 17 views
1

嗨我想改變我的付款方式使用條紋。我創建一個計劃,並使用該代碼的客戶一個客戶和訂閱,條紋訂閱不起作用我使用的任何版本的api

\Stripe\Stripe::setApiKey("stripe api key");          
    $plan = \Stripe\Plan::create(array(
     "name" => $randomString, 
     "id" => $randomString, 
     "interval" => "month", 
     "currency" => "usd", 
     "amount" => $amtincents, 
    )); 
    \Stripe\Stripe::setApiKey("stripe api key");          
    $cust = \Stripe\Customer::create(array(
       "email" => $emailval, 
      )); 
    $custid = $cust->id; 
    \Stripe\Stripe::setApiKey("stripe api key");          
    \Stripe\Subscription::create(array(
     "customer" => $custid, 
     "plan" => $randomString, 
    )); 

計劃和客戶獲取創建,但無論條紋API我用我得到的錯誤「法\條\的哪個版本當我嘗試訂閱客戶的計劃時沒有找到訂閱。任何幫助,將不勝感激。

回答

0

您正在使用舊版本的Stripe的PHP綁定。在版本3.13.0中添加了Subscription方法。

您應該升級到最新版本(當前是4.3.0)。您可以從存儲庫下載它:https://github.com/stripe/stripe-php/releases,或者如果您使用Composer來安裝庫,則可以使用Composer進行升級。

+0

謝謝。它適用於版本4.3.0 – jai