stripe-java icon indicating copy to clipboard operation
stripe-java copied to clipboard

Global Variable apiKey

Open rpalmite opened this issue 14 years ago • 4 comments

Please remove the dependency on the global variable apiKey. This implementation makes it very difficult to write concurrent code that leverages multiple api keys. If you're writing anything that's going to be used by multiple clients, this is a really unfortunate restriction of the library. Thanks for your consideration.

Russell

rpalmite avatar Oct 31 '12 10:10 rpalmite

That's a good point, and it's why all of our API calls allow you to specify an API key directly to them as an optional extra argument, which overrides the globally set API key. However, in the vast majority of cases, our users only have a single active API key at a time, so it would be pretty silly if we required them to pass it to every single API call.

ebroder avatar Oct 31 '12 10:10 ebroder

all of our API calls allow you to specify an API key directly to them as an optional extra argument, which overrides the globally set API key

@ebroder is it the case for the Java SDK? what is the syntax to pass the API key?

Zhen-hao avatar Jun 29 '21 13:06 Zhen-hao

@Zhen-hao We document it on our readme here: https://github.com/stripe/stripe-java#per-request-configuration

remi-stripe avatar Jun 29 '21 14:06 remi-stripe

Thank you very much! This saved me!

On Tue, Jun 29, 2021 at 4:50 PM remi-stripe @.***> wrote:

@Zhen-hao https://github.com/Zhen-hao We document it on our readme here: https://github.com/stripe/stripe-java#per-request-configuration

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stripe/stripe-java/issues/18#issuecomment-870668341, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTTDCZNFKCHYXKF5IXTWCDTVHMSHANCNFSM4AB2OMPQ .

Zhen-hao avatar Jun 29 '21 17:06 Zhen-hao