#aliensoft
1 messages ยท Page 1 of 1 (latest)
Hi ๐ what is the error?
it's not initializing
i do remembe reading somewhere that if you haven't installed it via composer, there should be a direct call to the init.php
i even tried
require_once('vendor/stripe-php/init.php');
and php error says no such file or directory
PHP Fatal error: Uncaught Error: Class "Stripe\StripeClient" not found
PHP Warning: require_once(vendor/stripe-php/init.php): Failed to open stream: No such file or directory
any ideas ?
That error makes it sound like you aren't pointing require_once to where the init.php file actually resides.
I would recommend double checking where you stored our SDK in relation to your code, and make sure the path to the file is correct.
the path is correct
i already have implemented stripe for years and the payment is working ok
this is just another side project that i'm setting up
it works elsewhere, but not here :/
PHP Fatal error: Uncaught Error: Class "Stripe\StripeClient" not found
actually now i got the initializing art going, but there seems to be when
$stripe = new \Stripe\StripeClient($stripeSecretKey);
and yes, my clientsecretkey is correct
PHP Fatal error: Uncaught Error: Class "Stripe\StripeClient" not found
Okay, so we're on to a new error now? That code looks right if the secret key is correct, unless the Stripe library still isn't being included/initialized.
yh seems like the library isn't being included/initialized
but why.. it's all there..
im looking at my other php files and it's the same calls
:/
Can you paste a snippet of how you're trying to initialize things?
require_once('vendor/stripe/stripe-php/init.php');
require_once 'secrets.php';
\Stripe\Stripe::setApiKey($stripeSecretKey);
$stripe = new \Stripe\StripeClient($stripeSecretKey);
$paymentIntent = \Stripe\PaymentIntent::retrieve([
'id' => $intent,
'expand' => ['latest_charge.balance_transaction'],
]);
$fee = $stripe->balanceTransactions->retrieve(
$taxID,
[]
);
Hm, is that the only error you're seeing? I'm seeing the same error, and am not certain why offhand. Working on comparing it to my other samples.
And which version of the SDK are you using?
The way you're setting the ApiKey and trying to create a Client makes it look like you're trying to use a combination of our legacy and client/service approaches:
https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0
If you're using an SDK version before 7.33.0 then I think you're going to need to use the legacy approach shown in that guide.
:/ let me try the legacy way
this was all working in TEST mode btw
since going LIVE it's starting causing these errors
how do i find out which stripe client version i have
and how do i upgrade it
oh it says 6.30.4
Typically, if you download the code directly from us, the folder name will have the version in it. But if not you can check the VERSION file in the root folder of our SDK.
Gotcha, yeah, I believe that version didn't have the client/service implementation in it, which is why you're encountering an error when trying to use it.
For upgrading, are you using composer (which I'm less familiar with) or are you manually pulling down the source code and putting it in your project?
this has now broken everything ๐
seems like it's abig jump from v6 to 11
i might as well try v7 or something
Yeah if you're going to try to use the newer way that we show in our docs, everything will have to change
If you want to stick to the legacy way, you can. You can't mix them though
Cool glad you got it
thanks for your help.