我正在尝试在symfony
3.4项目中实现条纹,但出现此错误:
Unexpected error communicating with Stripe. If this problem persists, let us know at support@stripe.com.
(Network error [errno 92]: HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1))
这是我的控制器操作中的代码的条带部分:
public function viewPostAction(){
\Stripe\Stripe::setApiKey("sk_test_JKYj1WMuOsnaD5nOXiAYaPXr
");
\Stripe\Charge::create([
"amount" => 2000,
"currency" => "usd",
"source" => "tok_visa", // obtained with Stripe.js
"description" => "Charge for jenny.rosen@example.com"
]);
$post = $this->getDoctrine()->getRepository('AppBundle:Post')->findAll();
return $this->render("pages/index.html.twig",['post' => $post]);
}
这是条纹html形式:
<form method="post" id="payment-form">
<div class="form-row">
<label for="card-element">
Credit or debit card
</label>
<div id="card-element">
<!-- A Stripe Element will be inserted here. -->
</div>
<!-- Used to display Element errors. -->
<div id="card-errors" role="alert"></div>
</div>
<button>Submit Payment</button>
</form>
有人可以帮我解决这个问题吗?