code-corps/ember-stripe-service

make stripe.publishableKey changable via interface

Closed this issue · 4 comments

use-case

we want to be able to change between testing and production based on the REST-interface we are currently using. therefore, our REST-interface should set the STRIPE_CLIENT_KEY.

workarounds

we lack a good solution to the problem, a simple interface which lets us set that value on runtime.

proposal

i could extend the library so that the key can also be set/changed during runtime. what about that?

@qknight what's the reasoning for changing this dynamically during runtime rather than doing this at build time? I think immutability of something as important as knowing which Stripe interface you're hitting is important.

I would recommend going the path of using the ENV as your method for doing this. If, in development, you want to switch interfaces (maybe a different backend, a testing vs production Stripe) then I would recommend adding an additional environment that encapsulates this.

We combine this with ember-cli-dotenv in development.

We do this in one of our OSS projects by defining a way to run with remote-development flag that lets people hit a remote API instead of relying on a locally hosted one. This means people who are focused only on the front-end can focus on just that.

Does this approach seem workable for you instead?

back then, i would have liked to be able to set the interface used based on a value in the REST interface and NOT by recompiling the application.

anyway, it is not important anymore ATM as i'm out of that project.

thanks for your interest in this though!

Thanks for updating @qknight!

I have a need for this as well. Building application for a client and they asked to allow them to change Stripe keys from panel, and also they need a "SWITH" in interface to be able to turn on / off a test mode and can switch between different account of stripe