I'm running a back-end service on Google Standard App Engine
and after updating to PHP 7.2, I can't seem to execute a transaction with a previous user.
//this includes "vendor/autoload.php" and this is where I set my secretKey
require_once('stripeConfig.php');
//charge customer from id
$customerID = $_POST['customerId'];
$amount = $_POST['amount'];
$amountInt = (int)$amount;
$charge = \Stripe\Charge::create([
'amount' => $amountInt,
'currency' => 'aud',
'customer' => $customer_id,
]);
With error logging, I receive the following errors:
Notice: Undefined variable: charge in /srv/PreviousCustomer.php on line 16
and
Fatal error: Cannot use 'Object' as class name as it is reserved in /srv/vendor/stripe/stripe-php/lib/Object.php on line 8
I'm really not sure what's going on here/seems like a problem relating to Stripe's library. Any help would be greatly appreciated,
Thanks :)
You're using a really old version of stripe-php that is not compatible with PHP 7 [0]. Try upgrading to the latest release.
[0] -https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#300---2015-07-28