2014-10-31 43 views
0

我正在使用條紋來存儲客戶卡的人羣資金php腳本。 如果達到閾值,我被困在所有支持者的充電卡點上。在Stripe的api最大執行時間達到120秒後,在php腳本中使用循環會停止。我們如何在條紋上對大容量卡充電

<?php 
include('system/stripelib/lib/Stripe.php'); 
Stripe::setApiKey(API); 
//getting saved stripe Customer_id 
$result= $this->db->query("select cus_id,amount from pledge where 1"); 
if($result->num_rows) 
{     
    foreach($result->rows as $cus) 
    { 

     Stripe_Charge::create(array(
      "amount" => $cus['amount'] 
      "currency" => "usd", 
      "customer" => $cus['cus_id'], 
      "description" => "Charge for campaign" 
     )); 
    } 
} 
?> 
+0

這可能是PHP的執行限制,而不是Stripe的。 – ceejayoz 2014-11-01 23:42:54

回答

0

您的代碼應該正常工作。您只需要在try/catch(和associated error handling)中包裝呼叫Stripe_Charge::create,以便網絡錯誤,速率限制或甚至降低不會破壞整個事情。

+0

我得到了條紋api的錯誤,但是我認爲在try catch和using循環中的包裝會做到這一點。 – 2014-11-03 23:28:26