(
    request: AuthedHttpRequest, team_id: str
)
return HttpResponseRedirect(session_url)
Redirect the user to the temp URL so they can access the stripe self serve portal

    https://stripe.com/docs/billing/subscriptions/integrating-self-serve-portal
Redirect the user to the temp URL so they can access the stripe self serve portal
Redirect the user to the temp URL so they can access the stripe self serve portal
def redirect_to_stripe_self_serve_portal(
    request: AuthedHttpRequest, team_id: str
) -> HttpResponse:
    """
    Redirect the user to the temp URL so they can access the stripe self serve portal

    https://stripe.com/docs/billing/subscriptions/integrating-self-serve-portal
    """
    account = get_account_or_404(team_id=team_id, user=request.user)

    customer_id = account.stripe_customer_id

    session_url = stripe.billing_portal.Session.create(
        customer=customer_id,
        return_url=f"{settings.KODIAK_WEB_APP_URL}/t/{account.id}/usage",
    ).url

    return HttpResponseRedirect(session_url)
def redirect_to_stripe_self_serve_portal ( request : AuthedHttpRequest , team_id : str ) -> HttpResponse : account = get_account_or_404 ( team_id = team_id , user = request . user ) customer_id = account . stripe_customer_id session_url = stripe . billing_portal . Session . create ( customer = customer_id , return_url = f"{settings.KODIAK_WEB_APP_URL}/t/{account.id}/usage" , ) . url return HttpResponseRedirect ( session_url )