AD6
AD6

Reputation: 57

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

Upvotes: 4

Views: 9026

Answers (2)

Serhii
Serhii

Reputation: 11

It is better to initialize all classes.

require_once ("stripe_folder/init.php");

then use namespaces:

\Stripe\Stripe::setApiKey('key_key_key_key_key_key');

Upvotes: 1

Bitwise Creative
Bitwise Creative

Reputation: 4105

It's because it uses a namespace. Try:

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

Upvotes: 9

Related Questions