Hanzo
OpenapiBilling

End a subscription

Ends a subscription. It cancels at the END OF THE PAID PERIOD by default, because a customer who cancels has already paid for the period they are in and…

POST /v1/billing/subscriptions/{id}/cancel

Addresshttps://api.hanzo.ai/v1/billing/subscriptions/{id}/cancel
MethodPOST
OperationcancelSubscription
AuthAuthorization: Bearer $HANZO_API_KEY

Ends a subscription.

It cancels at the END OF THE PAID PERIOD by default, because a customer who cancels has already paid for the period they are in and taking it away is taking money for nothing. atPeriodEnd: false ends it at once, which is the caller asking for that.

A subscription from another org is not found rather than refused, so an id cannot be probed for existence.

A named handler, not a closure, so zipdoc can lift this prose into the registry.

Request

3 fields, body application/json (required).

FieldInTypeRequiredDescription
idpathstringyes
atPeriodEndbodybooleanAtPeriodEnd cancels at the end of the paid period rather than at once.
idbodystring

Response

StatusBodyMeaning
200Subscriptionok

200 body — 23 fields.

FieldInTypeAlwaysDescription
cancelAtPeriodEndbodyboolean
canceledAtbodystring
createdAtbodystring
currentPeriodEndbodystring
currentPeriodStartbodystring
defaultPaymentMethodbodystring
endedAtbodystring
idbodystring
mrrCentsbodyintegerMRRCents is what this subscription contributes per month — commerce's own figure, interval-normalized and multiplied by its seats, so no reader re-derives it…
planbodySubscriptionPlan
plan.currencybodystring
plan.idbodystring
plan.intervalbodystring
plan.namebodystring
plan.pricebodyinteger
planIdbodystring
providerTypebodystring
quantitybodyinteger
statusbodystring
trialEndbodystring
trialStartbodystring
updatedAtbodystring
userIdbodystring

Failure carries the platform error shape — see Errors.

Examples

hanzo billing subscriptions cancel <id>

Billing API · All Hanzo APIs · Interactive reference

How is this guide?

On this page