1

我們已經使用PHP支付條形支付。它在本地機器上工作,但在實時服務器中,它不像預期的那樣工作。我們分享了我們使用的代碼,並附上錯誤的屏幕截圖。不知道我們犯了什麼錯誤,你能指導我們嗎?條紋支付SSL協議錯誤WordPress

條紋代碼:

require_once('Stripe.php'); 

Stripe::setApiKey('secret key'); 

echo '<form action="" method="post"> 
    <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" 
      data-key="publish key" 
      data-description="Access for a year" 
      data-amount="5000" 
      data-locale="auto"></script> 
</form>'; 

if($_POST) { 
$token = $_POST['stripeToken']; 

    $customer = Stripe_Customer::create(array(
     'email' => '[email protected]', 
     'source' => $token 
)); 

    $charge = Stripe_Charge::create(array(
     'customer' => $customer->id, 
     'amount' => 5000, 
     'currency' => 'usd' 
)); 

    echo '<h1>Successfully charged $50.00!</h1>'; 

} 

本地計算機

Local Machine output result

Live服務器

Live Server error report

回答

0

1)它看起來像有可能你沒有複製的data文件夾附帶的條帶php綁定到您的服務器---這包含failed loading cafile錯誤中引用的ca-certificates.crt文件。確保該文件夾存在於您的服務器上,並查看是否可以解決問題!

2)如果您仍然遇到問題,則可能是您的服務器無法通過TLS 1.2與Stripe進行通信。從你的語法看來,你使用的是舊版本的Stripe的PHP庫,所以你需要在這裏使用第二個示例test that

如果curl能夠首先創建TLS 1.2連接,那麼您還可以運行測試腳本like this以幫助確定您的libcurl和openssl版本。如果你需要升級捲曲和openssl一些有用的建議是here。您也可以在此問題上與您的系統管理員或網絡主持人聊天。