私はカード支払いのためにストライプチャージカードAPIを使用しています。トークンが正常に作成され、この情報もストライプサーバーに送られます。しかし、料金支払いのために行くと、致命的なエラーが発生します。ストライプチャージカードはphp rest 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
}
それは致命的なエラーを与えます。
Fatal error: Uncaught exception 'Stripe\Error\ApiConnection' with message 'Could not connect to Stripe (https://api.stripe.com/v1/charges). Please check your internet connection and try again. If this problem persists, you should check Stripe's service status at https://twitter.com/stripestatus , or let us know at [email protected] (Network error [errno 28]: Connection timed out after 30055 milliseconds)' in /opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/HttpClient/CurlClient.php:216 Stack trace: #0 /opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/HttpClient/CurlClient.php(178): Stripe\HttpClient\CurlClient->handleCurlError(' https://api.str ...', 28, 'Connection time...') #1 /opt/lampp/htdocs/devbeacon/application/libraries/stripe/lib/ApiRequestor.php(184): Stripe\HttpClient\CurlClient->request('post', ' https://api.str ...', Array, Array, false) #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 on line 216
私は、その理由を知らない。
httpsを使用していますか? – Kisaragi
いいえ私はhttpsを使用していません –
これはテスト環境でない場合は、SSL証明書を使用する必要があります。 – Kisaragi