Stripe无法在PHP 7.2上收费

时间:2018-11-03 08:44:26

标签: php google-app-engine stripe-payments php-7.2

我正在Google Standard App Engine上运行后端服务,并且在更新为PHP 7.2之后,我似乎无法与先前的用户执行事务。

//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, 
  ]);

通过错误记录,我收到以下错误:

Notice: Undefined variable: charge in /srv/PreviousCustomer.php on line 16

Fatal error: Cannot use 'Object' as class name as it is reserved in /srv/vendor/stripe/stripe-php/lib/Object.php on line 8

我真的不确定这里发生了什么/好像是与Stripe库有关的问题。任何帮助将不胜感激,

谢谢:)

1 个答案:

答案 0 :(得分:0)

您正在使用的是Stripe-php的较旧版本,该版本与PHP 7 [0]不兼容。尝试升级到最新版本。

[0]-https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#300---2015-07-28