dj-stripe / dj-stripe

dj-stripe automatically syncs your Stripe Data to your local database as pre-implemented Django Models allowing you to use the Django ORM, in your code, to work with the data making it easier and faster.

Home Page:https://dj-stripe.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API Key not defaulting to database key, when using _api_create

rbiersbach opened this issue · comments

Hey guys,

Is there a specific reason for not defaulting to the API Key in the database, when using the _api_create method?
In all other similar methods, it is done 🤔

def _api_create(cls, api_key=djstripe_settings.STRIPE_SECRET_KEY, **kwargs):

@rbiersbach because it is a classmethod. We do not have access to the default key on the stripe object as it does not exist yet. I hope this answers your question.

@rbiersbach because it is a classmethod. We do not have access to the default key on the stripe object as it does not exist yet. I hope this answers your question.

Thanks for your quick answer. I came here because I was trying to migrate to only using API keys from the database, but I found this use case to be quite inconvenient. Maybe you should rethink the system check djstripe.I002, as it suggests this is the new way of using secrets.

@rbiersbach That's a great point and something we are addressing in 3.0!