@commet/node 9.6.0 → 9.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +51 -12
- package/dist/index.d.ts +51 -12
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -2
- package/dist/index.mjs.map +1 -1
- package/docs/ai-onboarding/commet-skill.md +1 -1
- package/docs/ai-onboarding/mcp-server.md +1 -1
- package/docs/api-reference/index.md +1 -1
- package/docs/api-reference/subscriptions.md +26 -1
- package/docs/documentation/better-auth.md +1 -8
- package/docs/documentation/customers/customer-portal.md +1 -7
- package/docs/documentation/customers/manage-customers.md +0 -6
- package/docs/documentation/error-handling.md +1 -1
- package/docs/documentation/finance/acceptable-use.md +1 -6
- package/docs/documentation/finance/finance-overview.md +0 -5
- package/docs/documentation/finance/local-currency-taxes.md +0 -6
- package/docs/documentation/finance/merchant-of-record.md +0 -7
- package/docs/documentation/finance/payouts-verification.md +0 -5
- package/docs/documentation/finance/payouts.md +0 -6
- package/docs/documentation/finance/supported-countries.md +1 -6
- package/docs/documentation/go/integrate-with-encore.md +1 -8
- package/docs/documentation/go/integrate-with-go.md +1 -8
- package/docs/documentation/invoicing/handle-failed-payments.md +3 -9
- package/docs/documentation/invoicing/invoices-and-billing-cycles.md +0 -6
- package/docs/documentation/java/integrate-with-java.md +1 -5
- package/docs/documentation/nodejs/integrate-with-astro.md +1 -8
- package/docs/documentation/nodejs/integrate-with-bun.md +1 -8
- package/docs/documentation/nodejs/integrate-with-express.md +1 -8
- package/docs/documentation/nodejs/integrate-with-hono.md +1 -8
- package/docs/documentation/nodejs/integrate-with-nextjs.md +1 -8
- package/docs/documentation/nodejs/integrate-with-nuxt.md +1 -8
- package/docs/documentation/nodejs/integrate-with-remix.md +1 -8
- package/docs/documentation/nodejs/integrate-with-sveltekit.md +1 -8
- package/docs/documentation/payments/accept-one-time-payments.md +0 -8
- package/docs/documentation/payments/payment-orchestration.md +0 -6
- package/docs/documentation/payments/payment-providers.md +0 -6
- package/docs/documentation/php/integrate-with-laravel.md +1 -8
- package/docs/documentation/php/integrate-with-php.md +1 -7
- package/docs/documentation/php/integrate-with-symfony.md +1 -8
- package/docs/documentation/plans/add-ons.md +0 -8
- package/docs/documentation/plans/configure-features.md +1 -8
- package/docs/documentation/plans/consumption-models.md +0 -7
- package/docs/documentation/plans/create-plans.md +0 -9
- package/docs/documentation/plans/credit-packs.md +0 -7
- package/docs/documentation/plans/one-time-payments.md +36 -7
- package/docs/documentation/plans/plan-groups.md +0 -6
- package/docs/documentation/python/integrate-with-django.md +1 -8
- package/docs/documentation/python/integrate-with-fastapi.md +1 -8
- package/docs/documentation/python/integrate-with-flask.md +1 -8
- package/docs/documentation/python/integrate-with-python.md +1 -8
- package/docs/documentation/sales/introductory-offers.md +1 -9
- package/docs/documentation/sales/offers.md +0 -8
- package/docs/documentation/sales/promo-codes.md +0 -7
- package/docs/documentation/sales/promotional-offers.md +0 -7
- package/docs/documentation/sales/regional-prices.md +0 -7
- package/docs/documentation/sales/trial-periods.md +0 -8
- package/docs/documentation/sdk-reference.md +1 -1
- package/docs/documentation/subscriptions/manage-subscriptions.md +2 -9
- package/docs/documentation/subscriptions/pay-in-advance.md +161 -0
- package/docs/documentation/subscriptions/plan-grants.md +0 -6
- package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +1 -7
- package/docs/documentation/testing-sandbox.md +1 -1
- package/docs/documentation/usage/ai-token-billing.md +0 -6
- package/docs/documentation/usage/quota-management.md +1 -7
- package/docs/documentation/usage/seat-management.md +1 -7
- package/docs/documentation/usage/track-usage.md +1 -7
- package/docs/knowledge-base/how-do-discounts-work.md +0 -8
- package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +1 -7
- package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +0 -6
- package/docs/knowledge-base/how-do-trial-periods-work.md +1 -8
- package/docs/knowledge-base/how-does-billing-work.md +1 -1
- package/docs/knowledge-base/how-does-quota-based-billing-work.md +1 -7
- package/docs/knowledge-base/how-does-seat-based-billing-work.md +1 -7
- package/docs/knowledge-base/how-is-proration-calculated-when-changing-plans.md +0 -6
- package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +0 -6
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +1 -7
- package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +1 -7
- package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +1 -7
- package/docs/manifest.json +8 -1
- package/docs/platform-documentation.md +1 -0
- package/docs/schemas.md +13 -4
- package/docs/webhooks/introduction.md +3 -3
- package/docs/webhooks.md +4 -4
- package/docs/webhooks.openapi.json +15 -5
- package/package.json +1 -1
|
@@ -79,10 +79,3 @@ curl https://commet.co/api/v1/credit-packs \
|
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
The `price` field is in **cents** (1000 = $10.00). Prices are always in USD.
|
|
82
|
-
|
|
83
|
-
## Related
|
|
84
|
-
|
|
85
|
-
- [Consumption Models](/docs/consumption-models) — How credits-based billing works
|
|
86
|
-
- [Manage Plans](/docs/create-plans) — Create plans with consumption models
|
|
87
|
-
- [Customer Portal](/docs/customer-portal) — Where customers purchase credit packs
|
|
88
|
-
- [Configure Features](/docs/configure-features) — Define credit costs per feature
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: One-Time Payments
|
|
3
|
-
description: Sell lifetime access or
|
|
3
|
+
description: Sell lifetime access, or a period of access that never renews, with a single payment.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Commet sells a one-time purchase in two ways:
|
|
7
|
+
|
|
8
|
+
| Option | Use it for | How |
|
|
9
|
+
| ---------------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------ |
|
|
10
|
+
| [Lifetime access](#create-a-one-time-subscription) | Access the customer keeps forever | A price with the `one_time` interval |
|
|
11
|
+
| [A period without renewal](#sell-a-period-without-renewal) | A month, a year, or several periods that end on their own | A recurring price with `cancelAtPeriodEnd: true` |
|
|
12
|
+
|
|
13
|
+
A one-time price charges the customer once at checkout and never bills again for the plan base. Use it for lifetime deals or any plan where recurring billing doesn't apply.
|
|
7
14
|
|
|
8
15
|
> **Note**
|
|
9
16
|
>
|
|
@@ -133,9 +140,31 @@ If there's no overage or additional charges at a billing cycle, no invoice is ge
|
|
|
133
140
|
|
|
134
141
|
In the [Customer Portal](/docs/customer-portal), one-time subscriptions display the interval as **Lifetime**. The cancel button is hidden since cancellation is not allowed. Customers can still change plans if the plan belongs to a [Plan Group](/docs/plan-groups).
|
|
135
142
|
|
|
136
|
-
##
|
|
143
|
+
## Sell a period without renewal
|
|
144
|
+
|
|
145
|
+
To sell a month, a year, or any period of access that ends on its own, create the subscription on a recurring price with `cancelAtPeriodEnd: true`. The customer pays once at checkout, and the subscription ends after the paid period without renewing with any payment method.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
curl -X POST https://commet.co/api/v1/subscriptions \
|
|
149
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
150
|
+
-H "commet-version: 2026-08-27" \
|
|
151
|
+
-H "Content-Type: application/json" \
|
|
152
|
+
-d '{"customerId":"user_123","planId":"pln_xxx","cancelAtPeriodEnd":true}'
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
To cover several periods in that payment, such as 6 months, add `prepaidPeriods`. [Pay in Advance](/docs/pay-in-advance) explains how each period is priced.
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
curl -X POST https://commet.co/api/v1/subscriptions \
|
|
159
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
160
|
+
-H "commet-version: 2026-08-27" \
|
|
161
|
+
-H "Content-Type: application/json" \
|
|
162
|
+
-d '{"customerId":"user_123","planId":"pln_xxx","prepaidPeriods":6,"cancelAtPeriodEnd":true}'
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- The cancellation is scheduled from creation: the response already shows `cancelAtPeriodEnd: true` and `cancellation` before the customer pays.
|
|
166
|
+
- The purchase keeps ending even if the customer saves a card through a payment method update link, and the Customer Portal doesn't offer **Keep subscription** for it.
|
|
167
|
+
- Free trials don't combine with it. An explicit trial (`customTrialDays`, a trial Offer, or a trial Promo Code) returns `400`, the plan's automatic introductory trial is skipped, and a trial Promo Code entered at checkout is rejected.
|
|
168
|
+
- When the purchase ends, Commet emits [`subscription.canceled`](/docs/webhooks/subscription-canceled).
|
|
137
169
|
|
|
138
|
-
|
|
139
|
-
- [Manage Subscriptions](/docs/manage-subscriptions) — Full subscription lifecycle
|
|
140
|
-
- [Invoices and Billing Cycles](/docs/invoices-and-billing-cycles) — How invoicing works
|
|
141
|
-
- [Consumption Models](/docs/consumption-models) — Metered, Credits, and Balance explained
|
|
170
|
+
To make it renew, [reverse the scheduled cancellation](/docs/manage-subscriptions#reverse-a-scheduled-cancellation) through the API with `POST /v1/subscriptions/{id}/uncancel`. If the customer paid with a method Commet can't charge again, such as OXXO, and has no saved card, the request returns `409 subscription_uncancel_failed`.
|
|
@@ -22,9 +22,3 @@ This order defines the upgrade path and display order in the Customer Portal.
|
|
|
22
22
|
## Learn more
|
|
23
23
|
|
|
24
24
|
- [What Happens When a Customer Changes Plans](/docs/what-happens-when-a-customer-changes-plans)
|
|
25
|
-
|
|
26
|
-
## Related
|
|
27
|
-
|
|
28
|
-
- [Manage Plans](/docs/create-plans) — Create plans to add to groups
|
|
29
|
-
- [Upgrade and Downgrade Plans](/docs/upgrade-and-downgrade-plans) — How plan changes work
|
|
30
|
-
- [Customer Portal](/docs/customer-portal) — Where customers change plans
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Integrate with Django
|
|
3
|
-
description: Add billing and payments to your Django application.
|
|
3
|
+
description: Add billing and payments to your Django application with the Commet SDK, including feature access checks and webhook verification.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Install the Commet Skill so your coding agent can integrate the current SDK and verify its work against the live API contract.
|
|
@@ -151,10 +151,3 @@ npx skills add commet-labs/skills --skill commet
|
|
|
151
151
|
path("billing/", include("billing.urls")),
|
|
152
152
|
]
|
|
153
153
|
```
|
|
154
|
-
|
|
155
|
-
## Related
|
|
156
|
-
|
|
157
|
-
- [Subscriptions](/docs/manage-subscriptions)
|
|
158
|
-
- [Track Usage](/docs/track-usage)
|
|
159
|
-
- [Customer Portal](/docs/customer-portal)
|
|
160
|
-
- [SDK Reference](/docs/sdk-reference)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Integrate with FastAPI
|
|
3
|
-
description: Add billing and payments to your FastAPI application.
|
|
3
|
+
description: Add billing and payments to your FastAPI application with the Commet SDK, including feature access checks and webhook verification.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Install the Commet Skill so your coding agent can integrate the current SDK and verify its work against the live API contract.
|
|
@@ -154,10 +154,3 @@ npx skills add commet-labs/skills --skill commet
|
|
|
154
154
|
```bash
|
|
155
155
|
uvicorn main:app --port 3000
|
|
156
156
|
```
|
|
157
|
-
|
|
158
|
-
## Related
|
|
159
|
-
|
|
160
|
-
- [Subscriptions](/docs/manage-subscriptions)
|
|
161
|
-
- [Track Usage](/docs/track-usage)
|
|
162
|
-
- [Customer Portal](/docs/customer-portal)
|
|
163
|
-
- [SDK Reference](/docs/sdk-reference)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Integrate with Flask
|
|
3
|
-
description: Add billing and payments to your Flask application.
|
|
3
|
+
description: Add billing and payments to your Flask application with the Commet SDK, using a Blueprint for billing routes and webhooks.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Install the Commet Skill so your coding agent can integrate the current SDK and verify its work against the live API contract.
|
|
@@ -143,10 +143,3 @@ npx skills add commet-labs/skills --skill commet
|
|
|
143
143
|
if __name__ == "__main__":
|
|
144
144
|
app.run(port=3000)
|
|
145
145
|
```
|
|
146
|
-
|
|
147
|
-
## Related
|
|
148
|
-
|
|
149
|
-
- [Subscriptions](/docs/manage-subscriptions)
|
|
150
|
-
- [Track Usage](/docs/track-usage)
|
|
151
|
-
- [Customer Portal](/docs/customer-portal)
|
|
152
|
-
- [SDK Reference](/docs/sdk-reference)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Integrate with Python
|
|
3
|
-
description:
|
|
3
|
+
description: Add billing and payments to your Python application with the Commet SDK, installed with pip, uv or poetry.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Install the Commet Skill so your coding agent can integrate the current SDK and verify its work against the live API contract.
|
|
@@ -80,10 +80,3 @@ npx skills add commet-labs/skills --skill commet
|
|
|
80
80
|
commet.feature_access.get(code="custom_branding", customer_id="user_123")
|
|
81
81
|
commet.seats.add(customer_id="user_123", feature_code="editor", count=3)
|
|
82
82
|
```
|
|
83
|
-
|
|
84
|
-
## Related
|
|
85
|
-
|
|
86
|
-
- [Flask](/docs/integrate-with-flask)
|
|
87
|
-
- [FastAPI](/docs/integrate-with-fastapi)
|
|
88
|
-
- [Django](/docs/integrate-with-django)
|
|
89
|
-
- [SDK Reference](/docs/sdk-reference)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Introductory Offers
|
|
3
|
-
description:
|
|
3
|
+
description: Attach an existing Offer to a base plan price so Commet applies it automatically to eligible new subscriptions.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
An Introductory Offer is not a separate Offer type. It is an existing Offer attached to one base plan price with introductory placement.
|
|
@@ -53,11 +53,3 @@ An explicit `offerId` applies that Offer directly instead. It cannot be combined
|
|
|
53
53
|
## Trials and compatibility fields
|
|
54
54
|
|
|
55
55
|
`trialDays`, `customTrialDays`, and `skipTrial` remain supported API shortcuts. Internally, an accepted trial is recorded as a `free_trial` phase in the Offer Application. Prefer catalog Offers when the same terms should be named, reused, inspected, or distributed consistently.
|
|
56
|
-
|
|
57
|
-
## Related
|
|
58
|
-
|
|
59
|
-
- [Offers](/docs/offers)
|
|
60
|
-
- [Promotional Offers](/docs/promotional-offers)
|
|
61
|
-
- [Promo Codes](/docs/promo-codes)
|
|
62
|
-
- [Trial Periods](/docs/trial-periods)
|
|
63
|
-
- [Manage Subscriptions](/docs/manage-subscriptions)
|
|
@@ -54,11 +54,3 @@ When Commet quotes or applies an Offer, it records an immutable Offer Applicatio
|
|
|
54
54
|
Editing, deactivating, or archiving the catalog Offer affects future applications only. Existing applications remain available for billing and audit.
|
|
55
55
|
|
|
56
56
|
The v9 response is target-aware (`plan_price`, `addon`, or `credit_pack`) so new purchase surfaces do not require another breaking response change. Current public subscription, Introductory, direct, and Promo Code flows create `plan_price` applications.
|
|
57
|
-
|
|
58
|
-
## Related
|
|
59
|
-
|
|
60
|
-
- [Introductory Offers](/docs/introductory-offers)
|
|
61
|
-
- [Promotional Offers](/docs/promotional-offers)
|
|
62
|
-
- [Promo Codes](/docs/promo-codes)
|
|
63
|
-
- [Trial Periods](/docs/trial-periods)
|
|
64
|
-
- [Offers API reference](/docs/api-reference/offers/list-offers)
|
|
@@ -70,10 +70,3 @@ await commet.subscriptions.create({
|
|
|
70
70
|
promoCode: 'LAUNCH50',
|
|
71
71
|
})
|
|
72
72
|
```
|
|
73
|
-
|
|
74
|
-
## Related
|
|
75
|
-
|
|
76
|
-
- [Offers](/docs/offers)
|
|
77
|
-
- [Promotional Offers](/docs/promotional-offers)
|
|
78
|
-
- [Introductory Offers](/docs/introductory-offers)
|
|
79
|
-
- [Manage Subscriptions](/docs/manage-subscriptions)
|
|
@@ -65,10 +65,3 @@ The same operation on a subscription with a pending payment checkout quotes or r
|
|
|
65
65
|
Use direct `offerId` when your application decides who receives the terms. Use a Promo Code when the customer should enter a code and the campaign needs redemption restrictions.
|
|
66
66
|
|
|
67
67
|
A Promo Code can distribute multiple discount phases, including `fixed_price`, and can begin with a trial when a discount follows it. A trial-only Offer remains available for direct application.
|
|
68
|
-
|
|
69
|
-
## Related
|
|
70
|
-
|
|
71
|
-
- [Offers](/docs/offers)
|
|
72
|
-
- [Introductory Offers](/docs/introductory-offers)
|
|
73
|
-
- [Promo Codes](/docs/promo-codes)
|
|
74
|
-
- [Manage Subscriptions](/docs/manage-subscriptions)
|
|
@@ -90,10 +90,3 @@ Accepted Offer phases are a separate immutable snapshot; the selected catalog pr
|
|
|
90
90
|
## v8 compatibility
|
|
91
91
|
|
|
92
92
|
API `2026-07-24` and SDK v8 keep `/pricing/market-groups` and `commet.pricing.*`. API `2026-07-31` and SDK v9 use the top-level Market surface.
|
|
93
|
-
|
|
94
|
-
## Related
|
|
95
|
-
|
|
96
|
-
- [Offers](/docs/offers)
|
|
97
|
-
- [Create Plans](/docs/create-plans)
|
|
98
|
-
- [Manage Subscriptions](/docs/manage-subscriptions)
|
|
99
|
-
- [Markets API reference](/docs/api-reference/markets/list-markets)
|
|
@@ -78,11 +78,3 @@ The customer provides a payment method during checkout but is not charged immedi
|
|
|
78
78
|
4. any following Offer phase becomes active.
|
|
79
79
|
|
|
80
80
|
Accepted Offer phases remain immutable, but the selected catalog price does not. If the price changes during the trial, the first paid charge uses the current value of the selected price.
|
|
81
|
-
|
|
82
|
-
## Related
|
|
83
|
-
|
|
84
|
-
- [Offers](/docs/offers)
|
|
85
|
-
- [Introductory Offers](/docs/introductory-offers)
|
|
86
|
-
- [Promotional Offers](/docs/promotional-offers)
|
|
87
|
-
- [How trial periods work](/docs/how-do-trial-periods-work)
|
|
88
|
-
- [Handle Failed Payments](/docs/handle-failed-payments)
|
|
@@ -112,6 +112,8 @@ The normal path needs only `customerId` and either `planCode` or `planId`. Optio
|
|
|
112
112
|
|
|
113
113
|
Omitting `priceId` preserves default price and Market resolution. Omitting `offerId` preserves automatic Introductory Offer selection.
|
|
114
114
|
|
|
115
|
+
To charge several billing periods in the first payment, see [Pay in Advance](/docs/pay-in-advance). To sell a period that doesn't renew, see [One-Time Payments](/docs/one-time-payments#sell-a-period-without-renewal).
|
|
116
|
+
|
|
115
117
|
A compatible `pending_payment` checkout may be reused. An incompatible pending selection can be replaced without duplicating a paid subscription.
|
|
116
118
|
|
|
117
119
|
Omitting a `promoCode` or `offerId` that the pending checkout carries, including an Offer assigned through `PUT /subscriptions/{id}/offer`, replaces it with a new subscription and checkout without that benefit. Redirect to the returned `checkoutUrl`; the previous link stops working. To keep the Offer, send it again or assign it to the returned subscription ID.
|
|
@@ -596,12 +598,3 @@ Automatic dunning retries are anchored to the original decline on days 1, 3, 5,
|
|
|
596
598
|
The same `reactivate` operation charges the saved payment method, reuses the subscription record, and starts a fresh period anchored to the reactivation date. You may pass an `offerId`; accepted phases are persisted as an immutable Offer Application.
|
|
597
599
|
|
|
598
600
|
The selected price is not snapshotted. Future renewals use its current catalog value. Archiving that price prevents new selection but does not break the existing subscription.
|
|
599
|
-
|
|
600
|
-
## Related
|
|
601
|
-
|
|
602
|
-
- [Grant Temporary Plan Access](/docs/plan-grants)
|
|
603
|
-
- [Upgrade and Downgrade Plans](/docs/upgrade-and-downgrade-plans)
|
|
604
|
-
- [Handle Failed Payments](/docs/handle-failed-payments)
|
|
605
|
-
- [Regional and Market Pricing](/docs/regional-prices)
|
|
606
|
-
- [Introductory Offers](/docs/introductory-offers)
|
|
607
|
-
- [Customer Portal](/docs/customer-portal)
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Pay in Advance
|
|
3
|
+
description: Let a customer pay several billing periods of a subscription in one payment with any checkout method.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Paying in advance lets a customer cover several billing periods of a subscription in one payment, with card, OXXO, or any other checkout method.
|
|
7
|
+
|
|
8
|
+
It works on weekly, monthly, quarterly, semiannual, and yearly prices. The interval never changes: each paid period renews at `$0` as a regular renewal.
|
|
9
|
+
|
|
10
|
+
Paying in advance doesn't decide whether the subscription renews afterward. To sell periods that end on their own, combine it with `cancelAtPeriodEnd: true`, described in [One-Time Payments](/docs/one-time-payments#sell-a-period-without-renewal).
|
|
11
|
+
|
|
12
|
+
## Charge several periods in the first payment
|
|
13
|
+
|
|
14
|
+
> **Warning**
|
|
15
|
+
>
|
|
16
|
+
> **Free trials don't combine with paying in advance.** With `prepaidPeriods` above `1` or `cancelAtPeriodEnd: true`, an explicit trial (`customTrialDays`, a trial Offer, or a trial Promo Code) returns `400`, and the plan's automatic introductory trial is skipped.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
curl -X POST https://commet.co/api/v1/subscriptions \
|
|
20
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
21
|
+
-H "commet-version: 2026-08-27" \
|
|
22
|
+
-H "Content-Type: application/json" \
|
|
23
|
+
-d '{"customerId":"user_123","planId":"pln_xxx","prepaidPeriods":3}'
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Redirect the customer to `checkoutUrl`. The first payment covers 3 periods of the price's interval, including the current one: 3 months on a monthly price, 3 quarters on a quarterly one.
|
|
27
|
+
|
|
28
|
+
| Parameter | Type | Required | Description |
|
|
29
|
+
| ------------------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| `prepaidPeriods` | `integer` | No | Total billing periods the first payment covers, including the current one. `1` to `60`. Default: `1` |
|
|
31
|
+
| `cancelAtPeriodEnd` | `boolean` | No | `true` ends the subscription after its last paid period, with no renewal. See [One-Time Payments](/docs/one-time-payments#sell-a-period-without-renewal) |
|
|
32
|
+
|
|
33
|
+
`prepaidPeriods` above `1` requires a paid recurring price. One-time prices and free plans return `400 validation_error` with `param: "prepaidPeriods"`.
|
|
34
|
+
|
|
35
|
+
## Add periods to an existing subscription
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
curl -X POST https://commet.co/api/v1/subscriptions/sub_xxx/prepaid-periods \
|
|
39
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
40
|
+
-H "commet-version: 2026-08-27" \
|
|
41
|
+
-H "Content-Type: application/json" \
|
|
42
|
+
-d '{"periods":3}'
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Send the returned `checkoutUrl` to the customer. It opens a hosted checkout for those periods.
|
|
46
|
+
|
|
47
|
+
| Parameter | Type | Required | Description |
|
|
48
|
+
| ------------ | --------- | -------- | ----------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `periods` | `integer` | Yes | Billing periods to pay. `1` to `60`. Its meaning depends on the subscription status |
|
|
50
|
+
| `offerId` | `string` | No | Offer applied from the first added period for its full configured duration. Active subscriptions only |
|
|
51
|
+
| `successUrl` | `string` | No | Where the customer lands after paying |
|
|
52
|
+
|
|
53
|
+
The subscription status decides what `periods` means:
|
|
54
|
+
|
|
55
|
+
| Status | `periods` | The new link |
|
|
56
|
+
| ------------------------------------------- | ------------------------------------------------------------------------------- | ---------------------------------- |
|
|
57
|
+
| `active` | Periods added after the last paid period, priced in the subscription's currency | Replaces any previous unpaid link |
|
|
58
|
+
| `pending_payment`, before its first payment | Total periods the first payment covers, including the first one | Replaces the pending checkout link |
|
|
59
|
+
|
|
60
|
+
A `pending_payment` subscription that already paid and is awaiting a renewal returns `409`. A canceled subscription also returns `409`; to bring the customer back, create a new subscription with `prepaidPeriods`.
|
|
61
|
+
|
|
62
|
+
If the customer already generated an OXXO voucher for the pending checkout, Commet cancels it with the provider first. To apply an Offer to a pending subscription, send `offerId` when [creating the subscription](/docs/manage-subscriptions#create), or assign it with `PUT /subscriptions/{id}/offer` before or after this call: the checkout prices each paid period with that Offer.
|
|
63
|
+
|
|
64
|
+
Commet voids an unpaid link and emits [`invoice.voided`](/docs/webhooks/invoice-voided) when you create a new link, the plan or billing interval changes (immediately or as scheduled), or the subscription is paused, canceled immediately, or ends, including when failed payment retries cancel it. If the customer pays an OXXO voucher from a voided link, Commet refunds it automatically.
|
|
65
|
+
|
|
66
|
+
| Response | Cause |
|
|
67
|
+
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
68
|
+
| `400 validation_error` | The price is one-time or the plan is free |
|
|
69
|
+
| `400 validation_error` | `offerId` has a free trial or was sent for a `pending_payment` subscription. `param` is `offerId` |
|
|
70
|
+
| `400 validation_error` | An Offer bills on another interval. See [Offers billed on another interval](#offers-billed-on-another-interval) |
|
|
71
|
+
| `400 validation_error` | The total is below the minimum charge, such as with a 100% Offer. `param` is `offerId` when you sent one, `periods` otherwise. The previous unpaid link stays payable |
|
|
72
|
+
| `409 invalid_subscription_status` | The subscription isn't `active` or awaiting its first payment, it has a free trial, or a pause is scheduled |
|
|
73
|
+
| `409 charge_in_progress` | A payment for the link being replaced couldn't be canceled, such as a generated OXXO voucher |
|
|
74
|
+
|
|
75
|
+
## How each period is priced
|
|
76
|
+
|
|
77
|
+
Each period costs the price of the subscription's interval for the buyer's country and currency, minus the discount of the Offer phase that applies to that period.
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
Plan: $10/month
|
|
81
|
+
Offer: 50% off for 2 months
|
|
82
|
+
Periods: 3
|
|
83
|
+
|
|
84
|
+
Period 1 → $5
|
|
85
|
+
Period 2 → $5
|
|
86
|
+
Period 3 → $10
|
|
87
|
+
Payment → $20
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
For the first payment, the currency and country price are resolved at checkout, as for any subscription. Offers run for their full configured duration starting at the first paid period. An Offer assigned with `PUT /v1/subscriptions/{id}/offer` to a subscription with paid periods left starts at the first renewal that charges, after the last paid period.
|
|
91
|
+
|
|
92
|
+
[Card Promotions](/docs/card-promotions) behave as on any subscription. [Promo Codes](/docs/promo-codes) do too, with two exceptions:
|
|
93
|
+
|
|
94
|
+
- A link that adds periods to an active subscription keeps the price it was created with, so a Promo Code entered there is rejected with "Promo codes can't be used on a link that adds billing periods".
|
|
95
|
+
- A trial Promo Code entered on a checkout that pays several periods or on a one-time purchase is rejected with "Trial codes can't be used when paying in advance".
|
|
96
|
+
|
|
97
|
+
### Offers billed on another interval
|
|
98
|
+
|
|
99
|
+
An Offer with a phase billed on a different interval than the subscription, such as `$5/month for 3 months` on a yearly price, can't combine with paying in advance. These requests return `400 validation_error`:
|
|
100
|
+
|
|
101
|
+
| Request | `param` |
|
|
102
|
+
| ----------------------------------------------------------------------------------------------------------------- | ------------------- |
|
|
103
|
+
| `POST /v1/subscriptions` with `prepaidPeriods` above `1` and that Offer through `offerId` or `promoCode` | `prepaidPeriods` |
|
|
104
|
+
| `POST /v1/subscriptions/{id}/prepaid-periods` with that `offerId`, or with that Offer already assigned or running | `offerId` when sent |
|
|
105
|
+
| `PUT /v1/subscriptions/{id}/offer` on a subscription with unused paid periods or an unpaid link | `offerId` |
|
|
106
|
+
|
|
107
|
+
A Promo Code for that Offer entered on a prepaid checkout is rejected with "This promo code can't be used when paying several billing periods in advance".
|
|
108
|
+
|
|
109
|
+
## What the customer sees at checkout
|
|
110
|
+
|
|
111
|
+
| Purchase | Checkout shows |
|
|
112
|
+
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- |
|
|
113
|
+
| Renews after the paid periods | `3 months · then $10.00/mo` or `2 quarters · then $30.00/qtr` |
|
|
114
|
+
| One-time purchase, a subscription scheduled to end, or a first payment with a method that can't renew (OXXO) | `3 months · one-time payment, doesn't renew` |
|
|
115
|
+
|
|
116
|
+
On a link that adds periods to an active subscription, the label follows whether the subscription renews, not the method chosen in that checkout. An OXXO payment on a card subscription shows `then …`.
|
|
117
|
+
|
|
118
|
+
## End OXXO subscriptions after their paid periods
|
|
119
|
+
|
|
120
|
+
When a subscription is paid with OXXO and has no other saved payment method, Commet schedules its cancellation at the end of its paid periods.
|
|
121
|
+
|
|
122
|
+
- The API shows `cancelAtPeriodEnd: true` and `cancellation.effectiveAt` right after the payment.
|
|
123
|
+
- [`subscription.updated`](/docs/webhooks/subscription-updated) and [`subscription.cancellation_scheduled`](/docs/webhooks/subscription-cancellation-scheduled) fire, with `effectiveAt` at the end of the paid periods and `cancelReason: null`.
|
|
124
|
+
- The subscription isn't renewed or charged, and [`subscription.canceled`](/docs/webhooks/subscription-canceled) fires when it ends.
|
|
125
|
+
|
|
126
|
+
To keep it, the customer adds a card through the [payment method update link](/docs/handle-failed-payments#update-the-payment-method) (`POST /v1/subscriptions/{id}/payment-method/update`) or **Keep subscription** in the [Customer Portal](/docs/customer-portal). The subscription then renews normally with that card.
|
|
127
|
+
|
|
128
|
+
`POST /v1/subscriptions/{id}/uncancel` without a saved card returns `409 subscription_uncancel_failed`.
|
|
129
|
+
|
|
130
|
+
## Track paid periods after payment
|
|
131
|
+
|
|
132
|
+
- `currentPeriod` stays one billing period.
|
|
133
|
+
- `nextBillingDate` is the next real charge, after the last paid period.
|
|
134
|
+
- Each paid period renews with a paid `$0` invoice, with no charge and no payment link, also for OXXO.
|
|
135
|
+
- Features, credits, and balances reset on their usual schedule.
|
|
136
|
+
|
|
137
|
+
Paying in advance uses existing webhook events:
|
|
138
|
+
|
|
139
|
+
- [`payment.received`](/docs/webhooks/payment-received) and [`subscription.updated`](/docs/webhooks/subscription-updated): the periods were paid.
|
|
140
|
+
- [`invoice.created`](/docs/webhooks/invoice-created): a paid period renewed with a `$0` invoice.
|
|
141
|
+
- [`invoice.voided`](/docs/webhooks/invoice-voided): an unpaid link was voided.
|
|
142
|
+
- [`subscription.canceled`](/docs/webhooks/subscription-canceled): a one-time purchase or an OXXO subscription without a card ended.
|
|
143
|
+
|
|
144
|
+
## Cancel, pause, or change plan
|
|
145
|
+
|
|
146
|
+
- Cancel: paid periods aren't refunded, and a scheduled cancellation takes effect after the last paid period.
|
|
147
|
+
- Pause: rejected while paid periods remain.
|
|
148
|
+
- Plan or billing interval change: unused paid periods become [Customer Credits](/docs/customer-credits) at the price paid.
|
|
149
|
+
|
|
150
|
+
## Pay in advance from the Dashboard
|
|
151
|
+
|
|
152
|
+
Open the subscription detail, choose **Pay in advance**, enter the number of periods, and choose **Copy payment link**. The field is labeled with the unit of the subscription's interval, such as **Months** or **Quarters**.
|
|
153
|
+
|
|
154
|
+
Send the copied link to the customer. The subscription detail shows **Paid through** with the date the paid periods end.
|
|
155
|
+
|
|
156
|
+
## Limitations
|
|
157
|
+
|
|
158
|
+
- `prepaidPeriods` and `periods` accept `1` to `60` for every interval.
|
|
159
|
+
- Only paid recurring prices. One-time prices and free plans return `400`.
|
|
160
|
+
- Free trials don't combine with `prepaidPeriods` above `1` or with `cancelAtPeriodEnd`.
|
|
161
|
+
- Usage overage, seats, and add-ons aren't prepaid: they're billed on their usual schedule, and a renewal with a non-zero total follows the normal payment path.
|
|
@@ -115,9 +115,3 @@ curl https://commet.co/api/v1/customers/cus_xxx/plan-grants \
|
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
See the [Plan Grants API reference](/docs/api-reference/customers/list-plan-grants) for exact request and response schemas.
|
|
118
|
-
|
|
119
|
-
## Related
|
|
120
|
-
|
|
121
|
-
- [Manage Subscriptions](/docs/manage-subscriptions)
|
|
122
|
-
- [Introductory Offers](/docs/introductory-offers)
|
|
123
|
-
- [Customer State Changed](/docs/webhooks/customer-state-changed)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Upgrade and Downgrade Plans
|
|
3
|
-
description:
|
|
3
|
+
description: Upgrades apply immediately with proration and downgrades wait for renewal, whether customers change plans in the portal or you do it in the dashboard.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Customers change plans through the [Customer Portal](/docs/customer-portal) or from the dashboard. Commet handles proration, feature transitions, and billing adjustments automatically.
|
|
@@ -28,9 +28,3 @@ From a customer's subscription detail page, click **Change Plan** and select the
|
|
|
28
28
|
|
|
29
29
|
- [What Happens When a Customer Changes Plans](/docs/what-happens-when-a-customer-changes-plans)
|
|
30
30
|
- [How Is Proration Calculated](/docs/how-is-proration-calculated-when-changing-plans)
|
|
31
|
-
|
|
32
|
-
## Related
|
|
33
|
-
|
|
34
|
-
- [Manage Subscriptions](/docs/manage-subscriptions) — Create, get, and cancel subscriptions
|
|
35
|
-
- [Plan Groups](/docs/plan-groups) — Group plans together for self-service upgrades
|
|
36
|
-
- [Customer Portal](/docs/customer-portal) — Self-service billing portal for customers
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Testing
|
|
3
|
-
description: Test
|
|
3
|
+
description: "Test billing in an isolated sandbox: simulate renewals with the Test Clock and try test cards, failed payments and 3D Secure."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Sandbox is the default environment — completely isolated from production.
|
|
@@ -285,9 +285,3 @@ Supported providers include OpenAI, Anthropic, Google, Meta, Mistral, Cohere, an
|
|
|
285
285
|
## AI Costs dashboard
|
|
286
286
|
|
|
287
287
|
View all AI token costs in the dashboard under **AI Costs**. Each entry shows the model used, token breakdown, cost calculation, margin applied, and total charged.
|
|
288
|
-
|
|
289
|
-
## Related
|
|
290
|
-
|
|
291
|
-
- [Consumption Models](/docs/consumption-models) — How Balance model works
|
|
292
|
-
- [Track Usage](/docs/track-usage) — Standard usage tracking
|
|
293
|
-
- [Configure Features](/docs/configure-features) — Create metered features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Quota Management
|
|
3
|
-
description:
|
|
3
|
+
description: Track durable quota balances such as tasks or automations with the Commet SDK, and let Commet bill the units above the included amount.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Quota tracks a durable, countable balance that rises and falls as customers create and delete — tasks, WhatsApp numbers, parallel automations. Commet includes an amount with the plan and bills per-unit overage automatically.
|
|
@@ -332,9 +332,3 @@ curl "https://commet.co/api/v1/usage/quota/all?customerId=user_123" \
|
|
|
332
332
|
## Learn more
|
|
333
333
|
|
|
334
334
|
- [How Does Quota-Based Billing Work](/docs/how-does-quota-based-billing-work)
|
|
335
|
-
|
|
336
|
-
## Related
|
|
337
|
-
|
|
338
|
-
- [Configure Features](/docs/configure-features) — Create quota features on your plans
|
|
339
|
-
- [Manage Plans](/docs/create-plans) — Plans that include quota-based pricing
|
|
340
|
-
- [Track Usage](/docs/track-usage) — Send usage events for metered features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Seat Management
|
|
3
|
-
description:
|
|
3
|
+
description: Add, remove or set seats with the Commet SDK, with included seats billed at the start of the period and extra seats prorated.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Seats are per-user licenses that let you charge based on team size. Commet tracks seat changes and bills them automatically — included seats at the start of the period, additional seats prorated.
|
|
@@ -368,9 +368,3 @@ curl "https://commet.co/api/v1/seats/balances?customerId=user_123" \
|
|
|
368
368
|
## Learn more
|
|
369
369
|
|
|
370
370
|
- [How Does Seat-Based Billing Work](/docs/how-does-seat-based-billing-work)
|
|
371
|
-
|
|
372
|
-
## Related
|
|
373
|
-
|
|
374
|
-
- [Configure Features](/docs/configure-features) — Create seat features on your plans
|
|
375
|
-
- [Manage Plans](/docs/create-plans) — Plans that include seat-based pricing
|
|
376
|
-
- [Manage Subscriptions](/docs/manage-subscriptions) — Assign plans with initial seats
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Track Usage
|
|
3
|
-
description: Record metered
|
|
3
|
+
description: Record metered usage with one feature code per event, avoid duplicates with an idempotency key, and correct period totals.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Every metered feature has one code. Send that code as `featureCode`; Commet aggregates events for access, credits, balance, and billing.
|
|
@@ -273,9 +273,3 @@ $usageCheck = $commet->usage->check(
|
|
|
273
273
|
featureCode: 'api_calls',
|
|
274
274
|
);
|
|
275
275
|
```
|
|
276
|
-
|
|
277
|
-
## Related
|
|
278
|
-
|
|
279
|
-
- [Configure Features](/docs/configure-features)
|
|
280
|
-
- [AI Token Billing](/docs/ai-token-billing)
|
|
281
|
-
- [Consumption Models](/docs/consumption-models)
|
|
@@ -54,11 +54,3 @@ Total: $130.00
|
|
|
54
54
|
> **Note**
|
|
55
55
|
>
|
|
56
56
|
> Accepted phases are stored in an immutable Offer Application. Editing, deactivating, or archiving the catalog Offer changes future applications only.
|
|
57
|
-
|
|
58
|
-
## Related
|
|
59
|
-
|
|
60
|
-
- [Offers](/docs/offers)
|
|
61
|
-
- [Introductory Offers](/docs/introductory-offers)
|
|
62
|
-
- [Promotional Offers](/docs/promotional-offers)
|
|
63
|
-
- [Promo Codes](/docs/promo-codes)
|
|
64
|
-
- [Plan Changes](/docs/what-happens-when-a-customer-changes-plans)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Free Plans
|
|
3
|
-
description:
|
|
3
|
+
description: Free plans activate without checkout and reset usage every month, and usage stops at the included limit instead of charging overage.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
A free plan has no price and no checkout. When you assign a customer to a free plan, they're activated immediately. Their usage resets every month, just like a paid plan.
|
|
@@ -79,9 +79,3 @@ Credit from free plan: $0 (it's free)
|
|
|
79
79
|
They pay: $99 (full month)
|
|
80
80
|
Invoices, payment method, and billing info appear in their portal.
|
|
81
81
|
```
|
|
82
|
-
|
|
83
|
-
## Related
|
|
84
|
-
|
|
85
|
-
- [Plan Changes](/docs/what-happens-when-a-customer-changes-plans) — Upgrades, downgrades, and switching
|
|
86
|
-
- [Trials](/docs/how-do-trial-periods-work) — Another way to let customers try before paying
|
|
87
|
-
- [Invoices](/docs/what-invoices-do-customers-receive-and-when) — What invoices your customers receive
|
|
@@ -68,9 +68,3 @@ They upgrade to Plan B at $600/quarter on February 15.
|
|
|
68
68
|
→ They're charged Plan B's full price minus that credit.
|
|
69
69
|
→ Their new cycle starts February 15, next renewal May 15.
|
|
70
70
|
```
|
|
71
|
-
|
|
72
|
-
## Related
|
|
73
|
-
|
|
74
|
-
- [Invoices](/docs/what-invoices-do-customers-receive-and-when) — What invoices your customers receive and when
|
|
75
|
-
- [Proration](/docs/how-is-proration-calculated-when-changing-plans) — How mid-cycle charges are calculated
|
|
76
|
-
- [Plan Changes](/docs/what-happens-when-a-customer-changes-plans) — Upgrades, downgrades, and switching
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Trials
|
|
3
|
-
description:
|
|
3
|
+
description: "A free trial is an Offer phase: checkout saves the payment method without charging it, and the first charge waits until the trial ends."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
A trial is a `free_trial` phase in an Offer. It delays the first charge; the Offer's application channel determines whether Commet selects it automatically or your integration assigns it directly.
|
|
@@ -44,10 +44,3 @@ Use `customTrialDays` for terms exclusive to one subscription. Commet records th
|
|
|
44
44
|
| Credit, balance, and add-on purchases | Available after checkout captures the payment method |
|
|
45
45
|
| Metered usage reset | Monthly on the billing day for trials longer than a month |
|
|
46
46
|
| Included balance and credits | Granted once when the trial starts |
|
|
47
|
-
|
|
48
|
-
## Related
|
|
49
|
-
|
|
50
|
-
- [Trial Periods](/docs/trial-periods)
|
|
51
|
-
- [Offers](/docs/offers)
|
|
52
|
-
- [Free Plans](/docs/how-do-free-plans-work-without-payment)
|
|
53
|
-
- [Payment Failures](/docs/what-happens-when-a-payment-fails)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: How Billing Works
|
|
3
|
-
description: How
|
|
3
|
+
description: How the catalog, subscriptions, usage, invoices and transactions fit together, and what each change you or your customers make does to billing.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Commet measures what a customer can consume and charges according to the plan they accepted. Your catalog defines the terms, the subscription stores the active relationship, usage records consumption, invoices calculate what is owed, and transactions record payment attempts.
|