Manage Customer Portal

How can I manage the customer portal? When I do it via authClient.subscription.cancel({ returnUrl: "/dashboard", }); it takes me to https://billing.stripe.com/p/session/test_.../cancel?in_flow=true and not https://billing.stripe.com/p/session/test_.../ Thanks in advance
4 Replies
Allx
Allx2mo ago
Also interested in this. I see Polar plugin has a method that redirects the user to the Polar's customer portal, but I cannot see it for the Stripe plugin.
nikatune
nikatune2mo ago
I already created a PR for this
nikatune
nikatune2mo ago
GitHub
feat(stripe) : add billing portal session endpoint by rhitune2 · P...
add createBillingPortalSession endpoint to stripe plugin tests passed Summary by cubic Added a new endpoint to the Stripe plugin for creating billing portal sessions, allowing users to manage sub...
nikatune
nikatune2mo ago
const { data } = await client.subscription.billingPortal({
returnUrl: "/dashboard", // optional, defaults to "/"
referenceId: "org_123" // optional, defaults to userId
});

if (data?.url) {
// Redirect user to the billing portal
window.location.href = data.url;
}
const { data } = await client.subscription.billingPortal({
returnUrl: "/dashboard", // optional, defaults to "/"
referenceId: "org_123" // optional, defaults to userId
});

if (data?.url) {
// Redirect user to the billing portal
window.location.href = data.url;
}
you can track it from here

Did you find this page helpful?