-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: add a portal redirect endpoint #23375
Merged
zlwaterfield
merged 26 commits into
master
from
zach/generate-less-stripe-portal-sessions
Jul 2, 2024
Merged
feat: add a portal redirect endpoint #23375
zlwaterfield
merged 26 commits into
master
from
zach/generate-less-stripe-portal-sessions
Jul 2, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zlwaterfield
changed the title
Add a portal redirect endpoint
feat: add a portal redirect endpoint
Jul 1, 2024
Size Change: 0 B Total Size: 1.06 MB ℹ️ View Unchanged
|
zlwaterfield
commented
Jul 1, 2024
@@ -85,8 +86,7 @@ def get_billing(self, organization: Optional[Organization], plan_keys: Optional[ | |||
products = self.get_default_products(organization) | |||
response["products"] = products["products"] | |||
|
|||
stripe_portal_url = self._get_stripe_portal_url(organization) | |||
response["stripe_portal_url"] = stripe_portal_url | |||
response["stripe_portal_url"] = f"{settings.SITE_URL}/api/billing/portal" |
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 the main change for the PR.
raquelmsmith
approved these changes
Jul 2, 2024
* should be optional * adjust test to account for null status * Update query snapshots * Update query snapshots * func name * Update query snapshots --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dylan Martin <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
…23221) Added number formatting for source settings
I've added a new option that survey authors can select so that we can show a survey every time an event in their selection occurs, not just the first time. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Juraj Majerik <[email protected]>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Right now we load a portal session every time the user loads the app and we only cache it for 60 seconds which means we generate a TON of them. This isn't good practice and they should really be generated jit-in-time when the user requests it.
Changes
This PR updates the
stripe_portal_url
in the billing response to be a fixed endpoint from the API that the client can redirect to, which will generate the portal session and redirect the user to. No other changes have been made. Nice and simple :)I updated the fixtures to match this pattern and added a test for portal endpoint.
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Does this work well for both Cloud and self-hosted?
How did you test this code?
Tested manually and added a test.