AD6 AD6 - 6 months ago 10
PHP Question

Fatal error: Class 'Stripe' not found in C:\wamp\www\

I'm getting an error that class is not found, but I clearly have the right path for where it is located:

<?php

require_once('stripe-php-2.1.0/stripe/lib/Stripe.php');



Stripe::setApiKey('my_key');

var_dump($_POST['stripe-token']);

?>


Every article I've come across all claim that the problem is (not including the right path) in the require_one, include, or require. (I've tried all 3). But still no luck. My database calls follow the same format and my WAMP server has no problem creating my database class.

This is copied directly from my file explore (copy paste)

website\stripe-php-2.1.0\stripe\lib\Stripe.php

My php file that I am using to try and access Stripe sits in the same place as 'website'.

PHP version 5.5.12

tutorial references: http://www.larryullman.com/2013/01/09/writing-the-php-code-to-process-payments-with-stripe/

Other reference: http://www.youtube.com/watch?v=Lka_JBM9bbY

enter image description here

Answer

It's because it uses a namespace. Try:

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