Я пытаюсь создать эфемерный ключ для моего клиента Stripe, но по какой-то причине мой php-сервер выдает следующую ошибку?
Неустранимая ошибка: класс 'Stripe \ EphemeralKey' не найден в
/var/www/html/myFile.php в строке 21
Есть идеи, почему это происходит?
<?php // Create a customer using a Stripe token
require_once('vendor/autoload.php');
// If you're using Composer, use Composer's autoload:
ini_set('display_errors',1);
error_reporting(E_ALL);
// Be sure to replace this with your actual test API key
// (switch to the live key later)
\Stripe\Stripe::setApiKey("MYLIVEKEY");
if (!isset($_POST['api_version']))
{
header('HTTP/1.1 400 Bad Request');
}
// Create Stripe Customer
try {
$key = \Stripe\EphemeralKey::create(array(
"customer" => $customerId, // Convert amount in cents to dollar
"stripe_version" => $_POST['api_version']
)
);
header('Content-Type: application/json');
exit(json_encode($key));
} catch (Exception $e) {
header('HTTP/1.1 500 Internal Server Error');
}
?>
РЕДАКТИРОВАТЬ: Файл Composer.json добавлен ниже.
composer.json
{
"name": "stripe/stripe-php",
"description": "Stripe PHP Library",
"keywords": [
"stripe",
"payment processing",
"api"
],
"homepage": "https://stripe.com/",
"license": "MIT",
"authors": [
{
"name": "Stripe and contributors",
"homepage": "https://github.com/stripe/stripe-php/contributors"
}
],
"require": {
"php": ">=5.4.0",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"php-coveralls/php-coveralls": "1.*",
"squizlabs/php_codesniffer": "~2.0"
},
"autoload": {
"psr-4": { "Stripe\\" : "lib/" }
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
}
}