gpt4 book ai didi

php - 条纹 - PHP fatal error : Class 'Stripe\Charge' not found

转载 作者:可可西里 更新时间:2023-10-31 22:53:42 27 4
gpt4 key购买 nike

我一直在关注 Stripe 文档,但我无法创建“费用”。

收费.php

require('/var/www/stripe-php-2.1.1/lib/Stripe.php');
\Stripe\Stripe::setApiKey("KEY_HERE");

\Stripe\Charge::create(array(
"amount" => 400,
"currency" => "usd",
"source" => "TOKEN_HERE", // obtained with Stripe.js
"description" => "Charge for test@example.com"
));
?>

我能够处理第一个命令“\Stripe\Stripe::setApiKey("KEY_HERE");"但是在处理下一个时收到错误并收到以下错误:“在/var/www/charge.php 中找不到类‘Stripe\Charge’”

最佳答案

这里是这个问题的更新答案。

来自 Stripe 的 Dana:

If you prefer not to use Composer, our latest PHP bindings (>=2.x) include a init.php file that you can add to your project. Download and unzip the folder whereever you'd like, then include this init.php at the top of your scripts you use to communicate with the Stripe API, changing the path to the location of this file. Just like this: require_once('/path/to/stripe-php/init.php')

这对我有用。

关于php - 条纹 - PHP fatal error : Class 'Stripe\Charge' not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28846062/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com