I need my users to have a test mode / live mode switch, exactly like Stripe has on its dashboard. I'm using python-social-auth
to authenticate the user with Stripe, using a custom pipeline step to retrieve the access token and publishable key, and saving it to a field in the user model.
The problem is that I have to define in the settings these two values: SOCIAL_AUTH_STRIPE_KEY
and SOCIAL_AUTH_STRIPE_SECRET
, but I need something more like SOCIAL_AUTH_STRIPE_TEST_KEY
, SOCIAL_AUTH_STRIPE_TEST_SECRET
, SOCIAL_AUTH_STRIPE_LIVE_KEY
and SOCIAL_AUTH_STRIPE_LIVE_SECRET
.
Depending on which client id is used when initiating the OAuth flow, that's how Stripe selects which type of API access code to send, if I use my app's test cliend ID, Stripe will only send the test keys for that user. But if I use my production/live client ID, then I will be getting the live access code for that user.