Billing API

Manage subscriptions, invoices, and payment methods.

Create Checkout Session

POST/api/checkout/sessions

Create a checkout session for hosted payment flows, custom domains, or manual invoicing. This endpoint automatically resolves organizationId via custom domains when available.

json

Response (201 Created)

json

Retrieve Checkout Session

GET/api/checkout/sessions/:sessionId

Fetch the latest status. When the request is authenticated and the user is a super admin you can inspect any session; otherwise the session must belong to the resolved organization.

json

Update Checkout Session

PATCH/api/checkout/sessions/:sessionId

Mark a session as completed, failed, or requiring further action. Requests must include X-Authcore-Signature with the value from AUTHCORE_CHECKOUT_SECRET, unless the caller is a super admin.

json

List Payment Providers

GET/api/checkout/sessions

Returns the registered payment adapters so your frontend can render the correct options. Custom adapters can be registered at runtime via registerPaymentProvider.

json

Get Current Subscription

GET/api/organizations/:orgId/subscription

Get active subscription details. Requires admin role.

Response (200 OK)

json

Create Subscription

POST/api/organizations/:orgId/subscription

Subscribe to a plan. Requires admin role and payment method.

Request Body

json

Response (201 Created)

json

Update Subscription

PATCH/api/organizations/:orgId/subscription

Change subscription plan or interval. Requires admin role.

Request Body

json

Response (200 OK)

json

Cancel Subscription

DELETE/api/organizations/:orgId/subscription

Cancel at end of billing period. Requires admin role.

Query Parameters

bash

Response (200 OK)

json

List Invoices

GET/api/organizations/:orgId/invoices

Get billing history. Requires admin role.

Query Parameters

bash

Response (200 OK)

json

Get Invoice

GET/api/organizations/:orgId/invoices/:invoiceId

Get specific invoice details. Requires admin role.

Response (200 OK)

json

List Payment Methods

GET/api/organizations/:orgId/payment-methods

Get saved payment methods. Requires admin role.

Response (200 OK)

json

Add Payment Method

POST/api/organizations/:orgId/payment-methods

Add new payment method. Requires admin role.

Request Body

json

Response (201 Created)

json

Delete Payment Method

DELETE/api/organizations/:orgId/payment-methods/:pmId

Remove payment method. Requires admin role.

Response (200 OK)

json

Get Usage Statistics

GET/api/organizations/:orgId/usage

Get current billing period usage. Requires admin role.

Response (200 OK)

json

Related