Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent
with a free APIs.io key —
sign in with
GitHub,
Google or
LinkedIn.
No form to fill in; signing in shares your email address with us (Privacy).
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: V³ News API v3 Billing API
version: 0.1.0
tags:
- name: Billing
paths:
/billing/checkout:
post:
tags:
- Billing
summary: Create Checkout Session
description: 'Create a Stripe Checkout Session for the calling member.
Lazy-creates the Stripe Customer on first checkout (stashed
on members.stripe_customer_id). Returns the hosted
checkout URL for the frontend to redirect to.'
operationId: create_checkout_session_billing_checkout_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CheckoutRequest'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/CheckoutResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/billing/portal:
post:
tags:
- Billing
summary: Create Portal Session
description: 'Create a Customer Portal Session — Stripe-hosted UI where
the member can manage their subscription (cancel, swap plan,
update payment method).
Robust to a missing ``members.stripe_customer_id`` column:
if the member row doesn''t have one but a subscription row
does, look it up from member_subscriptions and backfill the
member row. This happens when an earlier checkout-flow bug
left the column NULL even though the subscription exists
(e.g. our first paying member during the webhook saga).'
operationId: create_portal_session_billing_portal_post
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PortalResponse'
/billing/subscription:
get:
tags:
- Billing
summary: Get Subscription
description: 'Return the calling member''s current subscription state.
The frontend useSubscription() hook calls this once per
session; gating decisions on the client all derive from this
one response.
Pass ``?debug=1`` to include a diagnostic block:
• calling member''s id + stripe_customer_id
• all subscription rows for THIS member
• most recent global subscription row + its member link
• whether the subscription metadata member_id matches THIS
member (the most common mismatch when is_active=false)
The debug block is only shown to authenticated callers and
only contains the caller''s own data + a single anonymised
global comparison row, so there''s no PII leak risk.'
operationId: get_subscription_billing_subscription_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/billing/webhook:
post:
tags:
- Billing
summary: Stripe Webhook
description: 'Stripe webhook receiver. Public endpoint; auth via the
Stripe-Signature header (HMAC-SHA256 over the raw body
using our webhook secret).
Idempotency: every received event is INSERT … ON CONFLICT
(stripe_event_id) DO NOTHING into stripe_webhook_events.
Duplicate deliveries from Stripe become no-op INSERTs and
we return 200 without re-running the handler.
On handler failure we still return 200 (so Stripe doesn''t
retry on logic bugs — we''d rather investigate via the
processed_at / processing_error columns than have Stripe
spam the handler). True transient failures (DB connection
drop, etc.) come back as 500 from FastAPI and Stripe will
retry naturally.'
operationId: stripe_webhook_billing_webhook_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/billing/admin/replay-errored:
post:
tags:
- Billing
summary: Replay Errored Webhooks
description: 'Re-dispatch every webhook event whose audit row has a
non-null ``processing_error``. Uses the stored ``payload``
column — no Stripe Dashboard resend required.
Auth: V3_ADMIN_API_KEY in the X-Admin-Key header. Same admin-
bypass model used by /events POST/PATCH and /changelog writes.
Returns a per-event result list so the caller can see exactly
which replays succeeded and which still errored. Idempotent
by design — running it twice produces the same final state
(successful replays clear processing_error; failed replays
just rewrite the same error column).'
operationId: replay_errored_webhooks_billing_admin_replay_errored_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
components:
schemas:
PortalResponse:
properties:
portal_url:
type: string
title: Portal Url
type: object
required:
- portal_url
title: PortalResponse
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
CheckoutResponse:
properties:
checkout_url:
type: string
title: Checkout Url
type: object
required:
- checkout_url
title: CheckoutResponse
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
CheckoutRequest:
properties:
plan_period:
type: string
enum:
- monthly
- annual
title: Plan Period
currency:
type: string
enum:
- usd
- cad
title: Currency
default: usd
type: object
required:
- plan_period
title: CheckoutRequest