@commet/node 9.0.0 → 9.1.1
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/README.md +2 -0
- package/dist/index.d.mts +332 -110
- package/dist/index.d.ts +332 -110
- package/dist/index.js +162 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +162 -40
- package/dist/index.mjs.map +1 -1
- package/docs/README.md +20 -0
- package/docs/ai-onboarding/ai-onboarding.md +90 -0
- package/docs/ai-onboarding/billing-best-practices-skill.md +29 -0
- package/docs/ai-onboarding/commet-skill.md +58 -0
- package/docs/ai-onboarding/mcp-server.md +207 -0
- package/docs/ai-onboarding/meta.json +17 -0
- package/docs/ai-onboarding/pricing-models-skill.md +29 -0
- package/docs/ai-onboarding/subscription-patterns-skill.md +29 -0
- package/docs/api-reference/addons.md +127 -0
- package/docs/api-reference/api-keys.md +57 -0
- package/docs/api-reference/credit-packs.md +80 -0
- package/docs/api-reference/customers.md +274 -0
- package/docs/api-reference/feature-access.md +36 -0
- package/docs/api-reference/features.md +94 -0
- package/docs/api-reference/generated-webhooks.md +120 -0
- package/docs/api-reference/index.md +31 -0
- package/docs/api-reference/invoices.md +123 -0
- package/docs/api-reference/markets.md +92 -0
- package/docs/api-reference/meta.json +7 -0
- package/docs/api-reference/offers.md +104 -0
- package/docs/api-reference/payments.md +106 -0
- package/docs/api-reference/payouts.md +66 -0
- package/docs/api-reference/plan-groups.md +157 -0
- package/docs/api-reference/plans.md +358 -0
- package/docs/api-reference/portal.md +30 -0
- package/docs/api-reference/promo-codes.md +86 -0
- package/docs/api-reference/provisioning.md +19 -0
- package/docs/api-reference/quota.md +120 -0
- package/docs/api-reference/seats.md +123 -0
- package/docs/api-reference/subscriptions.md +387 -0
- package/docs/api-reference/test-clock.md +59 -0
- package/docs/api-reference/transactions.md +78 -0
- package/docs/api-reference/usage.md +83 -0
- package/docs/documentation/api-versioning.md +100 -0
- package/docs/documentation/better-auth.md +361 -0
- package/docs/documentation/choose-a-billing-model.md +38 -0
- package/docs/documentation/cli.md +1024 -0
- package/docs/documentation/create-api-key.md +47 -0
- package/docs/documentation/customers/customer-credits.md +48 -0
- package/docs/documentation/customers/customer-portal.md +107 -0
- package/docs/documentation/customers/manage-customers.md +346 -0
- package/docs/documentation/customers/meta.json +5 -0
- package/docs/documentation/error-handling.md +239 -0
- package/docs/documentation/examples.md +37 -0
- package/docs/documentation/finance/acceptable-use.md +145 -0
- package/docs/documentation/finance/finance-overview.md +32 -0
- package/docs/documentation/finance/local-currency-taxes.md +40 -0
- package/docs/documentation/finance/merchant-of-record.md +48 -0
- package/docs/documentation/finance/meta.json +13 -0
- package/docs/documentation/finance/payouts-verification.md +186 -0
- package/docs/documentation/finance/payouts.md +41 -0
- package/docs/documentation/finance/supported-countries.md +28 -0
- package/docs/documentation/go/integrate-with-encore.md +229 -0
- package/docs/documentation/go/integrate-with-go.md +258 -0
- package/docs/documentation/go/meta.json +5 -0
- package/docs/documentation/introduction.md +58 -0
- package/docs/documentation/invoicing/handle-failed-payments.md +283 -0
- package/docs/documentation/invoicing/invoices-and-billing-cycles.md +73 -0
- package/docs/documentation/invoicing/manage-invoices.md +340 -0
- package/docs/documentation/invoicing/meta.json +9 -0
- package/docs/documentation/java/integrate-with-java.md +117 -0
- package/docs/documentation/java/meta.json +5 -0
- package/docs/documentation/meta.json +36 -0
- package/docs/documentation/nodejs/integrate-with-astro.md +129 -0
- package/docs/documentation/nodejs/integrate-with-bun.md +113 -0
- package/docs/documentation/nodejs/integrate-with-express.md +127 -0
- package/docs/documentation/nodejs/integrate-with-hono.md +141 -0
- package/docs/documentation/nodejs/integrate-with-nextjs.md +118 -0
- package/docs/documentation/nodejs/integrate-with-nuxt.md +125 -0
- package/docs/documentation/nodejs/integrate-with-remix.md +136 -0
- package/docs/documentation/nodejs/integrate-with-sveltekit.md +127 -0
- package/docs/documentation/nodejs/meta.json +14 -0
- package/docs/documentation/payments/accept-one-time-payments.md +314 -0
- package/docs/documentation/payments/meta.json +10 -0
- package/docs/documentation/payments/payment-orchestration.md +43 -0
- package/docs/documentation/payments/payment-providers.md +59 -0
- package/docs/documentation/payments/transactions-refunds-and-retries.md +199 -0
- package/docs/documentation/php/integrate-with-laravel.md +222 -0
- package/docs/documentation/php/integrate-with-php.md +103 -0
- package/docs/documentation/php/integrate-with-symfony.md +214 -0
- package/docs/documentation/php/meta.json +9 -0
- package/docs/documentation/plans/add-ons.md +257 -0
- package/docs/documentation/plans/balance-and-top-ups.md +169 -0
- package/docs/documentation/plans/configure-features.md +335 -0
- package/docs/documentation/plans/consumption-models.md +93 -0
- package/docs/documentation/plans/create-plans.md +162 -0
- package/docs/documentation/plans/credit-packs.md +89 -0
- package/docs/documentation/plans/meta.json +14 -0
- package/docs/documentation/plans/one-time-payments.md +142 -0
- package/docs/documentation/plans/plan-groups.md +31 -0
- package/docs/documentation/platform/custom-domains.md +27 -0
- package/docs/documentation/platform/dashboard-metrics-and-events.md +25 -0
- package/docs/documentation/platform/members-and-permissions.md +21 -0
- package/docs/documentation/platform/meta.json +10 -0
- package/docs/documentation/platform/organization-settings.md +29 -0
- package/docs/documentation/python/integrate-with-django.md +161 -0
- package/docs/documentation/python/integrate-with-fastapi.md +164 -0
- package/docs/documentation/python/integrate-with-flask.md +153 -0
- package/docs/documentation/python/integrate-with-python.md +90 -0
- package/docs/documentation/python/meta.json +10 -0
- package/docs/documentation/sales/card-promotions.md +41 -0
- package/docs/documentation/sales/introductory-offers.md +64 -0
- package/docs/documentation/sales/meta.json +13 -0
- package/docs/documentation/sales/offers.md +65 -0
- package/docs/documentation/sales/promo-codes.md +65 -0
- package/docs/documentation/sales/promotional-offers.md +58 -0
- package/docs/documentation/sales/regional-prices.md +100 -0
- package/docs/documentation/sales/trial-periods.md +88 -0
- package/docs/documentation/sdk-reference.md +68 -0
- package/docs/documentation/subscriptions/manage-subscriptions.md +505 -0
- package/docs/documentation/subscriptions/meta.json +9 -0
- package/docs/documentation/subscriptions/plan-grants.md +124 -0
- package/docs/documentation/subscriptions/upgrade-and-downgrade-plans.md +37 -0
- package/docs/documentation/testing-sandbox.md +251 -0
- package/docs/documentation/usage/ai-token-billing.md +294 -0
- package/docs/documentation/usage/meta.json +10 -0
- package/docs/documentation/usage/quota-management.md +341 -0
- package/docs/documentation/usage/seat-management.md +377 -0
- package/docs/documentation/usage/track-usage.md +282 -0
- package/docs/errors/addon_already_active.md +22 -0
- package/docs/errors/addon_has_activations.md +22 -0
- package/docs/errors/addon_not_active.md +22 -0
- package/docs/errors/addon_not_found.md +22 -0
- package/docs/errors/already_has_active_subscription.md +22 -0
- package/docs/errors/already_scheduled.md +22 -0
- package/docs/errors/api_key_not_found.md +22 -0
- package/docs/errors/card_promotions_not_available.md +22 -0
- package/docs/errors/charge_failed.md +22 -0
- package/docs/errors/charge_in_progress.md +22 -0
- package/docs/errors/claim_not_pending.md +22 -0
- package/docs/errors/credit_pack_not_found.md +22 -0
- package/docs/errors/customer_not_found.md +22 -0
- package/docs/errors/duplicate.md +22 -0
- package/docs/errors/endpoint_deprecated.md +22 -0
- package/docs/errors/endpoint_not_available.md +22 -0
- package/docs/errors/feature_already_exists.md +22 -0
- package/docs/errors/feature_disabled.md +22 -0
- package/docs/errors/feature_in_use.md +22 -0
- package/docs/errors/feature_not_found.md +22 -0
- package/docs/errors/feature_not_in_plan.md +22 -0
- package/docs/errors/forbidden.md +22 -0
- package/docs/errors/free_plan_change_not_supported.md +22 -0
- package/docs/errors/idempotency_in_progress.md +22 -0
- package/docs/errors/idempotency_key_mismatch.md +22 -0
- package/docs/errors/idempotency_unavailable.md +22 -0
- package/docs/errors/included_limit_reached.md +22 -0
- package/docs/errors/index.md +89 -0
- package/docs/errors/insufficient_balance.md +22 -0
- package/docs/errors/insufficient_credits.md +22 -0
- package/docs/errors/insufficient_seats.md +22 -0
- package/docs/errors/internal_error.md +22 -0
- package/docs/errors/invalid_json.md +22 -0
- package/docs/errors/invalid_subscription_status.md +22 -0
- package/docs/errors/invoice_not_found.md +22 -0
- package/docs/errors/market_group_in_use.md +22 -0
- package/docs/errors/market_group_not_found.md +22 -0
- package/docs/errors/market_in_use.md +22 -0
- package/docs/errors/market_not_found.md +22 -0
- package/docs/errors/missing_regional_price.md +22 -0
- package/docs/errors/model_not_found.md +22 -0
- package/docs/errors/no_active_subscription.md +22 -0
- package/docs/errors/no_change_requested.md +22 -0
- package/docs/errors/no_outstanding_invoice.md +22 -0
- package/docs/errors/no_payment_method.md +22 -0
- package/docs/errors/no_prices_configured.md +22 -0
- package/docs/errors/not_found.md +22 -0
- package/docs/errors/not_scheduled_for_cancellation.md +22 -0
- package/docs/errors/offer_not_applicable.md +22 -0
- package/docs/errors/offer_not_found.md +22 -0
- package/docs/errors/one_time_subscription_not_cancelable.md +22 -0
- package/docs/errors/organization_already_claimed.md +22 -0
- package/docs/errors/payment_failed.md +22 -0
- package/docs/errors/payment_method_not_found.md +22 -0
- package/docs/errors/payment_not_cancelable.md +22 -0
- package/docs/errors/payment_not_found.md +22 -0
- package/docs/errors/payouts_not_available_in_sandbox.md +22 -0
- package/docs/errors/plan_change_scheduled.md +22 -0
- package/docs/errors/plan_group_not_found.md +22 -0
- package/docs/errors/plan_not_found.md +22 -0
- package/docs/errors/plan_unavailable.md +22 -0
- package/docs/errors/plans_not_in_same_group.md +22 -0
- package/docs/errors/price_in_use.md +22 -0
- package/docs/errors/price_not_found.md +22 -0
- package/docs/errors/pricing_mode_mismatch.md +22 -0
- package/docs/errors/promo_code_expired.md +22 -0
- package/docs/errors/promo_code_not_found.md +22 -0
- package/docs/errors/provider_unsupported.md +22 -0
- package/docs/errors/rate_limited.md +22 -0
- package/docs/errors/sandbox_only.md +22 -0
- package/docs/errors/seat_limit_exceeded.md +22 -0
- package/docs/errors/subscription_activation_failed.md +22 -0
- package/docs/errors/subscription_already_canceled.md +22 -0
- package/docs/errors/subscription_cancel_failed.md +22 -0
- package/docs/errors/subscription_creation_failed.md +22 -0
- package/docs/errors/subscription_has_open_dispute.md +22 -0
- package/docs/errors/subscription_not_active.md +22 -0
- package/docs/errors/subscription_not_found.md +22 -0
- package/docs/errors/subscription_required.md +22 -0
- package/docs/errors/subscription_uncancel_failed.md +22 -0
- package/docs/errors/transaction_not_found.md +22 -0
- package/docs/errors/unauthorized.md +22 -0
- package/docs/errors/validation_error.md +22 -0
- package/docs/errors/webhook_not_found.md +22 -0
- package/docs/errors.md +34 -0
- package/docs/getting-started.md +35 -0
- package/docs/knowledge-base/how-do-balance-and-top-ups-work.md +22 -0
- package/docs/knowledge-base/how-do-credits-credit-packs-and-customer-credits-differ.md +20 -0
- package/docs/knowledge-base/how-do-discounts-work.md +65 -0
- package/docs/knowledge-base/how-do-free-plans-work-without-payment.md +88 -0
- package/docs/knowledge-base/how-do-monthly-quarterly-and-yearly-billing-work.md +77 -0
- package/docs/knowledge-base/how-do-offers-promo-codes-and-card-promotions-work-together.md +20 -0
- package/docs/knowledge-base/how-do-trial-periods-work.md +54 -0
- package/docs/knowledge-base/how-does-billing-work.md +73 -0
- package/docs/knowledge-base/how-does-payment-routing-work.md +17 -0
- package/docs/knowledge-base/how-does-quota-based-billing-work.md +106 -0
- package/docs/knowledge-base/how-does-seat-based-billing-work.md +88 -0
- package/docs/knowledge-base/how-is-proration-calculated-when-changing-plans.md +89 -0
- package/docs/knowledge-base/meta.json +29 -0
- package/docs/knowledge-base/what-happens-when-a-customer-changes-plans.md +110 -0
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +40 -0
- package/docs/knowledge-base/what-happens-when-you-change-your-prices.md +74 -0
- package/docs/knowledge-base/what-happens-when-you-refund-or-retry-a-transaction.md +21 -0
- package/docs/knowledge-base/what-invoices-do-customers-receive-and-when.md +101 -0
- package/docs/manifest.json +1677 -0
- package/docs/meta.json +11 -0
- package/docs/platform-documentation.md +175 -0
- package/docs/schemas.md +995 -0
- package/docs/webhooks/addon-activated.md +44 -0
- package/docs/webhooks/addon-deactivated.md +40 -0
- package/docs/webhooks/balance-depleted.md +37 -0
- package/docs/webhooks/balance-low.md +39 -0
- package/docs/webhooks/balance-topped-up.md +41 -0
- package/docs/webhooks/checkout-ready.md +43 -0
- package/docs/webhooks/credits-depleted.md +35 -0
- package/docs/webhooks/credits-expired.md +35 -0
- package/docs/webhooks/credits-granted.md +37 -0
- package/docs/webhooks/credits-low.md +39 -0
- package/docs/webhooks/credits-purchased.md +41 -0
- package/docs/webhooks/customer-created.md +49 -0
- package/docs/webhooks/customer-state-changed.md +134 -0
- package/docs/webhooks/customer-updated.md +49 -0
- package/docs/webhooks/introduction.md +499 -0
- package/docs/webhooks/invoice-created.md +45 -0
- package/docs/webhooks/invoice-overdue.md +53 -0
- package/docs/webhooks/invoice-upcoming.md +43 -0
- package/docs/webhooks/invoice-voided.md +53 -0
- package/docs/webhooks/meta.json +78 -0
- package/docs/webhooks/payment-dispute-resolved.md +52 -0
- package/docs/webhooks/payment-disputed.md +49 -0
- package/docs/webhooks/payment-failed.md +37 -0
- package/docs/webhooks/payment-link-canceled.md +41 -0
- package/docs/webhooks/payment-link-completed.md +47 -0
- package/docs/webhooks/payment-link-created.md +41 -0
- package/docs/webhooks/payment-link-failed.md +45 -0
- package/docs/webhooks/payment-method-attached.md +40 -0
- package/docs/webhooks/payment-method-updated.md +38 -0
- package/docs/webhooks/payment-received.md +45 -0
- package/docs/webhooks/payment-recovered.md +39 -0
- package/docs/webhooks/payment-refunded.md +47 -0
- package/docs/webhooks/payment-retry-failed.md +39 -0
- package/docs/webhooks/payout-available.md +33 -0
- package/docs/webhooks/payout-created.md +48 -0
- package/docs/webhooks/payout-failed.md +52 -0
- package/docs/webhooks/payout-paid.md +48 -0
- package/docs/webhooks/quota-exceeded.md +44 -0
- package/docs/webhooks/quota-threshold-reached.md +41 -0
- package/docs/webhooks/seats-limit-reached.md +39 -0
- package/docs/webhooks/seats-updated.md +39 -0
- package/docs/webhooks/subscription-activated.md +43 -0
- package/docs/webhooks/subscription-canceled.md +57 -0
- package/docs/webhooks/subscription-cancellation-revoked.md +37 -0
- package/docs/webhooks/subscription-cancellation-scheduled.md +45 -0
- package/docs/webhooks/subscription-created.md +35 -0
- package/docs/webhooks/subscription-past-due.md +43 -0
- package/docs/webhooks/subscription-plan-change-revoked.md +50 -0
- package/docs/webhooks/subscription-plan-change-scheduled.md +55 -0
- package/docs/webhooks/subscription-plan-changed.md +43 -0
- package/docs/webhooks/subscription-reactivated.md +53 -0
- package/docs/webhooks/subscription-updated.md +39 -0
- package/docs/webhooks/trial-checkout-ready.md +39 -0
- package/docs/webhooks/trial-converted.md +39 -0
- package/docs/webhooks/trial-expired.md +39 -0
- package/docs/webhooks/trial-started.md +46 -0
- package/docs/webhooks/trial-will-end.md +41 -0
- package/docs/webhooks/usage-recorded.md +41 -0
- package/docs/webhooks.md +782 -0
- package/package.json +2 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-08-17
|
|
3
|
+
title: Grant Temporary Plan Access
|
|
4
|
+
description: Temporarily expand a subscription's features and limits without changing its plan, price, invoice, or billing cycle.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
A Plan Grant temporarily expands an active subscription's access. It does not change the subscription's plan, price, currency, billing anchor, period, invoice, payment method, or status.
|
|
8
|
+
|
|
9
|
+
Use a Plan Grant when a selected customer needs higher limits or additional features for an evaluation, migration, support exception, or negotiated access period without changing what they are billed.
|
|
10
|
+
|
|
11
|
+
## How access is resolved
|
|
12
|
+
|
|
13
|
+
The subscription keeps its immutable base-plan contract. The grant pins an immutable release of a higher plan and combines both contracts:
|
|
14
|
+
|
|
15
|
+
- boolean features are enabled when either contract enables them;
|
|
16
|
+
- included usage, quota, and seat limits use the higher allowance;
|
|
17
|
+
- unlimited access applies when either contract is unlimited; and
|
|
18
|
+
- paid overage is never introduced by the grant.
|
|
19
|
+
|
|
20
|
+
When the grant ends, Commet immediately evaluates access against the base subscription again. Existing seats and recorded usage are not deleted. If the customer is already above a base-plan hard limit, further use is blocked until usage resets, capacity falls below the limit, or the subscription is upgraded normally.
|
|
21
|
+
|
|
22
|
+
## Eligibility
|
|
23
|
+
|
|
24
|
+
The base subscription must be active and recurring. The target plan must belong to the same Plan Group and have a higher `sortOrder` than the base plan.
|
|
25
|
+
|
|
26
|
+
The initial release supports metered plans with boolean features and hard-capped usage, quota, or seat limits. Commet rejects a grant when either plan uses:
|
|
27
|
+
|
|
28
|
+
- Credits or Balance consumption;
|
|
29
|
+
- paid overage;
|
|
30
|
+
- AI model pricing; or
|
|
31
|
+
- active subscription add-ons.
|
|
32
|
+
|
|
33
|
+
The target plan may itself be free or paid. Its prices and billing intervals are irrelevant because the grant does not use them.
|
|
34
|
+
|
|
35
|
+
## Choose a duration
|
|
36
|
+
|
|
37
|
+
| Duration | Behavior |
|
|
38
|
+
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| `cycles` | Ends on an existing subscription billing boundary. One cycle means the current `currentPeriodEnd`; additional cycles advance from the same billing anchor. |
|
|
40
|
+
| `until_date` | Ends at the exact ISO timestamp provided. The Dashboard treats the selected date as the end of that day in UTC. |
|
|
41
|
+
| `until_revoked` | Continues until it is revoked or changed to a finite duration. |
|
|
42
|
+
|
|
43
|
+
Creating or updating a grant never restarts the billing cycle.
|
|
44
|
+
|
|
45
|
+
## Grant access
|
|
46
|
+
|
|
47
|
+
Create the grant with the customer, active subscription, and target plan public IDs:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
curl -X POST https://commet.co/api/v1/customers/cus_xxx/plan-grants \
|
|
51
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
52
|
+
-H "commet-version: 2026-07-31" \
|
|
53
|
+
-H "Content-Type: application/json" \
|
|
54
|
+
-d '{
|
|
55
|
+
"subscriptionId": "sub_xxx",
|
|
56
|
+
"planId": "pln_pro",
|
|
57
|
+
"duration": "cycles",
|
|
58
|
+
"durationCycles": 2,
|
|
59
|
+
"reason": "Selected customer evaluation"
|
|
60
|
+
}'
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Access expands immediately. No checkout, invoice, charge, credit, or subscription plan change is created.
|
|
64
|
+
|
|
65
|
+
## Update the duration
|
|
66
|
+
|
|
67
|
+
Use the grant public ID to change its remaining duration:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
curl -X PATCH https://commet.co/api/v1/customers/cus_xxx/plan-grants/grt_xxx \
|
|
71
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
72
|
+
-H "commet-version: 2026-07-31" \
|
|
73
|
+
-H "Content-Type: application/json" \
|
|
74
|
+
-d '{
|
|
75
|
+
"duration": "until_date",
|
|
76
|
+
"expiresAt": "2026-10-31T23:59:59.999Z",
|
|
77
|
+
"reason": "Extended evaluation"
|
|
78
|
+
}'
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
You can also send `until_revoked`, or `cycles` with a new `durationCycles` value. A new cycle count is resolved from the subscription's current period and original billing anchor.
|
|
82
|
+
|
|
83
|
+
## Revoke access
|
|
84
|
+
|
|
85
|
+
Revocation restores base-plan access immediately:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
curl -X POST https://commet.co/api/v1/customers/cus_xxx/plan-grants/grt_xxx/revoke \
|
|
89
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
90
|
+
-H "commet-version: 2026-07-31" \
|
|
91
|
+
-H "Content-Type: application/json" \
|
|
92
|
+
-d '{"reason":"Evaluation ended"}'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Revocation does not create a full-price obligation, re-anchor the subscription, or move it to `pending_payment`.
|
|
96
|
+
|
|
97
|
+
## Plan Grants, Offers, trials, and Invoice Credit
|
|
98
|
+
|
|
99
|
+
| Need | Use |
|
|
100
|
+
| ---------------------------------------------------------------------- | -------------- |
|
|
101
|
+
| Temporarily expand features or limits without changing billing | Plan Grant |
|
|
102
|
+
| Temporarily change reusable commercial terms | Offer |
|
|
103
|
+
| Delay the first recurring charge as part of the subscription lifecycle | Trial |
|
|
104
|
+
| Reduce invoice totals in one currency | Invoice Credit |
|
|
105
|
+
|
|
106
|
+
## Keep access in sync
|
|
107
|
+
|
|
108
|
+
Listen for [`customer.state_changed`](/docs/webhooks/customer-state-changed). `plan_access_granted` reports activation, while `plan_access_ended` reports expiration or revocation.
|
|
109
|
+
|
|
110
|
+
List a customer's grants to inspect their status and duration-change timeline:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
curl https://commet.co/api/v1/customers/cus_xxx/plan-grants \
|
|
114
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
115
|
+
-H "commet-version: 2026-07-31"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
See the [Plan Grants API reference](/docs/api-reference/customers/list-plan-grants) for exact request and response schemas.
|
|
119
|
+
|
|
120
|
+
## Related
|
|
121
|
+
|
|
122
|
+
- [Manage Subscriptions](/docs/manage-subscriptions)
|
|
123
|
+
- [Introductory Offers](/docs/introductory-offers)
|
|
124
|
+
- [Customer State Changed](/docs/webhooks/customer-state-changed)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-08-17
|
|
3
|
+
title: Upgrade and Downgrade Plans
|
|
4
|
+
description: How customers change plans through the Customer Portal and dashboard.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Customers change plans through the [Customer Portal](/docs/customer-portal) or from the dashboard. Commet handles proration, feature transitions, and billing adjustments automatically.
|
|
8
|
+
|
|
9
|
+
## Plan change behavior
|
|
10
|
+
|
|
11
|
+
| Change | Behavior | Example |
|
|
12
|
+
| -------------------------- | ----------------------------------------- | ------------------------- |
|
|
13
|
+
| **Upgrade** | Applied immediately with prorated billing | Starter ($29) → Pro ($99) |
|
|
14
|
+
| **Downgrade** | Takes effect at next renewal | Pro ($99) → Starter ($29) |
|
|
15
|
+
| **Interval change (up)** | Applied immediately | Monthly → Yearly |
|
|
16
|
+
| **Interval change (down)** | Takes effect at next renewal | Yearly → Monthly |
|
|
17
|
+
|
|
18
|
+
Both plans must be in the same [Plan Group](/docs/plan-groups) for customers to change plans themselves through the portal. Free-to-paid changes require a new checkout — the customer is redirected to complete payment.
|
|
19
|
+
|
|
20
|
+
An immediate upgrade is rejected with a seat-limit error when the customer's current seats exceed the target plan's included seats for a seat feature that is not unlimited and has overage disabled. Reduce seats first, or pick a plan with enough included seats. Interval-only changes and scheduled downgrades are not affected.
|
|
21
|
+
|
|
22
|
+
If you need to expand features or limits temporarily without changing the subscription's plan, price, or billing cycle, use a [Plan Grant](/docs/plan-grants) instead.
|
|
23
|
+
|
|
24
|
+
## Dashboard
|
|
25
|
+
|
|
26
|
+
From a customer's subscription detail page, click **Change Plan** and select the new plan. The same upgrade/downgrade rules apply.
|
|
27
|
+
|
|
28
|
+
## Learn more
|
|
29
|
+
|
|
30
|
+
- [What Happens When a Customer Changes Plans](/docs/what-happens-when-a-customer-changes-plans)
|
|
31
|
+
- [How Is Proration Calculated](/docs/how-is-proration-calculated-when-changing-plans)
|
|
32
|
+
|
|
33
|
+
## Related
|
|
34
|
+
|
|
35
|
+
- [Manage Subscriptions](/docs/manage-subscriptions) — Create, get, and cancel subscriptions
|
|
36
|
+
- [Plan Groups](/docs/plan-groups) — Group plans together for self-service upgrades
|
|
37
|
+
- [Customer Portal](/docs/customer-portal) — Self-service billing portal for customers
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-08-12
|
|
3
|
+
title: Testing
|
|
4
|
+
description: Test safely with sandbox environment
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Sandbox is the default environment — completely isolated from production.
|
|
8
|
+
|
|
9
|
+
## Test Flow
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// 1. Create customer
|
|
13
|
+
const customerId = `test_${Date.now()}`
|
|
14
|
+
const customer = await commet.customers.create({
|
|
15
|
+
email: 'test@example.com',
|
|
16
|
+
id: customerId,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
// 2. Create subscription
|
|
20
|
+
const subscription = await commet.subscriptions.create({
|
|
21
|
+
customerId,
|
|
22
|
+
planCode: 'pro',
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
// 3. Pay with test card at checkoutUrl
|
|
26
|
+
|
|
27
|
+
// 4. Track usage
|
|
28
|
+
await commet.usage.track({
|
|
29
|
+
customerId,
|
|
30
|
+
featureCode: 'api_calls',
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Dev Tools Panel
|
|
35
|
+
|
|
36
|
+
A floating widget that appears on all sandbox pages. The [**Test Clock**](#test-clock) tab is available everywhere. The [**Test Data**](#test-data) tab (address and card presets) only appears on checkout pages.
|
|
37
|
+
|
|
38
|
+
### Test Clock
|
|
39
|
+
|
|
40
|
+
Simulate future dates to test billing cycles, renewals, and prorations without waiting for real time to pass. Advancing the clock from the dashboard processes every due billing deadline before the clock reaches the selected time.
|
|
41
|
+
|
|
42
|
+
**Current Time** — displays the simulated time in UTC, or the real time if no simulation is active.
|
|
43
|
+
|
|
44
|
+
**Set Time** — pick a future date from a calendar. Before the run starts, the panel shows the target time and the number of currently scheduled deadlines it expects to process. Time can only move forward and cannot be reverted.
|
|
45
|
+
|
|
46
|
+
**Quick Advance** — jump forward by a preset amount:
|
|
47
|
+
|
|
48
|
+
| Button | Days |
|
|
49
|
+
| ---------- | ---- |
|
|
50
|
+
| + 1 Day | 1 |
|
|
51
|
+
| + 1 Week | 7 |
|
|
52
|
+
| + 2 Weeks | 14 |
|
|
53
|
+
| + 1 Month | 30 |
|
|
54
|
+
| + 3 Months | 90 |
|
|
55
|
+
|
|
56
|
+
**Run progress** — after confirmation, the panel processes due renewals, trial endings, scheduled changes, cancellations, entitlement resets, and dunning retries in chronological order. Progress and per-subscription outcomes remain visible if you reload or reopen the panel.
|
|
57
|
+
|
|
58
|
+
**Example workflow:** choose **+ 1 Month**, review the estimated impact, then confirm **Advance and Process**. The clock reaches the target after the run finishes.
|
|
59
|
+
|
|
60
|
+
#### Test Clock with the SDK
|
|
61
|
+
|
|
62
|
+
The API starts the same durable run as the dashboard. Advancing the clock returns `202 Accepted` with the new run; poll the clock state to follow its progress and terminal per-deadline outcomes. These methods are sandbox only.
|
|
63
|
+
|
|
64
|
+
**Read the current state**
|
|
65
|
+
|
|
66
|
+
### TypeScript
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const clock = await commet.testClock.get()
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Python
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
clock = commet.test_clock.get()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Go
|
|
79
|
+
|
|
80
|
+
```go
|
|
81
|
+
clock, err := client.TestClock.Get(ctx)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Java
|
|
85
|
+
|
|
86
|
+
```java
|
|
87
|
+
var clock = commet.testClock().get();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### PHP
|
|
91
|
+
|
|
92
|
+
```php
|
|
93
|
+
$clock = $commet->testClock->get();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### cURL
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
curl "https://commet.co/api/v1/test-clock" \
|
|
100
|
+
-H "x-api-key: $COMMET_API_KEY"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Advance the clock and process billing**
|
|
104
|
+
|
|
105
|
+
Move the clock forward and process every billing deadline due before the target time. The clock can only move forward.
|
|
106
|
+
|
|
107
|
+
### TypeScript
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
await commet.testClock.advance({ advanceDays: 30 })
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Python
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
commet.test_clock.advance(advance_days=30)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Go
|
|
120
|
+
|
|
121
|
+
```go
|
|
122
|
+
days := 30
|
|
123
|
+
_, err := client.TestClock.Advance(ctx, &commet.AdvanceTestClockParams{
|
|
124
|
+
AdvanceDays: &days,
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Java
|
|
129
|
+
|
|
130
|
+
```java
|
|
131
|
+
commet.testClock().advance(AdvanceTestClockParams.builder().advanceDays(30L).build());
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### PHP
|
|
135
|
+
|
|
136
|
+
```php
|
|
137
|
+
$commet->testClock->advance(advanceDays: 30);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### cURL
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
curl -X POST https://commet.co/api/v1/test-clock \
|
|
144
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
145
|
+
-H "Content-Type: application/json" \
|
|
146
|
+
-d '{"advanceDays": 30}'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The former `POST /test-clock/process-billing` operation is deprecated and returns `410 Gone`. Remove separate `processBilling()` calls; advancing the clock now performs that work automatically.
|
|
150
|
+
|
|
151
|
+
### Test Data
|
|
152
|
+
|
|
153
|
+
The Test Data tab automates checkout form filling with valid, country-specific test data. Open it from the Dev Tools panel on any sandbox checkout page.
|
|
154
|
+
|
|
155
|
+
**Address autofill** — select a country and the checkout form is automatically filled with a valid name, email, street, city, state, and postal code for that country. No need to type anything manually.
|
|
156
|
+
|
|
157
|
+
**Country-specific test cards** — after selecting a country, the panel shows the test cards that match that country. Click one and the card fields are filled for you. Expiry and CVC are always `12/34` and `123`.
|
|
158
|
+
|
|
159
|
+
**Failure scenarios** — the panel also offers generic cards to test error handling: declined payment, insufficient funds, and expired card. For 3D Secure authentication, use the cards in the table below.
|
|
160
|
+
|
|
161
|
+
#### Test cards by country
|
|
162
|
+
|
|
163
|
+
| Country | Card | Brand |
|
|
164
|
+
| ------------------------- | --------------------- | ------------ |
|
|
165
|
+
| United States (US) | `4242 4242 4242 4242` | Visa |
|
|
166
|
+
| Argentina (AR) | `4000 0032 0000 0021` | Visa |
|
|
167
|
+
| Australia (AU) | `4000 0003 6000 0006` | Visa |
|
|
168
|
+
| Austria (AT) | `4000 0004 0000 0008` | Visa |
|
|
169
|
+
| Belarus (BY) | `4000 0011 2000 0005` | Visa |
|
|
170
|
+
| Belgium (BE) | `4000 0005 6000 0004` | Visa |
|
|
171
|
+
| Brazil (BR) | `4000 0076 0000 0002` | Visa |
|
|
172
|
+
| Bulgaria (BG) | `4000 0010 0000 0000` | Visa |
|
|
173
|
+
| Canada (CA) | `4000 0012 4000 0000` | Visa |
|
|
174
|
+
| Chile (CL) | `4000 0015 2000 0001` | Visa |
|
|
175
|
+
| China (CN) | `4000 0015 6000 0002` | Visa |
|
|
176
|
+
| Colombia (CO) | `4000 0017 0000 0003` | Visa |
|
|
177
|
+
| Costa Rica (CR) | `4000 0018 8000 0005` | Visa |
|
|
178
|
+
| Croatia (HR) | `4000 0019 1000 0009` | Visa |
|
|
179
|
+
| Cyprus (CY) | `4000 0019 6000 0008` | Visa |
|
|
180
|
+
| Czechia (CZ) | `4000 0020 3000 0002` | Visa |
|
|
181
|
+
| Denmark (DK) | `4000 0020 8000 0001` | Visa |
|
|
182
|
+
| Ecuador (EC) | `4000 0021 8000 0000` | Visa |
|
|
183
|
+
| Estonia (EE) | `4000 0023 3000 0009` | Visa |
|
|
184
|
+
| Finland (FI) | `4000 0024 6000 0001` | Visa |
|
|
185
|
+
| France (FR) | `4000 0025 0000 0003` | Visa |
|
|
186
|
+
| Germany (DE) | `4000 0027 6000 0016` | Visa |
|
|
187
|
+
| Gibraltar (GI) | `4000 0029 2000 0005` | Visa |
|
|
188
|
+
| Greece (GR) | `4000 0030 0000 0030` | Visa |
|
|
189
|
+
| Hong Kong (HK) | `4000 0034 4000 0004` | Visa |
|
|
190
|
+
| Hungary (HU) | `4000 0034 8000 0005` | Visa |
|
|
191
|
+
| India (IN) | `4000 0035 6000 0008` | Visa |
|
|
192
|
+
| Ireland (IE) | `4000 0037 2000 0005` | Visa |
|
|
193
|
+
| Italy (IT) | `4000 0038 0000 0008` | Visa |
|
|
194
|
+
| Japan (JP) | `4000 0039 2000 0003` | Visa |
|
|
195
|
+
| Japan (JP) | `3530 1113 3330 0000` | JCB |
|
|
196
|
+
| Latvia (LV) | `4000 0042 8000 0005` | Visa |
|
|
197
|
+
| Liechtenstein (LI) | `4000 0043 8000 0004` | Visa |
|
|
198
|
+
| Lithuania (LT) | `4000 0044 0000 0000` | Visa |
|
|
199
|
+
| Luxembourg (LU) | `4000 0044 2000 0006` | Visa |
|
|
200
|
+
| Malaysia (MY) | `4000 0045 8000 0002` | Visa |
|
|
201
|
+
| Malta (MT) | `4000 0047 0000 0007` | Visa |
|
|
202
|
+
| Mexico (MX) | `4000 0048 4000 8001` | Visa |
|
|
203
|
+
| Mexico (MX) | `5062 2100 0000 0009` | Carnet |
|
|
204
|
+
| Netherlands (NL) | `4000 0052 8000 0002` | Visa |
|
|
205
|
+
| New Zealand (NZ) | `4000 0055 4000 0008` | Visa |
|
|
206
|
+
| Norway (NO) | `4000 0057 8000 0007` | Visa |
|
|
207
|
+
| Panama (PA) | `4000 0059 1000 0000` | Visa |
|
|
208
|
+
| Paraguay (PY) | `4000 0060 0000 0066` | Visa |
|
|
209
|
+
| Peru (PE) | `4000 0060 4000 0068` | Visa |
|
|
210
|
+
| Poland (PL) | `4000 0061 6000 0005` | Visa |
|
|
211
|
+
| Portugal (PT) | `4000 0062 0000 0007` | Visa |
|
|
212
|
+
| Romania (RO) | `4000 0064 2000 0001` | Visa |
|
|
213
|
+
| Saudi Arabia (SA) | `4000 0068 2000 0007` | Visa |
|
|
214
|
+
| Singapore (SG) | `4000 0070 2000 0003` | Visa |
|
|
215
|
+
| Slovakia (SK) | `4000 0070 3000 0001` | Visa |
|
|
216
|
+
| Slovenia (SI) | `4000 0070 5000 0006` | Visa |
|
|
217
|
+
| Spain (ES) | `4000 0072 4000 0007` | Visa |
|
|
218
|
+
| Sweden (SE) | `4000 0075 2000 0008` | Visa |
|
|
219
|
+
| Switzerland (CH) | `4000 0075 6000 0009` | Visa |
|
|
220
|
+
| Taiwan (TW) | `4000 0015 8000 0008` | Visa |
|
|
221
|
+
| Thailand (TH) | `4000 0076 4000 0003` | Visa |
|
|
222
|
+
| Thailand (TH) | `4000 0576 4000 0008` | Visa (debit) |
|
|
223
|
+
| United Arab Emirates (AE) | `4000 0078 4000 0001` | Visa |
|
|
224
|
+
| United Arab Emirates (AE) | `5200 0078 4000 0022` | Mastercard |
|
|
225
|
+
| United Kingdom (GB) | `4000 0082 6000 0000` | Visa |
|
|
226
|
+
| United Kingdom (GB) | `4000 0582 6000 0005` | Visa (debit) |
|
|
227
|
+
| United Kingdom (GB) | `5555 5582 6555 4449` | Mastercard |
|
|
228
|
+
| Uruguay (UY) | `4000 0085 8000 0003` | Visa |
|
|
229
|
+
|
|
230
|
+
#### Failure scenarios
|
|
231
|
+
|
|
232
|
+
| Card | Scenario |
|
|
233
|
+
| --------------------- | ------------------ |
|
|
234
|
+
| `4000 0000 0000 9995` | Insufficient funds |
|
|
235
|
+
| `4000 0000 0000 0002` | Card declined |
|
|
236
|
+
| `4000 0000 0000 0069` | Expired card |
|
|
237
|
+
|
|
238
|
+
#### 3D Secure
|
|
239
|
+
|
|
240
|
+
| Card | Description |
|
|
241
|
+
| --------------------- | ----------------------- |
|
|
242
|
+
| `4000 0000 0000 3220` | Requires authentication |
|
|
243
|
+
| `4000 0025 0000 3155` | Requires authentication |
|
|
244
|
+
|
|
245
|
+
## Production
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
const commet = new Commet({
|
|
249
|
+
apiKey: process.env.COMMET_PRODUCTION_KEY!,
|
|
250
|
+
})
|
|
251
|
+
```
|