Commet
  • Pricing
Log InTry out
Adjust balance POSTCancel subscription POSTChange plan POSTCreate a recovery payment link for a past due subscription POSTCreate subscription POSTGet active subscription GETGet subscription by ID GETList subscriptions GETPreview plan change POSTReactivate a past due or canceled subscription POSTTop up balance POSTRevert scheduled cancellation POSTUpdate payment method POST
DocumentationKnowledge BaseBuild with AIAPI ReferenceWebhooks

Create subscription

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

POST
/subscriptions

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

Authorization

ApiKeyAuth
x-api-key<token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

planId?string
planCode?string
customerId*string
billingInterval?|null
initialSeats?
skipTrial*boolean
introOffer?
name?string
startDate?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" \  -H "Content-Type: application/json" \  -d '{    "customerId": "string",    "skipTrial": false  }'
{  "success": true,  "data": {    "id": "string",    "customerId": "string",    "plan": {      "id": "string",      "name": "string",      "basePrice": 0    },    "name": "string",    "description": "string",    "status": "draft",    "billingInterval": "weekly",    "consumptionModel": "metered",    "trialEndsAt": "2019-08-24T14:15:22Z",    "currentPeriod": {      "start": "2019-08-24T14:15:22Z",      "end": "2019-08-24T14:15:22Z",      "daysRemaining": 0    },    "features": [      {        "code": "string",        "name": "string",        "type": "boolean",        "enabled": true,        "usage": {          "current": 0,          "included": 0,          "overageQuantity": 0,          "overageUnitPrice": 0        }      }    ],    "credits": {      "remaining": 0,      "included": 0,      "purchased": 0    },    "balance": {      "remaining": 0,      "included": 0,      "currency": "string"    },    "cancellation": {      "scheduledAt": "2019-08-24T14:15:22Z",      "reason": "string",      "effectiveAt": "2019-08-24T14:15:22Z"    },    "cancelAtPeriodEnd": true,    "scheduledPlanChange": {      "changeType": "plan_downgrade",      "newPlanId": "string",      "newPlanName": "string",      "newBillingInterval": "string",      "scheduledFor": "2019-08-24T14:15:22Z"    },    "discount": {      "type": "percentage",      "value": 0,      "name": "string",      "endsAt": "2019-08-24T14:15:22Z"    },    "startDate": "2019-08-24T14:15:22Z",    "endDate": "2019-08-24T14:15:22Z",    "billingDayOfMonth": -9007199254740991,    "nextBillingDate": "2019-08-24T14:15:22Z",    "checkoutUrl": "string",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "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"  }}

Create a recovery payment link for a past due subscription POST

Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due.

Get active subscription GET

Get the active subscription for a customer. Returns null if none.