Uygulamayı aç
Moonborn — API · billing

Cancel the subscription (immediately or at period end)

Default is `cancelAtPeriodEnd=true`: paid features remain until `currentPeriodEnd`. `cancelImmediately=true` revokes access immediately and prorates the unused portion (subject to plan).

DELETE/v1/billing/subscriptionscope · Bearer (API key or session JWT)
Request body
FieldTypeDescription
cancelImmediatelyboolean
reasonstring · "too_expensive" | "missing_features" | "switched_provider" | "unused" | "other"
feedbackstring

Responses

200OK
Body
FieldTypeDescription
subscriptionIdreqstring
orgIdreqstring
planTierreqstring · "free" | "pro" | "team" | "enterprise"
statusreqstring · "trialing" | "active" | "past_due" | "canceled" | "incomplete" | "unpaid"
intervalreqstring · "month" | "year"
currencyreqstring
recurringAmountMinorreqnumber
trialEndsAtreqstring
currentPeriodStartreqstring
currentPeriodEndreqstring
cancelAtPeriodEndreqboolean
createdAtreqstring
updatedAtreqstring
401Unauthenticated
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
404No active subscription
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
409Subscription already canceled
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
422Validation error
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring

Examples

cURL
curl -X DELETE https://api.moonborn.co/v1/billing/subscription \
  -H "Authorization: Bearer $MOONBORN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "cancelImmediately": false,
      "reason": "too_expensive",
      "feedback": "<string>"
    }'
TypeScript
import Moonborn from '@moonborn/sdk';

const client = new Moonborn({ apiKey: process.env.MOONBORN_API_KEY });

const result = await client.billing.cancelSubscription({
  cancelImmediately: false,
  reason: "too_expensive",
  feedback: "<string>",
});
Python
import os
from moonborn import Moonborn

client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])

result = client.billing.cancel_subscription(
    cancel_immediately=False,
    reason="too_expensive",
    feedback="<string>",
)