按照第一行的“使用Checkout和PHP”文档行之后,除了最后一部分之外,一切都正常工作 .
我的代码是这样的
<?php
require_once('config.php');
$token = $_POST['stripeToken'];
$customer = \Stripe\Customer::create(array(
'email' => 'customer@example.com',
'source' => $token
));
echo '<h1>Successfully charged $50.00!</h1>';
?>
一切都很好我可以在令牌上做一个var_dump,看看它运行正常,我的问题是客户数组 . 我已经尝试使用Stripe_Customer而不是\ Stripe \ Customer但它仍然无法正常工作 .
我可能需要注意的一些事情是我手动下载文件并且我使用mamp但是我不认为这是问题,因为我能够接收令牌,它只是在我添加客户数组时就停止工作 .
这是我的config.php文件
<?php
require_once('../stripe/init.php');
$stripe = array(
"secret_key" => "test",
"publishable_key" => test"
);
\Stripe\Stripe::setApiKey($stripe['secret_key']);
?>
1 回答
弄清楚,这是一个TLS更新问题 . 更新MAMP后一切正常 .