Skip to content
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

FeatureRequest: self_service_portal #132

Open
ruseinov opened this issue May 20, 2020 · 2 comments
Open

FeatureRequest: self_service_portal #132

ruseinov opened this issue May 20, 2020 · 2 comments

Comments

@ruseinov
Copy link

Add support for https://stripe.com/docs/api/self_service_portal.

Similar to https://stripe.com/docs/billing/subscriptions/integrating-self-serve-portal#redirect

@ruseinov
Copy link
Author

I have implemented this directly in my application in a very minimal fashion, looks similar to this:

#[derive(Serialize)]
struct BillingPortalParams {
    pub customer: String,
    pub return_url: String,
}

#[derive(Deserialize)]
struct BillingPortalResponse {
    pub url: String,
}


    let resp: BillingPortalResponse = stripe_client
        .post_form(
            "/billing_portal/sessions",
            &BillingPortalParams {
                customer: ...,
                return_url: ...,
            },
        )
        .await?;

    Ok(HttpResponse::Found()
        .header(LOCATION, resp.url)
        .finish()
        .into_body())

@manonthemat
Copy link

Thank you for opening the issue and posting your solution. I am also looking to offer my customers to use the self service portal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants