I am a definite PHP noob, so please bear with me. I am trying to set up a simple donation payment option for my fund raising website. I've got a paypal option, but was looking to add a stripe option as well.
I'm using there simple Checkout process to collect card info and set up the stripe token. I've set up a pay.php file to handle the card info on the server.
<!DOCTYPE html>
<html>
<body>
<?php
// secret key
***Stripe::setApiKey("sk_test_##########");***
// Get the credit card details submitted by the form
$token = $_POST['stripeToken'];
//Create the charge on Stripe's servers
try {
$charge = Stripe_Charge::create(array(
"amount" => 500, // amount in cents, again
"currency" => "aud",
"card" => $token,
"description" => "[email protected]")
);
} catch(Stripe_CardError $e) {
// card decline
}
?>
</body>
</html>
Obviously I use the right secret key, I've just blocked it out here. Everything seems to work with the form, but when it POSTS to pay.php it throws up this error.
Fatal error: Class 'Stripe' not found in /home/munkeychunk/public_html/pay.php on line 8
Line 8, as highlighted above is the secret key component/API key. As I said, I'm a bit of a PHP novice, and i'm not sure how or what to set the class 'Stripe' to!
Most of the PHP is lifted straight from stripe's own documentation, but it doesn't seem to work straight out of the box. My attempt to solve was to try to 'include Stripe.php', using an external stripe.php page which is used if you process payments using javascript/jquery rather than stripe's checkout option.
Any help would be greatly appreciated - please be gentle with your comments!
include Stripe.phpshould beinclude 'Stripe.php'. - Eisa Adil