@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,142 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-07-28
|
|
3
|
+
title: One-Time Payments
|
|
4
|
+
description: Sell lifetime access or one-time purchases with a single charge and no recurring billing.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
A one-time payment plan charges the customer once at checkout and never bills again for the plan base. Use it for lifetime deals, one-off purchases, or any plan where recurring billing doesn't apply.
|
|
8
|
+
|
|
9
|
+
> **Note**
|
|
10
|
+
>
|
|
11
|
+
> This page covers one-time charges billed as a **plan**. To charge a customer once with **no subscription or plan** — a standalone invoice with tax and receipt — use [Accept One-Time Payments](/docs/accept-one-time-payments) instead.
|
|
12
|
+
|
|
13
|
+
One-time plans behave like any other plan — they support [trials](/docs/trial-periods), [intro offers](/docs/introductory-offers), [add-ons](/docs/add-ons), and all [consumption models](/docs/consumption-models). The only differences are:
|
|
14
|
+
|
|
15
|
+
| Aspect | Behavior |
|
|
16
|
+
| -------------------- | ------------------------------------------------------------------------- |
|
|
17
|
+
| **Billing** | Plan base charged once at checkout. Overage billed at each billing cycle. |
|
|
18
|
+
| **Cancellation** | Not allowed — the subscription stays active permanently |
|
|
19
|
+
| **Interval changes** | Not allowed — cannot switch from one-time to a recurring interval |
|
|
20
|
+
|
|
21
|
+
## Configure in the dashboard
|
|
22
|
+
|
|
23
|
+
In the dashboard, go to **Plans**, edit a plan, and add a price with interval **One-time (lifetime)**. You can combine one-time prices with recurring intervals on the same plan — each price has its own interval.
|
|
24
|
+
|
|
25
|
+
## Create a one-time subscription
|
|
26
|
+
|
|
27
|
+
### TypeScript
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
const subscription = await commet.subscriptions.create({
|
|
31
|
+
customerId: 'user_123',
|
|
32
|
+
planCode: 'pro',
|
|
33
|
+
billingInterval: 'one_time',
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
if (!subscription.checkoutUrl) {
|
|
37
|
+
throw new Error('Commet did not return a checkout URL')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
redirect(subscription.checkoutUrl)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Python
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
subscription = commet.subscriptions.create(
|
|
47
|
+
customer_id='user_123',
|
|
48
|
+
plan_code='pro',
|
|
49
|
+
billing_interval='one_time',
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
if not subscription.checkout_url:
|
|
53
|
+
raise RuntimeError('Commet did not return a checkout URL')
|
|
54
|
+
|
|
55
|
+
redirect(subscription.checkout_url)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Go
|
|
59
|
+
|
|
60
|
+
```go
|
|
61
|
+
planCode := "pro"
|
|
62
|
+
billingInterval := "one_time"
|
|
63
|
+
subscription, err := client.Subscriptions.Create(ctx, &commet.CreateSubscriptionParams{
|
|
64
|
+
CustomerID: "user_123",
|
|
65
|
+
PlanCode: &planCode,
|
|
66
|
+
BillingInterval: &billingInterval,
|
|
67
|
+
})
|
|
68
|
+
if err != nil {
|
|
69
|
+
log.Fatal(err)
|
|
70
|
+
}
|
|
71
|
+
if subscription.CheckoutURL == nil {
|
|
72
|
+
log.Fatal("Commet did not return a checkout URL")
|
|
73
|
+
}
|
|
74
|
+
http.Redirect(w, r, *subscription.CheckoutURL, http.StatusSeeOther)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Java
|
|
78
|
+
|
|
79
|
+
```java
|
|
80
|
+
CreateSubscriptionParams params = CreateSubscriptionParams.builder()
|
|
81
|
+
.customerId("user_123")
|
|
82
|
+
.planCode("pro")
|
|
83
|
+
.billingInterval("one_time")
|
|
84
|
+
.build();
|
|
85
|
+
var subscription = commet.subscriptions().create(params);
|
|
86
|
+
if (subscription.checkoutUrl() == null) {
|
|
87
|
+
throw new IllegalStateException("Commet did not return a checkout URL");
|
|
88
|
+
}
|
|
89
|
+
redirect(subscription.checkoutUrl());
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### PHP
|
|
93
|
+
|
|
94
|
+
```php
|
|
95
|
+
$result = $commet->subscriptions->create(
|
|
96
|
+
customerId: 'user_123',
|
|
97
|
+
planCode: 'pro',
|
|
98
|
+
billingInterval: 'one_time',
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
if ($result->checkoutUrl === null) {
|
|
102
|
+
throw new RuntimeException('Commet did not return a checkout URL');
|
|
103
|
+
}
|
|
104
|
+
redirect($result->checkoutUrl);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### cURL
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
curl -X POST https://commet.co/api/v1/subscriptions \
|
|
111
|
+
-H "x-api-key: $COMMET_API_KEY" \
|
|
112
|
+
-H "Content-Type: application/json" \
|
|
113
|
+
-d '{
|
|
114
|
+
"customerId": "user_123",
|
|
115
|
+
"planCode": "pro",
|
|
116
|
+
"billingInterval": "one_time"
|
|
117
|
+
}'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The `billingInterval` must be `one_time` and the plan must have a one-time price configured. If the plan's default price is already one-time, you can omit the `billingInterval` parameter.
|
|
121
|
+
|
|
122
|
+
## Invoicing
|
|
123
|
+
|
|
124
|
+
The initial invoice includes the plan base price as a one-time charge. After that, subsequent billing cycles only generate invoices for overage — the plan base is never charged again.
|
|
125
|
+
|
|
126
|
+
| Invoice | What's included |
|
|
127
|
+
| --------------------- | ------------------------------------------------------------------------ |
|
|
128
|
+
| **Initial** | `plan_base` (once) + any applicable intro offer discount |
|
|
129
|
+
| **Subsequent cycles** | `feature_overage`, `feature_seats`, `addon_base` — only if charges exist |
|
|
130
|
+
|
|
131
|
+
If there's no overage or additional charges at a billing cycle, no invoice is generated.
|
|
132
|
+
|
|
133
|
+
## Customer portal
|
|
134
|
+
|
|
135
|
+
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).
|
|
136
|
+
|
|
137
|
+
## Related
|
|
138
|
+
|
|
139
|
+
- [Manage Plans](/docs/create-plans) — Create and configure plans
|
|
140
|
+
- [Manage Subscriptions](/docs/manage-subscriptions) — Full subscription lifecycle
|
|
141
|
+
- [Invoices and Billing Cycles](/docs/invoices-and-billing-cycles) — How invoicing works
|
|
142
|
+
- [Consumption Models](/docs/consumption-models) — Metered, Credits, and Balance explained
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-03-28
|
|
3
|
+
title: Plan Groups
|
|
4
|
+
description: Group plans together to enable self-service upgrades and downgrades in the Commet Customer Portal.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Plan Groups let customers upgrade or downgrade between plans themselves through the [Customer Portal](/docs/customer-portal). Without a Plan Group, customers won't see upgrade/downgrade options in their portal.
|
|
8
|
+
|
|
9
|
+
## Plan group components
|
|
10
|
+
|
|
11
|
+
| Component | Description | Example |
|
|
12
|
+
| -------------- | ----------------------------------------- | ------------------ |
|
|
13
|
+
| **Group Name** | Name for the collection | "Standard Plans" |
|
|
14
|
+
| **Plans** | Plans in the group, ordered low to high | Free, Starter, Pro |
|
|
15
|
+
| **Hierarchy** | Drag-and-drop order defining upgrade path | Lowest tier first |
|
|
16
|
+
|
|
17
|
+
## Create a plan group in the dashboard
|
|
18
|
+
|
|
19
|
+
Go to **Plan Groups** and click **Create Plan Group**. Name the group, add your plans, then drag and drop to arrange them from lowest to highest tier. Each plan can only belong to one group. Plans with [Regional Prices](/docs/regional-prices) can be added, but all plans in a group must support the same set of currencies so any subscriber can move between them.
|
|
20
|
+
|
|
21
|
+
This order defines the upgrade path and display order in the Customer Portal.
|
|
22
|
+
|
|
23
|
+
## Learn more
|
|
24
|
+
|
|
25
|
+
- [What Happens When a Customer Changes Plans](/docs/what-happens-when-a-customer-changes-plans)
|
|
26
|
+
|
|
27
|
+
## Related
|
|
28
|
+
|
|
29
|
+
- [Manage Plans](/docs/create-plans) — Create plans to add to groups
|
|
30
|
+
- [Upgrade and Downgrade Plans](/docs/upgrade-and-downgrade-plans) — How plan changes work
|
|
31
|
+
- [Customer Portal](/docs/customer-portal) — Where customers change plans
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-08-16
|
|
3
|
+
title: Custom Domains
|
|
4
|
+
description: Serve checkout and the Customer Portal from branded subdomains you control.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Custom domains replace `commet.co` in new hosted checkout and Customer Portal links. Configure them under **Settings → Custom Domains**.
|
|
8
|
+
|
|
9
|
+
Commet supports separate domains for each surface:
|
|
10
|
+
|
|
11
|
+
- **Checkout**, such as `checkout.example.com`.
|
|
12
|
+
- **Customer Portal**, such as `billing.example.com`.
|
|
13
|
+
|
|
14
|
+
## Add and verify a domain
|
|
15
|
+
|
|
16
|
+
1. Choose the surface and add a subdomain you own.
|
|
17
|
+
2. Add every DNS record shown by Commet at your DNS provider. This is normally one CNAME and one ownership TXT record.
|
|
18
|
+
3. Return to the dashboard and verify the domain.
|
|
19
|
+
4. Wait for DNS propagation if verification remains pending.
|
|
20
|
+
|
|
21
|
+
The hostname becomes active only after verification. Existing hosted links remain valid; newly generated links use the verified custom domain for that surface.
|
|
22
|
+
|
|
23
|
+
If the hostname is already registered to another Vercel account, Commet also shows a `vc-domain-verify` TXT record. Add that extra record before retrying verification.
|
|
24
|
+
|
|
25
|
+
Use a dedicated subdomain rather than a root domain already serving your application. Removing a domain returns future hosted links to the default Commet domain.
|
|
26
|
+
|
|
27
|
+
Custom-domain management is currently a dashboard workflow. Your application continues to request checkout and portal URLs through the same SDK operations.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-08-16
|
|
3
|
+
title: Dashboard Metrics and Usage Events
|
|
4
|
+
description: Understand MRR, revenue, churn, active subscriptions, and the usage-event explorer.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The dashboard summarizes confirmed billing records. Use it for operational review, not as a replacement for your accounting ledger or product analytics.
|
|
8
|
+
|
|
9
|
+
| Metric | Current calculation |
|
|
10
|
+
| ------------------------ | ------------------------------------------------------------------------------------------ |
|
|
11
|
+
| **MRR** | Latest successful gross payment per active subscription, normalized by billing interval |
|
|
12
|
+
| **Total revenue** | Successful gross transactions paid during the current calendar month |
|
|
13
|
+
| **Revenue growth** | Percentage change between current and previous monthly recurring revenue |
|
|
14
|
+
| **Churn** | Subscriptions canceled in the last 30 days divided by the eligible subscription population |
|
|
15
|
+
| **Active subscriptions** | Current subscriptions whose persisted status is `active` |
|
|
16
|
+
|
|
17
|
+
Metrics are cached and can lag recent writes briefly. Investigate an exact payment in **Transactions** and its accounting result in **Invoices**.
|
|
18
|
+
|
|
19
|
+
## Usage Events
|
|
20
|
+
|
|
21
|
+
Open **Events** to inspect the usage records sent by your integration. Each row shows the event ID, feature, customer, timestamp, value, kind, and custom properties. Filter by customer or feature when reconciling a usage total.
|
|
22
|
+
|
|
23
|
+
The event timestamp describes when usage occurred; creation time describes when Commet received it. Stable idempotency keys prevent retries from becoming duplicate billable events.
|
|
24
|
+
|
|
25
|
+
See [Track Usage](/docs/track-usage) for implementation and [Invoices and Billing Cycles](/docs/invoices-and-billing-cycles) for settlement timing.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-08-16
|
|
3
|
+
title: Members and Permissions
|
|
4
|
+
description: Invite teammates and choose who can manage organization configuration.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Manage team access under **Settings → Members** in the live organization. Membership lives on that live organization and grants the same team access to its sandboxes. Invitations can assign one of three roles.
|
|
8
|
+
|
|
9
|
+
| Role | Intended responsibility |
|
|
10
|
+
| ---------- | -------------------------------------------------------------------- |
|
|
11
|
+
| **Owner** | Organization ownership and the most sensitive administrative actions |
|
|
12
|
+
| **Admin** | Operational configuration and member management |
|
|
13
|
+
| **Member** | Day-to-day access without organization administration |
|
|
14
|
+
|
|
15
|
+
Owners and admins can invite members, change supported roles, cancel pending invitations, and remove members. An admin cannot manage the owner as if they were a normal member.
|
|
16
|
+
|
|
17
|
+
Member changes are available only from the live organization. Switch back to live before inviting someone or changing access for the live-and-sandbox group.
|
|
18
|
+
|
|
19
|
+
Invite each person with their own account. Do not share dashboard credentials or use a human login as an application credential; server workloads use [API keys](/docs/create-api-key).
|
|
20
|
+
|
|
21
|
+
Permissions protect dashboard actions, but they do not narrow an API key to the member who created it. Rotate or delete keys independently when a workload or team boundary changes.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-08-16
|
|
3
|
+
title: Organization Settings
|
|
4
|
+
description: Configure the organization identity, customer emails, notification recipient, language, and environment boundaries.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
An organization is an isolated billing environment. Its customers, catalog, API keys, providers, transactions, and webhooks do not cross into another organization.
|
|
8
|
+
|
|
9
|
+
## Sandbox and live
|
|
10
|
+
|
|
11
|
+
Every live organization has a paired sandbox for development. Switch organizations from the dashboard header and confirm the environment before creating catalog data or API keys. IDs created in sandbox are not valid in live.
|
|
12
|
+
|
|
13
|
+
## Identity and URLs
|
|
14
|
+
|
|
15
|
+
Under **Settings → Organization**, configure the visible name, logo, and slug. The slug identifies dashboard and hosted-page URLs; changing it does not change customer or subscription IDs.
|
|
16
|
+
|
|
17
|
+
## Customer communication
|
|
18
|
+
|
|
19
|
+
Choose whether Commet sends transactional emails for payments, invoices, and subscription changes. When disabled, Commet sends no customer transactional email; your application must send its own messages from the corresponding webhooks.
|
|
20
|
+
|
|
21
|
+
Set the email language and the internal notification recipient separately. The notification recipient receives important organization alerts and does not replace customer billing email addresses.
|
|
22
|
+
|
|
23
|
+
## Archive an organization
|
|
24
|
+
|
|
25
|
+
Only an owner can archive an organization. Archiving a live organization also archives every sandbox under it, removes access, releases its slug, and removes its custom and email domains. Billing records are retained for compliance, but you cannot access them afterward and the action is irreversible.
|
|
26
|
+
|
|
27
|
+
Export required records and disconnect workloads first. Do not archive an organization to clear test data; use a sandbox instead.
|
|
28
|
+
|
|
29
|
+
API keys and most organization settings are environment-specific. See [Create an API Key](/docs/create-api-key) and [Testing](/docs/testing-sandbox).
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-07-28
|
|
3
|
+
title: Integrate with Django
|
|
4
|
+
description: Add billing and payments to your Django application.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Install the Commet Skill so your coding agent can integrate the current SDK and verify its work against the live API contract.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx skills add commet-labs/skills --skill commet
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
1. ## Install
|
|
14
|
+
### pip
|
|
15
|
+
```bash
|
|
16
|
+
pip install commet-sdk django
|
|
17
|
+
```
|
|
18
|
+
### uv
|
|
19
|
+
```bash
|
|
20
|
+
uv add commet-sdk django
|
|
21
|
+
```
|
|
22
|
+
### poetry
|
|
23
|
+
```bash
|
|
24
|
+
poetry add commet-sdk django
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. ## Configure
|
|
28
|
+
```bash title=".env"
|
|
29
|
+
COMMET_API_KEY=ck_sandbox_xxx
|
|
30
|
+
```
|
|
31
|
+
```python title="billing/commet_client.py"
|
|
32
|
+
import os
|
|
33
|
+
from commet import Commet
|
|
34
|
+
|
|
35
|
+
commet = Commet(
|
|
36
|
+
api_key=os.environ["COMMET_API_KEY"],
|
|
37
|
+
)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
3. ## Subscribe
|
|
41
|
+
```python title="billing/views.py"
|
|
42
|
+
import json
|
|
43
|
+
from django.http import JsonResponse
|
|
44
|
+
from django.views.decorators.http import require_POST
|
|
45
|
+
from .commet_client import commet
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@require_POST
|
|
49
|
+
def subscribe(request):
|
|
50
|
+
data = json.loads(request.body)
|
|
51
|
+
|
|
52
|
+
commet.customers.create(
|
|
53
|
+
email=data["email"],
|
|
54
|
+
id=data["customer_id"],
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
subscription = commet.subscriptions.create(
|
|
58
|
+
customer_id=data["customer_id"],
|
|
59
|
+
plan_code="pro",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
return JsonResponse({"checkout_url": subscription.checkout_url})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
4. ## Check Access
|
|
66
|
+
```python title="billing/views.py"
|
|
67
|
+
def get_subscription(request, customer_id):
|
|
68
|
+
sub = commet.subscriptions.get_active(customer_id=customer_id)
|
|
69
|
+
if sub is None:
|
|
70
|
+
return JsonResponse({"error": "no_active_subscription"}, status=404)
|
|
71
|
+
return JsonResponse({"status": sub.status})
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def check_feature(request, feature, customer_id):
|
|
75
|
+
result = commet.feature_access.get(code=feature, customer_id=customer_id)
|
|
76
|
+
return JsonResponse({"allowed": result.allowed})
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
5. ## Track Usage
|
|
80
|
+
```python title="billing/views.py"
|
|
81
|
+
@require_POST
|
|
82
|
+
def track_usage(request):
|
|
83
|
+
data = json.loads(request.body)
|
|
84
|
+
|
|
85
|
+
commet.usage.track(
|
|
86
|
+
customer_id=data["customer_id"],
|
|
87
|
+
feature_code="api_calls",
|
|
88
|
+
value=1,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
return JsonResponse({"tracked": True})
|
|
92
|
+
```
|
|
93
|
+
Usage is aggregated and billed at end of period.
|
|
94
|
+
|
|
95
|
+
6. ## Customer Portal
|
|
96
|
+
```python title="billing/views.py"
|
|
97
|
+
from django.shortcuts import redirect
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def portal(request):
|
|
101
|
+
result = commet.portal.get_url(customer_id="user_123")
|
|
102
|
+
return redirect(result.portal_url)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
7. ## Webhooks
|
|
106
|
+
```python title="billing/views.py"
|
|
107
|
+
import os
|
|
108
|
+
|
|
109
|
+
from django.views.decorators.csrf import csrf_exempt
|
|
110
|
+
from commet import Webhooks
|
|
111
|
+
|
|
112
|
+
webhooks = Webhooks()
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@csrf_exempt
|
|
116
|
+
@require_POST
|
|
117
|
+
def handle_webhook(request):
|
|
118
|
+
payload = webhooks.verify_and_parse(
|
|
119
|
+
raw_body=request.body.decode(),
|
|
120
|
+
signature=request.headers.get("x-commet-signature"),
|
|
121
|
+
secret=os.environ["COMMET_WEBHOOK_SECRET"],
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
if payload is None:
|
|
125
|
+
return JsonResponse({"error": "Invalid signature"}, status=401)
|
|
126
|
+
|
|
127
|
+
if payload["event"] == "subscription.activated":
|
|
128
|
+
# handle activation
|
|
129
|
+
pass
|
|
130
|
+
|
|
131
|
+
return JsonResponse({"ok": True})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
8. ## URLs
|
|
135
|
+
```python title="billing/urls.py"
|
|
136
|
+
from django.urls import path
|
|
137
|
+
from . import views
|
|
138
|
+
|
|
139
|
+
urlpatterns = [
|
|
140
|
+
path("subscribe", views.subscribe),
|
|
141
|
+
path("subscription/<str:customer_id>", views.get_subscription),
|
|
142
|
+
path("features/<str:feature>/<str:customer_id>", views.check_feature),
|
|
143
|
+
path("usage", views.track_usage),
|
|
144
|
+
path("portal", views.portal),
|
|
145
|
+
path("webhooks/commet", views.handle_webhook),
|
|
146
|
+
]
|
|
147
|
+
```
|
|
148
|
+
```python title="project/urls.py"
|
|
149
|
+
from django.urls import path, include
|
|
150
|
+
|
|
151
|
+
urlpatterns = [
|
|
152
|
+
path("billing/", include("billing.urls")),
|
|
153
|
+
]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Related
|
|
157
|
+
|
|
158
|
+
- [Subscriptions](/docs/manage-subscriptions)
|
|
159
|
+
- [Track Usage](/docs/track-usage)
|
|
160
|
+
- [Customer Portal](/docs/customer-portal)
|
|
161
|
+
- [SDK Reference](/docs/sdk-reference)
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
lastModified: 2026-07-28
|
|
3
|
+
title: Integrate with FastAPI
|
|
4
|
+
description: Add billing and payments to your FastAPI application.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Install the Commet Skill so your coding agent can integrate the current SDK and verify its work against the live API contract.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx skills add commet-labs/skills --skill commet
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
1. ## Install
|
|
14
|
+
### pip
|
|
15
|
+
```bash
|
|
16
|
+
pip install commet-sdk fastapi uvicorn
|
|
17
|
+
```
|
|
18
|
+
### uv
|
|
19
|
+
```bash
|
|
20
|
+
uv add commet-sdk fastapi uvicorn
|
|
21
|
+
```
|
|
22
|
+
### poetry
|
|
23
|
+
```bash
|
|
24
|
+
poetry add commet-sdk fastapi uvicorn
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. ## Configure
|
|
28
|
+
```bash title=".env"
|
|
29
|
+
COMMET_API_KEY=ck_sandbox_xxx
|
|
30
|
+
```
|
|
31
|
+
```python title="commet_client.py"
|
|
32
|
+
import os
|
|
33
|
+
from commet import Commet
|
|
34
|
+
|
|
35
|
+
commet = Commet(
|
|
36
|
+
api_key=os.environ["COMMET_API_KEY"],
|
|
37
|
+
)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
3. ## Subscribe
|
|
41
|
+
```python title="routes/billing.py"
|
|
42
|
+
from fastapi import APIRouter, HTTPException
|
|
43
|
+
from pydantic import BaseModel
|
|
44
|
+
from commet_client import commet
|
|
45
|
+
|
|
46
|
+
router = APIRouter(prefix="/billing")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class SubscribeRequest(BaseModel):
|
|
50
|
+
customer_id: str
|
|
51
|
+
email: str
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@router.post("/subscribe")
|
|
55
|
+
def subscribe(body: SubscribeRequest):
|
|
56
|
+
commet.customers.create(
|
|
57
|
+
email=body.email,
|
|
58
|
+
id=body.customer_id,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
subscription = commet.subscriptions.create(
|
|
62
|
+
customer_id=body.customer_id,
|
|
63
|
+
plan_code="pro",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
return {"checkout_url": subscription.checkout_url}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
4. ## Check Access
|
|
70
|
+
```python title="routes/billing.py"
|
|
71
|
+
@router.get("/subscription/{customer_id}")
|
|
72
|
+
def get_subscription(customer_id: str):
|
|
73
|
+
sub = commet.subscriptions.get_active(customer_id=customer_id)
|
|
74
|
+
if sub is None:
|
|
75
|
+
raise HTTPException(status_code=404, detail="No active subscription")
|
|
76
|
+
return {"status": sub.status}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@router.get("/features/{feature}/{customer_id}")
|
|
80
|
+
def check_feature(feature: str, customer_id: str):
|
|
81
|
+
result = commet.feature_access.get(code=feature, customer_id=customer_id)
|
|
82
|
+
return {"allowed": result.allowed}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
5. ## Track Usage
|
|
86
|
+
```python title="routes/billing.py"
|
|
87
|
+
class UsageRequest(BaseModel):
|
|
88
|
+
customer_id: str
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@router.post("/usage")
|
|
92
|
+
def track_usage(body: UsageRequest):
|
|
93
|
+
commet.usage.track(
|
|
94
|
+
customer_id=body.customer_id,
|
|
95
|
+
feature_code="api_calls",
|
|
96
|
+
value=1,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
return {"tracked": True}
|
|
100
|
+
```
|
|
101
|
+
Usage is aggregated and billed at end of period.
|
|
102
|
+
|
|
103
|
+
6. ## Customer Portal
|
|
104
|
+
```python title="routes/billing.py"
|
|
105
|
+
from fastapi.responses import RedirectResponse
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@router.get("/portal")
|
|
109
|
+
def portal():
|
|
110
|
+
result = commet.portal.get_url(customer_id="user_123")
|
|
111
|
+
return RedirectResponse(result.portal_url)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
7. ## Webhooks
|
|
115
|
+
```python title="routes/webhooks.py"
|
|
116
|
+
import os
|
|
117
|
+
|
|
118
|
+
from fastapi import APIRouter, Request, Response
|
|
119
|
+
from commet import Webhooks
|
|
120
|
+
|
|
121
|
+
router = APIRouter()
|
|
122
|
+
webhooks = Webhooks()
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@router.post("/webhooks/commet")
|
|
126
|
+
async def handle_webhook(request: Request):
|
|
127
|
+
raw_body = await request.body()
|
|
128
|
+
|
|
129
|
+
payload = webhooks.verify_and_parse(
|
|
130
|
+
raw_body=raw_body.decode(),
|
|
131
|
+
signature=request.headers.get("x-commet-signature"),
|
|
132
|
+
secret=os.environ["COMMET_WEBHOOK_SECRET"],
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
if payload is None:
|
|
136
|
+
return Response(status_code=401)
|
|
137
|
+
|
|
138
|
+
if payload["event"] == "subscription.activated":
|
|
139
|
+
# handle activation
|
|
140
|
+
pass
|
|
141
|
+
|
|
142
|
+
return Response(status_code=200)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
8. ## Start Server
|
|
146
|
+
```python title="main.py"
|
|
147
|
+
from fastapi import FastAPI
|
|
148
|
+
from routes.billing import router as billing_router
|
|
149
|
+
from routes.webhooks import router as webhooks_router
|
|
150
|
+
|
|
151
|
+
app = FastAPI()
|
|
152
|
+
app.include_router(billing_router)
|
|
153
|
+
app.include_router(webhooks_router)
|
|
154
|
+
```
|
|
155
|
+
```bash
|
|
156
|
+
uvicorn main:app --port 3000
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Related
|
|
160
|
+
|
|
161
|
+
- [Subscriptions](/docs/manage-subscriptions)
|
|
162
|
+
- [Track Usage](/docs/track-usage)
|
|
163
|
+
- [Customer Portal](/docs/customer-portal)
|
|
164
|
+
- [SDK Reference](/docs/sdk-reference)
|