Needs keys Creates a Stripe customer portal session where the user can manage cards and see Stripe invoices. Needs STRIPE_SECRET_KEY. Without it, the mock returns a dashboard URL. Admin only.
Request#
This endpoint takes no path, query or body parameters.
Example request#
curl -X POST https://api.tried.com.au/billing/portal \
-H "Authorization: Bearer $TRIED_API_KEY"const res = await fetch("https://api.tried.com.au/billing/portal", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.TRIED_API_KEY}` },
});
const portal = await res.json();import os, requests
res = requests.post(
"https://api.tried.com.au/billing/portal",
headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
)
portal = res.json()Response#
200 OK
With Stripe:
{
"mock": false,
"provider": "stripe",
"url": "https://billing.stripe.com/p/session/live_YWNjdF8xUXhZ"
}In mock mode:
{
"mock": true,
"provider": "mock",
"url": "https://app.tried.com.au/billing?portal=mock"
}Redirect the user to url. The portal returns them to /billing on the dashboard.
Errors#
| Status | When |
|---|---|
401 |
Missing or invalid API key. |
403 |
The key's IP allowlist or scopes reject the request. This route needs the admin scope. A dashboard user without the right role gets Requires role: admin. API keys act as admin. |
429 |
Rate limit exceeded. See Rate limits. |
500 |
Stripe rejected the request. Outside production the message is Stripe's error text. |
See Errors for the body format.