Commet
  • Precios
Iniciar SesiónRegistrarse
Adjust balance POSTCancel subscription POSTChange plan POSTCreate subscription POSTGet active subscription GETGet subscription by ID GETList subscriptions GETPreview plan change POSTTop up balance POSTRevert scheduled cancellation POST
DocumentaciónRecursosConstruir con AIAPI ReferenceWebhooks

Change plan

Upgrade, downgrade, or change billing interval.

POST
/subscriptions/{id}/change-plan

Upgrade, downgrade, or change billing interval.

Authorization

ApiKeyAuth
x-api-key<token>

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

newPlanId?string
newBillingInterval?string
successUrl?string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/subscriptions/string/change-plan" \  -H "Content-Type: application/json" \  -d '{}'
{  "success": true,  "data": {    "requiresCheckout": true,    "checkoutUrl": "string",    "id": "string",    "scheduled": true,    "scheduledFor": "2019-08-24T14:15:22Z",    "changeType": "subscription.plan_downgrade",    "customerId": "string",    "newPlanId": "string",    "newPlanName": "string",    "newBillingInterval": "string",    "previousPlan": {      "id": "string",      "name": "string"    },    "currentPlan": {      "id": "string",      "name": "string",      "price": -9007199254740991    },    "billingInterval": "string",    "billing": {      "credit": -9007199254740991,      "creditsApplied": -9007199254740991,      "charge": -9007199254740991,      "taxAmount": -9007199254740991,      "netAmount": -9007199254740991,      "totalCharged": -9007199254740991,      "remainingCreditBalance": -9007199254740991    },    "invoiceId": "string",    "object": "subscription",    "livemode": true  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "success": false,  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}

Cancel subscription POST

Cancel immediately or at period end.

Create subscription POST

Create a subscription for a customer. Requires planId or planCode plus customerId.