Sourced
llms.txt
View Markdown

Billing ยท version 0.1.0

Create a checkout session

POST/api/billing/checkout

Request

cURL
curl -X POST 'https://sourced.sh/api/billing/checkout' \
  -H 'Authorization: Bearer $SOURCED_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{}'
TypeScript
const response = await fetch("https://sourced.sh/api/billing/checkout", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SOURCED_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});
const data = await response.json();
Python
import os
import requests

response = requests.request(
    "POST",
    "https://sourced.sh/api/billing/checkout",
    headers={"Authorization": f"Bearer {os.environ['SOURCED_API_KEY']}"},
    json={},
)
data = response.json()

Request body

Required.

application/json

Schema
type: object
required: plan
properties:
  plan (required): string enum launch | scale
  successUrl: string
  cancelUrl: string

Responses

200

Hosted checkout URL.

application/json

Schema
type: object
required: url
properties:
  url (required): string

400

The requested plan or checkout request is invalid.

application/json

Schema
Error:
  type: object
  required: error
  properties:
    error (required): string
      Stable machine-readable error code.
    message: string
      Optional human-readable description.

401

403

409

The workspace already has a non-terminal Stripe subscription or is already on the requested active plan.

application/json

Schema
Error:
  type: object
  required: error
  properties:
    error (required): string
      Stable machine-readable error code.
    message: string
      Optional human-readable description.

423

Checkout is temporarily locked because live billing is not approved or live Stripe keys are not active in production.

application/json

Schema
Error:
  type: object
  required: error
  properties:
    error (required): string
      Stable machine-readable error code.
    message: string
      Optional human-readable description.

501

Stripe checkout is not configured for the selected plan.

application/json

Schema
Error:
  type: object
  required: error
  properties:
    error (required): string
      Stable machine-readable error code.
    message: string
      Optional human-readable description.

502

Stripe checkout could not be reached or returned an invalid response.

application/json

Schema
Error:
  type: object
  required: error
  properties:
    error (required): string
      Stable machine-readable error code.
    message: string
      Optional human-readable description.
Was this helpful?