Skip to content
Merged
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
91 changes: 90 additions & 1 deletion api-reference/openapi/accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,81 @@
}
}
},
"/api/subscriptions/card-on-file": {
"post": {
"description": "Create a $0 card-on-file checkout session for the authenticated account. Stripe `setup` mode saves a payment method without charging anything or starting a subscription, so an account that later runs out of credits can be auto-recharged instead of dead-ending. Returns a hosted checkout URL that the client should redirect to.",
"security": [
{
"apiKeyAuth": []
},
{
"bearerAuth": []
}
],
"requestBody": {
"description": "Card-on-file session parameters",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateCardOnFileSessionRequest"
}
}
}
},
"responses": {
"200": {
"description": "Card-on-file session created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateSubscriptionSessionResponse"
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
}
}
}
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"400": {
"description": "Bad request - missing or invalid parameters",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SubscriptionSessionErrorResponse"
},
"example": {
"error": "successUrl must be a valid URL"
}
}
}
},
"401": {
"description": "Unauthorized - invalid or missing authentication",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SubscriptionSessionErrorResponse"
},
"example": {
"error": "Exactly one of x-api-key or Authorization must be provided"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SubscriptionSessionErrorResponse"
},
"example": {
"error": "Internal server error"
}
}
}
}
}
}
},
"/api/accounts/{id}/subscription": {
"get": {
"description": "Retrieve the subscription for an account, directly or via an organization.",
Expand Down Expand Up @@ -4221,6 +4296,20 @@
}
}
},
"CreateCardOnFileSessionRequest": {
"type": "object",
"required": [
"successUrl"
],
"properties": {
"successUrl": {
"type": "string",
"format": "uri",
"description": "The URL Stripe redirects to after the card is saved.",
"example": "https://chat.recoupable.dev?card=saved"
}
}
},
"CreateSubscriptionSessionResponse": {
"type": "object",
"required": [
Expand All @@ -4236,7 +4325,7 @@
"url": {
"type": "string",
"format": "uri",
"description": "The hosted checkout URL. Redirect to this URL to complete the payment.",
"description": "The hosted checkout URL. Redirect to this URL to complete Checkout.",
"example": "https://checkout.stripe.com/pay/cs_test_a1b2c3d4e5f6g7h8i9j0"
}
}
Expand Down
4 changes: 4 additions & 0 deletions api-reference/subscriptions/card-on-file-create.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 'Create Card On File Session'
openapi: '/api-reference/openapi/accounts.json POST /api/subscriptions/card-on-file'
---
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"group": "Billing",
"pages": [
"api-reference/subscriptions/sessions-create",
"api-reference/subscriptions/card-on-file-create",
"api-reference/subscriptions/portal-create",
"api-reference/accounts/subscription-get",
"api-reference/credits/sessions-create",
Expand Down