wyyerd/stripe-rs

FeatureRequest: self_service_portal

ruseinov opened this issue · 2 comments

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())

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