Uygulamayı aç
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
FieldTypeDescription
planTierreqstring · "free" | "pro" | "team" | "enterprise"
intervalreqstring · "month" | "year"
stripePriceIdstring
successUrlreqstring
cancelUrlreqstring

Responses

201Checkout session created
Body
FieldTypeDescription
checkoutSessionIdreqstring
urlreqstring
expiresAtreqstring
401Unauthenticated
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
409Org already has an active subscription
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
422Validation error
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring

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>",
)