#Damien Haas-PHP-Error
1 messages ยท Page 1 of 1 (latest)
Hi there ๐ do you know what line of code is executing when you encounter that error?
require_once('../stripe/init.php');
$stripe = new \Stripe\StripeClient('sk_live_etc....');
$stripe->accountLinks->create(
[
'account' => 'acct_1032D82eZvKYlo2C',
'refresh_url' => 'https://example.com/reauth',
'return_url' => 'https://www.online-rsvp.com/event/edit.php?event='.$event,
'type' => 'account_onboarding',
]
);
it looks super basic I know..
(sorry, discord transforms ' into %27 for the "return_url")
It fails at the 2nd line: $stripe = new \Stripe....
Thank you, was just comparing to some playground PHP code that I have. Can you confirm that the Stripe SDK folder is located where indicated by the require_once line, and that the folder contains the init.php file?
yes, confirmed
the error is not with the "required_once", but the next line
I did install it a long time ago... is it possible that the "StripeClient" is not part of it?
Hm, I'm not sure. Mine starts with the require line followed by:
$stripe = new \Stripe\StripeClient('sk_test_
Do you know what version of the library you have installed?
Sorry, I do not know. I installed it around April-May 2020
Sorry, I've been scouring looking for what could be the cause. It doesn't seem Stripe specific though. What is the very first line of your script? I'm seeing mentions that some environments are very picking about the opening tags.
Sounds like you are using a more legacy version. We have a doc on what that flow looks like that may help you here https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0
I'm not immediately aware of how to do it for accountlinks specifically but it sounds like your code will look more like this ```\Stripe\Stripe::setApiKey('sk_test_xxx');
// Retrieve the customer and then delete it
$customer = \Stripe\Customer::retrieve('cus_xxx');
$customer->delete();
// Create a Coupon
$coupon = \Stripe\Coupon::create([
'percent_off' => 25,
'duration' => 'repeating',
'duration_in_months' => 3,
]);```
my code looks like this too...
$stripe = new \Stripe\StripeClient('sk_live_etc....');
I just deactivated the whole code before (was basically to check if user is logged in / if user page exists)
I get the same error
Definitely weird as we aren't able to reproduce it on our end ๐ค
Was this working before with creating the StripeClient?