#joekneeland
1 messages · Page 1 of 1 (latest)
Hi 👋
Did you recently upgrade the PHP library you are using?
Can you share an API request ID for this? It will start with req_
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Hi Snufkin
We did not
Actually getting this; PHP Fatal error: Cannot declare class Stripe\Util\RequestOptions, because the name is already in use in /var/web/site/public_html/wp-content/plugins/stripe-builder/includes/stripe-library/stripe-php-7.38.0/lib/Util/RequestOptions.php on line 5
And what line of your PHP code is throwing this error?
not sure. actually on development everything works fine, on production site found this error in the logs. I'll turn on reporting on production to find the answer, brb
Hello! I'm taking over and catching up. I think I know what the issue is. Did you recently install a new Stripe plugin or upgrade an existing one on this WordPress install?
The issue is likely that two plugins are using static methods, which are global and thus conflict with each other. In version 7.33.0 of the Stripe PHP library we made it possible to use a service based approach that resolves this issue: https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0
Is the stripe-builder plugin your plugin or one from a third party?
Hi Rubeus, I hope you're well. stripe-builder is a wordpress plugin I built for them a couple years ago. Have not added another Stripe plugin, though I see now I may have accidentally uploaded the library in two locations of the plugin.
Ah, that could also do it.
strange though because all was well with zero changes from me or client until fri eve
Maybe this error is only happening in an obscure/low use code path?
right on main dashboard actually
it's a connect 'get account link' call
also checked another page that uses Stripe and also there. I'll try removing one of the instances of Stripe library and see if that solves.
same results
Can you share the code that's throwing the error?
other clue, it's working on my localhost, but not on live
sure 1sec
pretty sure this is it;
require(STRIPE_BUILDER_PATH_TO_STRIPE_INIT);
\Stripe\Stripe::setApiKey(TCC_STRIPE_SK);
$stripe_sellers_dashboard_link = \Stripe\Account::createLoginLink($provider_stripe_subacct_id);
Is that the first time you're calling \Stripe\Stripe::setApiKey?
So that's probably the issue. The static class approach that you're using doesn't support being initialized with different API keys. Are you using a different API key here or the same one you've already used earlier?
gotcha. same key
If it's the same key you should be able to skip calling \Stripe\Stripe::setApiKey again.
Like if you comment out the \Stripe\Stripe::setApiKey(TCC_STRIPE_SK); line does it work?
yep does work now
thanks so much. I'll run through and make sure all the other calls are working
Awesome!
you're the best Rubeus, I know you've helped me many times over the years and I super appreciate
Always happy to help!