Skip to content
einvoicing.dev

API/Billing

Start a subscription

POST/v1/billing/checkout-sessions· API key

Returns a link to a Stripe-hosted checkout page for the chosen plan. Open it in a browser; the CLI's einvoicing upgrade does this for you. The plan changes when Stripe confirms payment. Watch GET /v1/account. An account that already has a subscription manages it through a portal session instead (409).

Request
curl -X POST https://api.einvoicing.dev/v1/billing/checkout-sessions \  -H "Authorization: Bearer $EINVOICING_API_KEY" \  -H "Content-Type: application/json" \  -d '{ "plan": "developer" }'

Request body

application/json· required

FieldTypeDescription
planrequiredstringThe paid plan to start.

developerpro

Example bodyapplication/json
{  "plan": "developer"}

Response

201

A checkout page was created. The link expires at expires_at.

FieldTypeDescription
datarequiredBillingSessionA link to a Stripe-hosted billing page.
Example responseapplication/json
{  "data": {    "url": "https://checkout.stripe.com/c/pay/cs_live_a1B2c3D4",    "expires_at": "2026-09-12T14:05:02.117Z"  }}

Errors

Every error is application/problem+json (RFC 9457). Branch on type, which is stable, never on title or detail.

StatusWhen
400

The body could not be parsed as the XML or JSON its Content-Type declares. Distinct from 422, which means the body parsed and its contents were rejected. Problem type is malformed-body.

/problems/malformed-body

401

No key, or a key that is unknown or revoked. Problem type is unauthenticated.

/problems/unauthenticated

403

A test key cannot manage keys or billing. Use a live key. Problem type is live-key-required.

409

The account already has a subscription. Create a portal session to change it. Problem type is already-subscribed.

/problems/already-subscribed

422

The body parsed and was rejected. Includes unknown fields, which are refused rather than silently dropped. Problem type is invalid-request.

429

Too many requests in a short window. Slow down and retry after the number of seconds in Retry-After. Problem type is rate-limited.

/problems/rate-limited

Schemas

CheckoutSessionRequest

The plan to subscribe to.

FieldTypeDescription
planrequiredstringThe paid plan to start.

developerpro

BillingSession

A link to a Stripe-hosted billing page.

FieldTypeDescription
urlrequiredstring · uriOpen this in a browser.
expires_atrequiredstring or null · date-timeWhen the link stops working, if Stripe says.