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
122 changes: 122 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/session/status": {
"post": {
"servers": [
{
"url": "https://api.recoupable.com"
}
],
"description": "Confirm that a Stripe checkout session has been processed and credits have been applied. Updates the session metadata with a `credit_updated` marker. Should be called once after a successful checkout redirect to trigger credit provisioning for the account.",
"security": [
{
"apiKeyAuth": []
},
{
"bearerAuth": []
}
],
"requestBody": {
"description": "Session confirmation parameters",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ConfirmStripeSessionRequest"
}
}
}
},
"responses": {
"200": {
"description": "Session confirmed and credit metadata updated successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StripeSessionStatusResponse"
}
}
}
},
"400": {
"description": "Bad request — missing `sessionId` or Stripe API error",
"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,57 @@
"example": "Verified"
}
}
},
"ConfirmStripeSessionRequest": {
"type": "object",
"required": [
"sessionId"
],
"properties": {
"sessionId": {
"type": "string",
"description": "The Stripe checkout session ID to confirm (e.g. `cs_test_...`).",
"example": "cs_test_a1b2c3d4e5f6g7h8i9j0"
},
"accountId": {
"type": "string",
"format": "uuid",
"description": "Used for authorization scoping when the API key has access to multiple accounts via organization membership. Must match the account already associated with the session via `metadata.accountId`. If not provided, the API key's own account is used.",
"example": "123e4567-e89b-12d3-a456-426614174000"
}
}
},
"StripeSessionStatusResponse": {
"type": "object",
"description": "The updated Stripe checkout session object. For the full list of available properties, see the [Stripe Checkout Session API documentation](https://docs.stripe.com/api/checkout/sessions/object).",
"required": [
"id",
"status"
],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the Stripe checkout session.",
"example": "cs_test_a1b2c3d4e5f6g7h8i9j0"
},
"status": {
"type": "string",
"enum": ["open", "complete", "expired"],
"description": "Current status of the checkout session.",
"example": "complete"
},
"metadata": {
"type": "object",
"description": "Session metadata, including `credit_updated` once this endpoint has been called.",
"additionalProperties": {
"type": "string"
},
"example": {
"accountId": "123e4567-e89b-12d3-a456-426614174000",
"credit_updated": "credit_updated"
}
}
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions api-reference/stripe/session-status.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 'Confirm Stripe Session'
openapi: '/api-reference/openapi/accounts.json POST /api/stripe/session/status'
---
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/session-status"
]
},
{
"group": "Admins",
"pages": [
Expand Down