Когда я запускаю код для оплаты кредитной картой, я получил приведенную ниже ошибку?

Ошибка

Неустранимая ошибка: Uncaught Stripe_ApiConnectionError: не удалось подключиться к
Полоса (https://api.stripe.com). Пожалуйста, проверьте подключение к интернету
и попробуй еще раз. Если проблема не устранена, сообщите нам об этом по адресу
support@stripe.com. (Сетевая ошибка [errno 6]: не удалось разрешить хост:
api.stripe.com) в
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ CreditCard \ Lib \ нашивки \ ApiRequestor.php: 220
Трассировка стека: # 0
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ Creditcard \ Lib \ нашивки \ ApiRequestor.php (194):
Stripe_ApiRequestor-> handleCurlError (6, ‘Не удалось разрешить …’) # 1
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ Creditcard \ Lib \ нашивки \ ApiRequestor.php (123):
Stripe_ApiRequestor -> _ curlRequest (‘post’, ‘https: //api.str…’, Массив,
Массив) # 2
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ Creditcard \ Lib \ нашивки \ ApiRequestor.php (73):
Stripe_ApiRequestor -> _ requestRaw (‘post’, ‘/ v1 / Customers’, Array) # 3
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ Creditcard \ Lib \ нашивки \ ApiResource.php (76):
Stripe_ApiRequestor-> request (‘post’, ‘/ v1 / custo in
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ CreditCard \ Lib \ нашивки \ ApiRequestor.php
на линии 220

index.php

<?php require_once('./config.php'); ?>
<html>
<form action="charge.php" method="post">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"data-key="<?php echo $stripe['publishable_key']; ?>"data-name="Smiling Feet Africa";
data-amount="6000"data-label="Donate Now";
data-description="Donation To Smiling Feet Africa";
data-image="https://scontent.fdel1-1.fna.fbcdn.net/v/t1.0-9/15267710_1800934823517876_8537040350463715708_n.jpg?oh=c28d57192ddfff07dfcdf2e09bed10da&oe=58B7699D";
data-locale="auto"></script>
</form>
</html>

config.php

<?php
require_once('lib/stripe.php');

$stripe = array(
"secret_key"      => "sk_test_iiL4w4FTUReerKcuW6O4hDMu",
"publishable_key" => "pk_test_MyunyEF75C8aFGTA2S483IIQ");

Stripe::setApiKey($stripe['secret_key']);
?>

charge.php

<?php
require_once(dirname(__FILE__).'/config.php');

$token  = $_POST['stripeToken'];

$customer = Stripe_Customer::create(array(
'email' => 'customer@example.com',
'source'  => $token
));

$charge = Stripe_Charge::create(array(
'customer' => $customer->id,
'amount'   => 5000,
'currency' => 'usd'
));

echo '<h1>Successfully charged $50.00!</h1>';
?>

Я работаю на местном хосте. Пожалуйста, помогите мне.

1

Решение

Ошибка

Неустранимая ошибка: Uncaught Stripe_ApiConnectionError: не удалось подключиться к
Полоса (https://api.stripe.com). Пожалуйста, проверьте подключение к интернету
и попробуй еще раз. Если проблема не устранена, сообщите нам об этом по адресу
support@stripe.com. (Сетевая ошибка [errno 6]: не удалось разрешить хост:
api.stripe.com) в
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ CreditCard \ Lib \ нашивки \ ApiRequestor.php: 220
Трассировка стека: # 0
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ Creditcard \ Lib \ нашивки \ ApiRequestor.php (194):
Stripe_ApiRequestor-> handleCurlError (6, ‘Не удалось разрешить …’) # 1
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ Creditcard \ Lib \ нашивки \ ApiRequestor.php (123):
Stripe_ApiRequestor -> _ curlRequest (‘post’, ‘https: //api.str…’, Массив,
Массив) # 2
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ Creditcard \ Lib \ нашивки \ ApiRequestor.php (73):
Stripe_ApiRequestor -> _ requestRaw (‘post’, ‘/ v1 / Customers’, Array) # 3
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ Creditcard \ Lib \ нашивки \ ApiResource.php (76):
Stripe_ApiRequestor-> request (‘post’, ‘/ v1 / custo in
C: \ XAMPP \ HTDOCS \ smilingfeetafrica \ CreditCard \ Lib \ нашивки \ ApiRequestor.php
на линии 220

index.php

<?php require_once('./config.php'); ?>
<html>
<form action="charge.php" method="post">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"data-key="<?php echo $stripe['publishable_key']; ?>"data-name="Smiling Feet Africa";
data-amount="6000"data-label="Donate Now";
data-description="Donation To Smiling Feet Africa";
data-image="https://scontent.fdel1-1.fna.fbcdn.net/v/t1.0-9/15267710_1800934823517876_8537040350463715708_n.jpg?oh=c28d57192ddfff07dfcdf2e09bed10da&oe=58B7699D";
data-locale="auto"></script>
</form>
</html>

config.php

<?php
require_once('lib/stripe.php');

$stripe = array(
"secret_key"      => "sk_test_iiL4w4FTUReerKcuW6O4hDMu",
"publishable_key" => "pk_test_MyunyEF75C8aFGTA2S483IIQ");

Stripe::setApiKey($stripe['secret_key']);
?>

charge.php

<?php
require_once(dirname(__FILE__).'/config.php');

$token  = $_POST['stripeToken'];

$customer = Stripe_Customer::create(array(
'email' => 'customer@example.com',
'source'  => $token
));

$charge = Stripe_Charge::create(array(
'customer' => $customer->id,
'amount'   => 5000,
'currency' => 'usd'
));

echo '<h1>Successfully charged $50.00!</h1>';
?>

Я работаю на местном хосте. Пожалуйста, помогите мне.

1

Другие решения


active «data-shortcut =» A

самый старый «data-shortcut =» O
голосует «data-shortcut =» V