Search code examples
phpstripe-payments

Class 'Stripe\Stripe' not found


I've installed the stripe library with composer, and I have a problem that is only on one page (see picture here :

enter image description here

my code in cancelStripeSubscription.php :

Stripe\Stripe::setApiKey("my key here");

$sub = \Stripe\Subscription::retrieve($getSubId);
$sub->cancel();

I really don't understand why it's not working since it works in other files in the same directory.

error showing : "Fatal error: Class 'Stripe\Stripe' not found in D:\wamp64\www\etape4Prestige\"

Thanks in advance for helping!


Solution

  • You could use autoloader to actually include the Stripe classes...

    require_once('vendor/autoload.php');
    

    This should do the trick if the library is installed with composer I guess...