-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Use djstripe models for organization subscriptions #9486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5c8d6df
to
d54e766
Compare
This was already done, and all responses from our webhook are all green! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great first step. Excited about this transition!
@@ -784,6 +784,10 @@ def DOCKER_LIMITS(self): | |||
DJSTRIPE_FOREIGN_KEY_TO_FIELD = "id" | |||
DJSTRIPE_USE_NATIVE_JSONFIELD = True # We recommend setting to True for new installations | |||
|
|||
# We are managing the subscriber relationship by ourselves, | |||
# since we have subscriptions attached to an organization or gold user. | |||
DJSTRIPE_SUBSCRIBER_CUSTOMER_KEY = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there more information here? I don't quite understand this comment -- is it disabling some feature of djstripe? Are we going to turn this back on in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's disabling the feature, yes (well, partially, since stripe still creates a relationship to the user object), and we won't be using this in the future. I'll expand the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I like how the code gets simplified and easier to follow with this package 💯
This is to achieve #9312.
Basically just adding relationship to the Customer model from djstripe, we would need to trigger a resync for .com (since the last time there were some errors due to stripe bug with the logo), after that we can migrate the existing organizations to set the stripe customer on their models, this is done automatically for users that visit the subscription page and for new organizations. I'm not doing this as a data migration, since we would be hitting the stripe API in the process, we can execute this script to migrate them from web extra:
I have tested this locally with stripe's test mode.
📚 Documentation preview 📚: https://docs--9486.org.readthedocs.build/en/9486/