This is the code I'm using.
<?php
require_once('init.php');
if ($_POST) {
\Stripe\Stripe::setApiKey("xxxxxxxxxxxxx");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
$charge = \Stripe\Stripe_Charge::create(array("amount" => 100, //995
"currency" => "eur",
"card" => $_POST['stripeToken']));
$success = 'Your payment was successful.';
}
catch (Exception $e) {
$error = $e->getMessage();
}
}
?>
Why am I getting the error
"Fatal error: Class 'Stripe\Stripe_Charge' not found in"
I discovered that neither UsageRecord.php nor UsageRecordSummary.php were available in my stripe-php/lib directory and likewise not initiated in my stripe-php/init.php. I went and grabbed them from https://github.com/stripe/stripe-php/blob/master/lib/
Using Composer to install. adam-paterson/oauth2-stripe. Not sure if this is missing there.