v1

latestOpenAPI 3.1.02026-07-24770322.0 KB

Create Subscription

This API endpoint creates a subscription. A subscription is used to bill clients on a recurring basis.

post/v1/subscriptions

Request body

templateIdstring

Unique ID of the invoice template to use. If provided, template values will be used for lineItems, memo, taxPercentage, and currency

recipientIdstring

Deprecated in favor of clientId and companyId.

memostring

Arbitrary string attached to the invoice, often used for display

daysUntilDueinteger required

The number of days from when the subscription invoice is created until it is due. Max value is 30.

taxPercentagenumber float

Tax percentage to apply to the invoice amount

intervalstring

Billing frequency. Required if line items don't include a recurring price. Values: day, week, month, quarterly, yearly

intervalCountinteger

Number of intervals between billings. Default value = 1

collectionMethodstring required

Specify how to charge for an invoice values: sendInvoice , chargeAutomatically

clientIdstring

The ID of the client this subscription is assigned to. Leave empty if assigning to a company.

companyIdstring

The ID of the company this subscription is assigned to. This is required when assigning to a client with more than one company.

Response

200

idstring
objectstring
createdAtstring
collectionMethodstring
statusstring
recipientIdstring
clientIdstring
companyIdstring
memostring
taxPercentagenumber
currencystring
intervalstring
intervalCountinteger
daysUntilDueinteger
canceledAtstring
updatedAtstring

Example response

{
  "id": "sub_01HN4V8K5P7RNQJ6MGXKDZ8T2W",
  "object": "subscription",
  "createdAt": "2024-02-21T15:31:16.789Z",
  "collectionMethod": "sendInvoice",
  "status": "active",
  "recipientId": "441424f5-2d9a-494f-b3d6-5e596a235e5a",
  "clientId": "441424f5-2d9a-494f-b3d6-5e596a235e5a",
  "companyId": "441424f5-2d9a-494f-b3d6-5e596a235e5a",
  "memo": "Enterprise subscription with support",
  "taxPercentage": 8.5,
  "currency": "USD",
  "interval": "month",
  "intervalCount": 1,
  "daysUntilDue": 30,
  "canceledAt": "null-date",
  "paymentMethodPreferences": [
    {
      "type": "creditCard"
    }
  ],
  "lineItems": [
    {
      "priceId": "ZC9UiqQSR",
      "productId": "d0000000-d7a5-473d-a75b-9821a8f4e191",
      "description": "Enterprise Plan",
      "quantity": 1
    }
  ]
}