#Serge

1 messages ยท Page 1 of 1 (latest)

opal solarBOT
quiet wasp
#

Hi there!

#

Pasting your other message here:

\Stripe\Stripe::setApiKey($stripe_api_key);
$retrieve_stripe_subscription = \Stripe\Subscription::retrieve

#

What's the error message you see?

harsh sand
#

I have no error message, nothing

#

My full code (that was working well before) is the next :

#

try {
\Stripe\Stripe::setApiKey($stripe_api_key);
$retrieve_stripe_subscription = \Stripe\Subscription::retrieve($pp_profile_id);
}

catch (\Stripe\Error\ApiConnection $e) {}
catch (\Stripe\Error\InvalidRequest $e) {}
catch (\Stripe\Error\Api $e) {}
catch (\Stripe\Error\ApiConnection $e) {}
catch (\Stripe\Subscription $e) {}

#

My PHP code stops there

#

When I see Stripe Documentation, to test how to retrieve a subcription in PHP, I read the following PHP code :

#

$stripe = new \Stripe\StripeClient($stripe_api_key);
$stripe->subscriptions->retrieve($pp_profile_id,[]);

#

But this code doesn't work in PHP 5.3

quiet wasp
#

If your code doesn't work, there must be some error message. Can you add some logs to your code, or check your server logs? Without an error message it's hard to help.

harsh sand
#

no problem detected on server logs

#

no messages from catch

#

I don't understand why this code that was working well during years is not working any more

#

I guess this is a Stripe update that makes it deprecated or something like that

#

the problem is : I don't see anything in stripe documentation managing his

eager rose
#

What version of our PHP library are you on? We should still support them unless we have something about it in those docs

#

Can you try logging your request ID and send it to me? (req_123)

harsh sand
#

stripe php 5.9.2

eager rose
#

Still supported as far as I can see. Can you try logging that request ID and sending it to me?

harsh sand
#

What do your mean by logging request ID ?

eager rose
harsh sand
#

So, your expectation that I put this code in my page to see what it gets ?

eager rose
#

Yes, if you put that code on your server that can help us get insight in to what is happening here

harsh sand
#

[23-Jan-2023 15:31:15 Europe/Paris] PHP Fatal error: Class 'Stripe\StripeClient' not found in subscription.php on line 293

#

meaning that this code doesn't go on $stripe = new \Stripe\StripeClient($stripe_api_key);

eager rose
#

Gotcha, thank you for that error, that is helpful to know where this is failing.

#

When you say "this code doesn't go on", do you mean it isn't being run at all?

harsh sand
#

yes

#

it seems like the lib or the init.php file is not working

eager rose
#

Can you double check that the init.php code is being called?

#

Or at least specifically that StripeClient line?

harsh sand
#

how can I do that ?

eager rose
#

Can you print out the Stripe Client just after setting it and see if that shows that the client is actually being set up?

harsh sand
#

can you give me a code example ? I don' t see how to do it specifically ?

#

line above is : require_once("../stripe/init.php");

#

which is where the file is

eager rose
#

I am not that familiar with php unfortunatley. Can you add print statements to init.php itself?

#

If not, can you see if you can access anything else that is set up in that file?\

harsh sand
#

i m gonna try

#

The access to the file is ok

#

if (require_once($fichier_init))
{echo ('require once done');}
exit;

#

i got the message

#

so it seems to read the init.php file

eager rose
#

Can you access the StripeClient object in any way?

harsh sand
#

I can access to ini.php file so I guess Yes, how can I be sure to acces to StripClient object ?

#

Where is the Stripe\StripeClient object stored in the lib ?

last yacht
#

Hello ๐Ÿ‘‹
Taking over as Pompey needs to step away soon

harsh sand
#

I think the Stripe Lib for PHP 5.3 is not working anymore

#

And I cannot updrade the PHP Version as all the application is done with this version

#

So, How Can I do ? Is this a Lib supporting PHP 5.3 up to date ?

#

I still dont understand why it is not working anymore, As I havent touch this part of code since years and one day, this is not working

last yacht
#

It can't just stop working on its own unless some changes were made. Did you update the library by any chance?

harsh sand
#

Tell me Library I need to intergrate because when I use the on for PHP 5.3 this is not working, and when I use the latest one online this is causing PHP errors in my app

#

So I m lost with the ressources posted by Stripe

#

I m not able to make some transactions

#

this is causing bugs and troubles in my app

last yacht
harsh sand
#

I have already read it and download the library before contacting you

#

this is not working

last yacht
#

v5.9.2 is the library that supports PHP 5.3
All you need is to download it and require init.php
Depending on how your files are nested, it is possible that the StripeClient instance isn't getting passed to your other files. Its really hard to know whats breaking your code without actually looking at your project structure.

harsh sand
#

the structure of the files in each folder is OK,

#

the code that is posted in the instructions :

#

$customer = $stripe->customers->create([
'description' => 'example customer',
]);
echo $customer->getLastResponse()->headers['Request-Id'];

#

this code is not working for PHP 5.3

last yacht
#

Well the code won't work if the library isn't setup correctly. And "code is not working" is quite vague.
You need to provide exact error messages, logs etc in order for us to help you.