2017-09-27 80 views
0

我一直在嘗試將條紋付款整合到laravel中。laravel的條紋付款

但是,當我嘗試創建條紋客戶,它不會創建。

這裏是我的代碼,

try 
{ 

    $customer = \Stripe\Customer::create(array(
           'email' => $this->user_email, 
           'card' => $this->stripe_token 
          )); 

    echo "<pre>"; 
print_r($customer);exit; 
    $charge = \Stripe\Charge::create(array(
          'customer' => $customer->id, 
          'amount' => $amountstripe, 
          'currency' => 'EUR' 
          )); 

} 

我得到一個錯誤信息一樣,

無法連接到條紋(https://api.stripe.com/v1/customers)。請檢查您的互聯網連接,然後重試。如果問題仍然存在,您應該檢查Stripe的服務狀態https://twitter.com/stripestatus,或通過[email protected]告訴我們。

(網絡錯誤[錯誤6:無法解析主機:api.stripe.com)

我怎樣才能解決這個問題呢?

+0

「無法解析主機:api.stripe.com」,這表示您的Internet無法與「api.stripe.com」連接。 – Zico

回答

0

這不是Laravel或Stripe的錯誤,而是「簡單」的網絡錯誤。您的服務器無法將請求發送到Stripe的API,因爲它無法將主機名api.stripe.com解析爲IP地址。

您需要聯繫您的網絡管理員或託管服務提供商,並要求他們檢查您的服務器和Stripe之間的連接。以下腳本可能有助於診斷問題:https://github.com/stripe/stripe-reachability#stripe-reachability