我在symfony框架开发一个网站。在网站我想
集成分条支付网关。当我对Stripe进行积分时,得到了Error
没有ID为tok_6OvjZrmqRYk0Wu的令牌。
Here is My Function:
public function indexAction()
{
$request = $this->container->get('request');
$message = '';
if($request->get('test'))
{
Stripe::setApiKey('sk_test_4zvcPWcVyDPt4wZcVwqe95Xc');
$token = $request->get('stripeToken');
$customer = Stripe_Customer::create(array(
'email' => 'customer@example.com',
'card' => $token
));
$charge = Stripe_Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
$message = '<h1>Successfully charged $50.00!</h1>';
}
}
这是我在html文件中使用的脚本
<script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button"
data-key="pk_test_ur0ebwOGBrsNzQrpdCNENIu4"
data-data-amount="1900"
data-data-description="One year's subscription"
data-address='true'
data-name='Test'
data-description='Test Transaction'
data-panel-label='Checkout'
></script>
请帮。
我认为您使用了错误的API密钥。检查您的发布者密钥。大多数情况下,这个错误99%的时间是错误的发布者密钥。