Ошибка: вызов неопределенной функции Curl_version() PHP StripePhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Ошибка: вызов неопределенной функции Curl_version() PHP Stripe

Сообщение Anonymous »

Я пытаюсь интегрировать оплату Stripe в свой проект PHP (PHP 7.4.5 с WAMP в Windows).

Я использую структуру из официальной документации (https://stripe.com) /docs/pays/integration-builder), но при проверке консоли в браузере я получаю следующую ошибку:

POST 500 (внутренняя ошибка сервера) и в разделе сети ответ на POST( для create.php) запрос

Код: Выделить всё









{"error":"Call to undefined function curl_version()"}
Вот мой код:
create.php

Код: Выделить всё

require_once('../stripe-php-7.37.1/init.php'); //my others require are not printed

\Stripe\Stripe::setApiKey('my_key');

header('Content-Type: application/json');

try {
// retrieve JSON from POST body
$json_str = file_get_contents('php://input');
$json_obj = json_decode($json_str);
$paymentIntent = \Stripe\PaymentIntent::create([
'amount' => calculateOrderAmount(), //amount calculator
'currency' => 'eur',
]);

$output = [
'clientSecret' => $paymentIntent->client_secret,
];

echo json_encode($output);
} catch (Error $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}
checkout.php

Код: Выделить всё

...

...




Pay


Payment succeeded, see the result in your
Stripe dashboard. Refresh the page to pay again.


...

var stripe = Stripe("my_key");

// Disable the button until we have Stripe set up on the page
document.querySelector("button").disabled = true;
fetch("/Stripe/create.php", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(purchase)
})
.then(function(result) {
result.json();
})
.then(function(data) {
var elements = stripe.elements();
...

Я проверил WAMP, расширение Curl включено в PHP.ini
У меня следующая файловая архитектура:

├───stripe -php-7.37.1

├───Stripe

│ ├───checkout.php

│ ├───create. php
Спасибо за помощь

Подробнее здесь: https://stackoverflow.com/questions/626 ... php-stripe
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»