Я хочу интегрировать полосу в свой веб-сайт, но у меня есть некоторые проблемы даже с самым простым из имеющихся у них методов ... Я использую PHP 7.4, поэтому сомневаюсь, что совместимость не должна быть проблемой. Я скачал исходный код с здесь сегодня, так что я уверен, что это последняя версия. Я использую документацию, найденную здесь . Мой код
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stripe Payment Test</title>
</head>
<body>
<?php
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey('sk_test_fXqjGiKf5jMeRpZ2HQOMVLfw00dTN8JPCB');
$session = \Stripe\Checkout\Session::create([
'payment_method_types' => ['card', 'ideal'],
'line_items' => [[
'name' => 'T-shirt',
'description' => 'Comfortable cotton t-shirt',
'images' => ['http://infomenonitas.org/images/80153222345562.png'],
'amount' => 2000,
'currency' => 'mxn',
'quantity' => 1,
]],
'success_url' => 'https://example.com/success?session_id=hello',
'cancel_url' => 'https://example.com/cancel',
]);
?>
<script src="https://js.stripe.com/v3/"></script>
<script>
var stripe = Stripe('pk_test_7UIIrY3lmQ6dTeMOdQgAfe9800YBJgMxPy');
stripe.redirectToCheckout({
// Make the id field from the Checkout Session creation API response
// available to this file, so you can provide it as parameter here
// instead of the {{CHECKOUT_SESSION_ID}} placeholder.
sessionId: 'hello'
}).then(function (result) {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer
// using `result.error.message`.
});
</script>
</body>
</html>
Когда страница загружается, она показывает эту ошибку:
Fatal error: Uncaught Error: Class 'Stripe\Stripe' not found in /home/domains/myDomain/public_html/payment_test.php:12
Stack trace:
#0 {main} thrown in /home/domains/myDomain/public_html/payment_test.php on line 12'
Любой способ исправить это?