我尝试在实际网站上实现一个简单的条带网关,但出于某种原因,在条带结帐详细信息填写完毕并点击提交按钮后,我收到以下消息,它指向charge.php,我不知道哪里出错了
“......页面无效
...目前无法处理此请求。 HTTP ERROR 500“
index.php条带代码
<form action="charge.php" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="*Edited for question*"
data-amount="1499"
data-name="*Edited for question*"
data-description="2 widgets"
data-image="*Edited for question*"
data-locale="auto"
data-currency="eur">
</script>
</form>
charge.php代码
<?php
require_once 'init.php';
if(isset($_POST['stripeToken'])) {
$token = $_POST['stripeToken'];
try {
Stripe_Charge::create([
"amount" => 1499,
"currency" => "eur",
"card" => $token,
"description" => "Charge"
]);
} catch(Stripe_CardError $e) {
//do something with error here
}
header('Location: index.php');
exit();
}
?>
Init.php代码
<?php
session_start();
require_once 'vendor/autoload.php';
$stripe = [
'publishable' => '*Edited for question*',
'private' => '*Edited for question*'
];
Stripe::setApiKey($stripe['private']);
?>
答案 0 :(得分:0)
我相信Stripe要求你拥有以下php库:
在跟踪其他解决方案之前,请确保所有这些内容都包含“ php -m ”。