Moonborn — API · billing
Create a Stripe Checkout session for new subscriptions
Stripe Checkout handles PAN entry + 3-D Secure + tax + receipt — Moonborn never sees the PAN. Persistence happens via `customer.subscription.created` webhook, idempotent on the Stripe event id.
POST/v1/billing/checkoutscope · Bearer (API key or session JWT)
Request body
| Field | Type | Description |
|---|---|---|
| planTierreq | string · "free" | "pro" | "team" | "enterprise" | |
| intervalreq | string · "month" | "year" | |
| stripePriceId | string | |
| successUrlreq | string | |
| cancelUrlreq | string |
Responses
201Checkout session created
Body
| Field | Type | Description |
|---|---|---|
| checkoutSessionIdreq | string | |
| urlreq | string | |
| expiresAtreq | string |
401Unauthenticated
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
409Org already has an active subscription
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
422Validation error
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
Examples
cURL
curl -X POST https://api.moonborn.co/v1/billing/checkout \
-H "Authorization: Bearer $MOONBORN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"planTier": "free",
"interval": "month",
"successUrl": "<string>",
"cancelUrl": "<string>"
}'TypeScript
import Moonborn from '@moonborn/sdk';
const client = new Moonborn({ apiKey: process.env.MOONBORN_API_KEY });
const result = await client.billing.createCheckoutSession({
planTier: "free",
interval: "month",
successUrl: "<string>",
cancelUrl: "<string>",
});Python
import os
from moonborn import Moonborn
client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])
result = client.billing.create_checkout_session(
plan_tier="free",
interval="month",
success_url="<string>",
cancel_url="<string>",
)