【发布时间】:2016-08-04 18:14:00
【问题描述】:
我正在使用条带收费卡 api 进行卡支付。令牌成功创建,此信息也发送到条带服务器。但是当去收费时,它会给出致命的错误。
我正在使用 amazone ubuntu 实例发布我的网站。
我的 php 代码是:-
$token=$this->input->post('stripeToken');
var_dump($token);
\Stripe\Stripe::setApiKey("xxx");
// Get the credit card details submitted by the form
//$token = $_POST['stripeToken'];
// Create the charge on Stripe's servers - this will charge the user's card
try {
$charge = \Stripe\Charge::create(array(
"amount" => 100, // amount in cents, again
"currency" => "usd",
"source" => $token,
"description" => "Example charge"
));
} catch(\Stripe\Error\Card $e) {
// The card has been declined
}
它给出了致命错误。
致命错误:未捕获的异常“Stripe\Error\ApiConnection”与消息“无法连接到 Stripe” (https://api.stripe.com/v1/charges)。请检查您的互联网 连接并重试。如果此问题仍然存在,您应该检查 Stripe 的服务状态在https://twitter.com/stripestatus,或者让我们 通过 support@stripe.com 了解。 (网络错误 [errno 28]:连接 30055 毫秒后超时)' /opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/HttpClient/CurlClient.php:216 堆栈跟踪:#0 /opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/HttpClient/CurlClient.php(178): Stripe\HttpClient\CurlClient->handleCurlError('https://api.str...', 28, '连接时间...') #1 /opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/ApiRequestor.php(184): Stripe\HttpClient\CurlClient->request('post', 'https://api.str...', 数组,数组,假)#2 /opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/ApiRequestor.php(59): Stripe\ApiRequestor->_requestRaw('post', '/v1/charges', Array, Ar in /opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/HttpClient/CurlClient.php 在第 216 行
我不知道背后的原因。
【问题讨论】:
-
你在使用 https 吗?
-
不,我没有使用 https
-
如果这不是测试环境,您必须使用 ssl 证书。
-
目前处于测试环境中
-
@SatanandTiwari - 我相信您使用的是 HTTPS,因为错误表明 API 端点是 api.stripe.com/v1/charges
标签: php api rest amazon-web-services stripe-payments