Put a canceled subscription back on its plan
Puts a canceled subscription back on its plan.
POST /v1/billing/subscriptions/{id}/reactivate
| Address | https://api.hanzo.ai/v1/billing/subscriptions/{id}/reactivate |
| Method | POST |
| Operation | reactivateSubscription |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Puts a canceled subscription back on its plan.
What asks for this is usually a recovered payment method or a support tool rather than a browser, which is most of the argument for it having an address at all. The engine decides whether the move is legal; a row it will not reactivate comes back with its own reason.
A named handler, not a closure, so zipdoc can lift this prose into the registry.
Request
3 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | |
atPeriodEnd | body | boolean | — | AtPeriodEnd cancels at the end of the paid period rather than at once. |
id | body | string | — |
Response
| Status | Body | Meaning |
|---|---|---|
200 | Subscription | ok |
200 body — 23 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
cancelAtPeriodEnd | body | boolean | — | |
canceledAt | body | string | — | |
createdAt | body | string | — | |
currentPeriodEnd | body | string | — | |
currentPeriodStart | body | string | — | |
defaultPaymentMethod | body | string | — | |
endedAt | body | string | — | |
id | body | string | — | |
mrrCents | body | integer | — | MRRCents is what this subscription contributes per month — commerce's own figure, interval-normalized and multiplied by its seats, so no reader re-derives it… |
plan | body | SubscriptionPlan | — | |
plan.currency | body | string | — | |
plan.id | body | string | — | |
plan.interval | body | string | — | |
plan.name | body | string | — | |
plan.price | body | integer | — | |
planId | body | string | — | |
providerType | body | string | — | |
quantity | body | integer | — | |
status | body | string | — | |
trialEnd | body | string | — | |
trialStart | body | string | — | |
updatedAt | body | string | — | |
userId | body | string | — |
Failure carries the platform error shape — see Errors.
Examples
hanzo billing subscriptions reactivate <id>import { Configuration, BillingApi } from 'hanzoai';
const api = new BillingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.reactivateSubscription({ id: 'id', atPeriodEnd: false, id: "<id>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import BillingApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = BillingApi(client).reactivate_subscription(id='id', at_period_end=False, id="<id>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.BillingAPI.ReactivateSubscription(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, billing_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = billing_api::reactivate_subscription(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.BillingApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new BillingApi(client).reactivateSubscription();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl -X POST https://api.hanzo.ai/v1/billing/subscriptions/<id>/reactivate \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"atPeriodEnd": false,
"id": "<id>"
}'The door reaches billing through the billing tool, which names its 9 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "get_billing_balance"
}
}
}'How is this guide?