#andre_ange
1 messages ยท Page 1 of 1 (latest)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yep you can override that default key using api_key in the request options: https://github.com/stripe/stripe-php#per-request-configuration
Thanks, so if it's overridden, it still means that i have to provide a valid API key when first instantiating the object, even if it won't be used later on?
Yes, sort of
I think if you expect to always provide some other key, you can init the client using a junk key like sk_test_123
It's not actually validated beyond having a sensible structure until a request is made
Is there a risk of breaking if the client ever changes its validation check? I know it's probably a bit far from the standard use case to override the API key every time but I'd prefer to not use Stripe Connect and it seems like a decent solution
I don't really understand where you're getting the Connect pattern from, can you say more about that?
I don't expect us to change this without a major version change in the package to call it out as a breaking change
At which point you could simply provide a valid junk key, like a restricted key with almost no permissions
Well, it's a bit complicated but basically I'm building an application for structures that tend to segregate several legal entities together, and each entity has their own Stripe account, however they're presenting as one cohesive whole. So each entity has to save their API key and webhook secret in a DB, and when a payment is made I have to chose which account it should go to. Someone I know advised me to use Stripe Connect instead of saving multiple API keys to the DB. I haven't looked much into it but it looked over engineered for what I need. Anyway, your solution seems great, thank you so much for the help!
Either way works, if you control/manage all these entities swapping keys is fine, but using Connect for that case also works. I'd say the flows involved are more important than the key management, though.
Ie, do the concepts of Connect makes sense for your needs, or not
I'll educate myself a bit about Stripe Connect and consider both options. Have a good day! ๐