Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions api-reference/openapi/accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,77 @@
}
}
},
"/api/stripe/portal": {
"post": {
"servers": [
{
"url": "https://api.recoupable.com"
}
],
"description": "Create a Stripe billing portal session for the authenticated account. The account must have an active Stripe subscription. Returns a Stripe-hosted portal URL that the client should redirect the user to, allowing them to manage their subscription, update payment methods, or cancel.",
"security": [
{
"apiKeyAuth": []
},
{
"bearerAuth": []
}
],
"requestBody": {
"description": "Billing portal session parameters",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateStripePortalRequest"
}
}
}
},
"responses": {
"200": {
"description": "Billing portal session created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateStripePortalResponse"
}
}
}
},
"400": {
"description": "Bad request — missing or invalid parameters, or no active subscription found for the account",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized — invalid or missing authentication",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountErrorResponse"
}
}
}
},
"403": {
"description": "Forbidden - account override not permitted",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountErrorResponse"
}
}
}
}
}
}
},
"/api/workspaces": {
"post": {
"description": "Create a new workspace account. Workspaces can optionally be linked to an organization.",
Expand Down Expand Up @@ -2934,6 +3005,53 @@
"example": "Verified"
}
}
},
"CreateStripePortalRequest": {
"type": "object",
"required": [
"returnUrl"
],
"properties": {
"returnUrl": {
"type": "string",
"format": "uri",
"description": "The URL to redirect the user to after they leave the billing portal.",
"example": "https://chat.recoupable.com/settings"
},
"accountId": {
"type": "string",
"format": "uuid",
"description": "Filter to a specific account. Only applicable when the authenticated account has access to multiple accounts via organization membership; if not provided, the API key's own account is used.",
"example": "123e4567-e89b-12d3-a456-426614174000"
}
}
},
"CreateStripePortalResponse": {
"type": "object",
"description": "A Stripe billing portal session. For the full list of available properties, see the [Stripe Billing Portal Session API documentation](https://docs.stripe.com/api/customer_portal/sessions/object).",
"required": [
"id",
"url"
],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the Stripe billing portal session.",
"example": "bps_test_a1b2c3d4e5f6g7h8i9j0"
},
"url": {
"type": "string",
"format": "uri",
"description": "The Stripe-hosted billing portal URL. Redirect the user to this URL to manage their subscription.",
"example": "https://billing.stripe.com/session/bps_test_a1b2c3d4e5f6g7h8i9j0"
},
"return_url": {
"type": "string",
"format": "uri",
"description": "The URL the user will be redirected to after leaving the billing portal.",
"example": "https://chat.recoupable.com/settings"
}
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions api-reference/stripe/portal-create.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 'Create Billing Portal Session'
openapi: '/api-reference/openapi/accounts.json POST /api/stripe/portal'
---
6 changes: 6 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@
"api-reference/subscriptions/get"
]
},
{
"group": "Stripe",
"pages": [
"api-reference/stripe/portal-create"
]
},
{
"group": "Admins",
"pages": [
Expand Down