Я получаю эту ошибку, когда вручную устанавливаю Stripe PHP library
Неустранимая ошибка: черта 'Stripe \ ApiOperations \ Request' не найдена в /home/sites/website.com/ public_html / testing / includes / stripe-php / lib / ApiResource. php в строке 10
Файл конфигурации моего веб-сайта содержит ссылку на ключи Api, загружает класс и устанавливает каталог
// Stripe API keys
$st_test_secret_key = "sk_test_....";
$st_test_public_key = "pk_test_...";
// File path to the Strip library
$path_to_stripe_lib = dirname(__FILE__) . '/includes/stripe-php/lib/';
// include_once($path_to_stripe_lib . 'init.php');
require_once(__DIR__ . '/includes/stripe-php/init.php');
use Stripe\Stripe;
use Stripe\Charge;
\Stripe\Stripe::setApiKey($stripe[$st_test_secret_key]);
В файле инициализации я перезагрузил пространство имен, чтобы убедиться, что оно истинно
use Stripe\Stripe;
use Stripe\Charge;
// Stripe singleton
require(dirname(__FILE__) . '/lib/Stripe.php');
// Utilities
require(dirname(__FILE__) . '/lib/Util/RequestOptions.php');
require(dirname(__FILE__) . '/lib/Util/Set.php');
require(dirname(__FILE__) . '/lib/Util/Util.php');
И тогда файл ApiResource выглядит следующим образом
<?php
namespace Stripe;
/**
* Class ApiResource.
*/
abstract class ApiResource extends StripeObject
{
use ApiOperations\Request;
/**
* @return \Stripe\Util\Set A list of fields that can be their own type of
* API resource (say a nested card under an account for example), and if
* that resource is set, it should be transmitted to the API on a create or
* update. Doing so is not the default behavior because API resources
* should normally be persisted on their own RESTful endpoints.
*/
public static function getSavedNestedResources()
{
static $savedNestedResources = null;
if (null === $savedNestedResources) {
$savedNestedResources = new Util\Set();
}
return $savedNestedResources;
}
et c
Я проверил несколько других ответов и, кажется, указывает, что ссылка / stripe где-то испорчена, но я не могу найти правильное решение