我们已经使用了PHP的条带支付。它可以在本地机器上工作,但在实时服务器上,它不能像预期的那样工作。我们分享了我们使用的代码,并附上了错误的截图。不知道我们哪里搞错了,你能帮我们引路吗?
条带代码:
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' => 'customer@example.com',
'source' => $token
));
$charge = Stripe_Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
echo '<h1>Successfully charged $50.00!</h1>';
}本地计算机

实时服务器

发布于 2016-12-15 01:49:37
1)看起来您可能没有将stripe php绑定附带的data文件夹复制到您的服务器上-其中包含failed loading cafile错误中引用的ca-certificates.crt文件。确保此文件夹存在于您的服务器上,并查看这是否解决了问题!
2)如果您仍然有问题,该问题可能涉及到您的服务器无法通过TLS 1.2与Stripe进行通信。从语法上看,您似乎正在使用一个旧版本的Stripe的PHP库,所以您需要使用这里的第二个示例来test that。
如果curl首先能够建立TLS1.2连接,您还可以运行一个测试脚本like this来帮助确定您的libcurl和openssl版本。如果你需要升级curl和openssl,一些有用的建议是here。你也可以和你的系统管理员或者web主机聊聊这件事。
https://stackoverflow.com/questions/41146187
复制相似问题