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

Top up balance

Top up a subscription's balance. Charges the customer's payment method for the specified amount.

POST
/subscriptions/{id}/balance/topup

Top up a subscription's balance. Charges the customer's payment method for the specified amount.

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.

amount*integer

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/subscriptions/string/balance/topup" \  -H "Content-Type: application/json" \  -d '{    "amount": 1  }'
{  "success": true,  "data": {    "amount": -9007199254740991,    "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"  }}

Preview plan change POST

Preview proration details for an immediate plan change (an upgrade or a longer interval) without applying it. Returns credit, charge, and net amount. Downgrades — a cheaper plan in the same group, or a shorter interval — are scheduled for the end of the current period instead of being prorated, so they return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint.

Revert scheduled cancellation POST

Revert a scheduled cancellation. Only works when canceledAt is set but status is not yet 'canceled'.