@commet/node 9.11.0 → 9.13.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 +329 -507
- package/dist/index.d.ts +329 -507
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/index.mjs.map +1 -1
- package/docs/api-reference/addons.md +8 -15
- package/docs/api-reference/api-keys.md +1 -1
- package/docs/api-reference/credit-packs.md +2 -2
- package/docs/api-reference/customers.md +7 -19
- package/docs/api-reference/features.md +1 -1
- package/docs/api-reference/offers.md +9 -5
- package/docs/api-reference/payments.md +1 -1
- package/docs/api-reference/plan-groups.md +2 -2
- package/docs/api-reference/plans.md +28 -44
- package/docs/api-reference/portal.md +3 -8
- package/docs/api-reference/promo-codes.md +3 -3
- package/docs/api-reference/quota.md +6 -21
- package/docs/api-reference/subscriptions.md +38 -52
- package/docs/api-reference/test-clock.md +3 -8
- package/docs/api-reference/usage.md +6 -11
- package/docs/documentation/create-api-key.md +4 -2
- package/docs/documentation/error-handling.md +11 -0
- package/docs/documentation/invoicing/handle-failed-payments.md +12 -3
- package/docs/documentation/plans/add-ons.md +2 -0
- package/docs/documentation/plans/balance-and-top-ups.md +2 -0
- package/docs/documentation/plans/consumption-models.md +9 -1
- package/docs/documentation/plans/credit-packs.md +24 -6
- package/docs/documentation/plans/one-time-payments.md +1 -0
- package/docs/documentation/sales/offers.md +21 -3
- package/docs/documentation/sales/promo-codes.md +2 -2
- package/docs/documentation/sales/promotional-offers.md +2 -2
- package/docs/documentation/subscriptions/manage-subscriptions.md +3 -3
- package/docs/documentation/subscriptions/pay-in-advance.md +6 -4
- package/docs/documentation/subscriptions/plan-grants.md +22 -6
- package/docs/errors/already_has_active_subscription.md +1 -1
- package/docs/errors/charge_failed.md +1 -1
- package/docs/errors/no_payment_method.md +1 -1
- package/docs/errors/payment_failed.md +1 -1
- package/docs/errors/subscription_not_active.md +1 -1
- package/docs/errors/validation_error.md +1 -1
- package/docs/knowledge-base/how-do-discounts-work.md +20 -2
- package/docs/knowledge-base/what-happens-when-a-payment-fails.md +6 -6
- package/docs/schemas.md +13 -5
- package/docs/webhooks.md +16 -14
- package/docs/webhooks.openapi.json +85 -41
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ The customer already has a draft, trialing, active, or past-due subscription tha
|
|
|
9
9
|
|
|
10
10
|
## What to do
|
|
11
11
|
|
|
12
|
-
Inspect the existing subscription and continue, recover, cancel, or change it instead of creating a conflicting subscription.
|
|
12
|
+
Inspect the existing subscription and continue, recover, cancel, or change it instead of creating a conflicting subscription. When it is past due, details carry its subscriptionId, its status and, while its renewal is unpaid, a recoveryUrl where the customer can pay it.
|
|
13
13
|
|
|
14
14
|
The response `message`, `param`, and `details` fields describe the condition observed by the specific operation.
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ The charge required by the subscription operation failed.
|
|
|
9
9
|
|
|
10
10
|
## What to do
|
|
11
11
|
|
|
12
|
-
Use the response message and decline information to resolve the payment failure.
|
|
12
|
+
Use the response message and decline information to resolve the payment failure. When a subscription reactivation or resume was declined, details.recoveryUrl is a link where the customer can pay it.
|
|
13
13
|
|
|
14
14
|
The response `message`, `param`, and `details` fields describe the condition observed by the specific operation.
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ The subscription has no reusable payment method for this operation.
|
|
|
9
9
|
|
|
10
10
|
## What to do
|
|
11
11
|
|
|
12
|
-
Collect or update the customer's payment method through the supported checkout or payment-method flow.
|
|
12
|
+
Collect or update the customer's payment method through the supported checkout or payment-method flow. When a subscription is reactivated or resumed, details.recoveryUrl is a link where the customer can pay it; when a paid plan change is requested, details.checkoutUrl is a link where the customer pays the change.
|
|
13
13
|
|
|
14
14
|
The response `message`, `param`, and `details` fields describe the condition observed by the specific operation.
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ The operation could not complete its payment or required tax calculation.
|
|
|
9
9
|
|
|
10
10
|
## What to do
|
|
11
11
|
|
|
12
|
-
Follow the operation-specific response message and details to correct the payment method, provider condition, or tax calculation failure.
|
|
12
|
+
Follow the operation-specific response message and details to correct the payment method, provider condition, or tax calculation failure. When a card is declined on a plan change, a purchase that sent successUrl or a one-time charge, details.checkoutUrl is a link where the customer pays it with another method.
|
|
13
13
|
|
|
14
14
|
The response `message`, `param`, and `details` fields describe the condition observed by the specific operation.
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ The subscription status does not permit the requested operation.
|
|
|
9
9
|
|
|
10
10
|
## What to do
|
|
11
11
|
|
|
12
|
-
Read the current subscription status and use the lifecycle operation supported for that state.
|
|
12
|
+
Read the current subscription status and use the lifecycle operation supported for that state. When the subscription is past due, details.recoveryUrl is a link where the customer can pay its debt.
|
|
13
13
|
|
|
14
14
|
The response `message`, `param`, and `details` fields describe the condition observed by the specific operation.
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ The request failed validation. The response message, param, and details identify
|
|
|
9
9
|
|
|
10
10
|
## What to do
|
|
11
11
|
|
|
12
|
-
Correct the condition identified by the response before sending the request again.
|
|
12
|
+
Correct the condition identified by the response before sending the request again. When a purchase for a past-due subscription is refused, details.recoveryUrl is a link where the customer can pay its debt.
|
|
13
13
|
|
|
14
14
|
The response `message`, `param`, and `details` fields describe the condition observed by the specific operation.
|
|
15
15
|
|
|
@@ -40,7 +40,25 @@ Trials are not Offer phases. When the price has a [trial](/docs/trial-periods),
|
|
|
40
40
|
|
|
41
41
|
## Plan changes
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
A discount belongs to the subscription, not to the plan. When the customer changes to another paid plan or billing interval, the same Offer Application keeps going on the new plan with the billing periods it still had to discount. The charge for the change is the next of those periods, so no cycle is added and none is lost. A discount without an end keeps applying.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Starter costs $20/month with 50% off for 3 cycles.
|
|
47
|
+
The customer pays cycle 1 and upgrades to Pro ($40/month):
|
|
48
|
+
|
|
49
|
+
Change to Pro: $20.00 (cycle 2), minus the credit for unused Starter time
|
|
50
|
+
Next renewal: $20.00 (cycle 3)
|
|
51
|
+
Renewal after: $40.00
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- A percentage is the same percentage of the new price. An amount off is the same amount.
|
|
55
|
+
- A `fixed_price` phase, free cycles included, keeps its price on the new plan for the cycles it had left. A phase counted in its own `durationInterval` ends when the change moves the subscription to another billing interval, and the other phases of the Offer continue.
|
|
56
|
+
- When the billing interval changes, the discount keeps the time it had left. With two monthly cycles left, a yearly charge made within those two months is discounted in full and the next yearly renewal is not.
|
|
57
|
+
- An Offer, Promo Code or Card Promotion limited to plans or to a billing interval ends with the change when the new plan or interval is outside its limit. See [how to limit an Offer](/docs/offers#limit-an-offer-to-plans-or-a-billing-interval).
|
|
58
|
+
- A change that passes its own `offerId` or `promoCode` applies that Offer with its full duration and ends the previous one. Scheduled plan changes accept neither.
|
|
59
|
+
- A move to a free plan ends the discount.
|
|
60
|
+
|
|
61
|
+
Plan-change previews and the Customer Portal quote the new plan with the discount the change will charge.
|
|
44
62
|
|
|
45
63
|
## What gets discounted
|
|
46
64
|
|
|
@@ -55,4 +73,4 @@ Total: $130.00
|
|
|
55
73
|
|
|
56
74
|
> **Note**
|
|
57
75
|
>
|
|
58
|
-
> Accepted phases are stored in an immutable Offer Application. Editing, deactivating, or archiving the catalog Offer changes future applications only.
|
|
76
|
+
> Accepted phases are stored in an immutable Offer Application. Editing, deactivating, or archiving the catalog Offer changes future applications only, except its plan and interval limits, which are read at each plan change.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Payment Failures
|
|
3
|
-
description: Usage and seats keep working while Commet retries a failed charge
|
|
3
|
+
description: Usage and seats keep working while Commet retries a failed charge for the window you chose; if all retries fail, the subscription ends or moves to the default plan.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
When a payment fails, your customer's usage and seats keep working while Commet retries the charge — but new purchases are blocked. If all retries fail, their subscription is canceled, or moves to the plan group's [default plan](/docs/plan-groups#default-plan-and-signup-trial).
|
|
@@ -18,11 +18,11 @@ All retries fail
|
|
|
18
18
|
→ Paid access is revoked
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
| Stage | Access | What's happening
|
|
22
|
-
| --------------------- | --------------------------------------- |
|
|
23
|
-
| Payment fails | **Usage and seats keep working** | Subscription moves to `past_due`, invoice becomes `outstanding`, retries scheduled
|
|
24
|
-
| During grace period | **Usage and seats keep working** | Automatic retries
|
|
25
|
-
| All retries exhausted | Revoked, or limited to the default plan | Subscription canceled or moved to the default plan, invoice marked `uncollectible`
|
|
21
|
+
| Stage | Access | What's happening |
|
|
22
|
+
| --------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| Payment fails | **Usage and seats keep working** | Subscription moves to `past_due`, invoice becomes `outstanding`, retries scheduled |
|
|
24
|
+
| During grace period | **Usage and seats keep working** | Automatic retries during the [retry window](/docs/handle-failed-payments#automatic-retries) you chose (7 days by default); usage keeps accruing as debt |
|
|
25
|
+
| All retries exhausted | Revoked, or limited to the default plan | Subscription canceled or moved to the default plan, invoice marked `uncollectible` |
|
|
26
26
|
|
|
27
27
|
> **Warning**
|
|
28
28
|
>
|
package/docs/schemas.md
CHANGED
|
@@ -47,6 +47,8 @@ Generated from Commet API version `2026-08-27`.
|
|
|
47
47
|
- `"mercado_pago"`
|
|
48
48
|
- `"google_pay"`
|
|
49
49
|
- `"smartpix"`
|
|
50
|
+
- `"apple_pay"`
|
|
51
|
+
- `"link"`
|
|
50
52
|
|
|
51
53
|
### PaymentProvider
|
|
52
54
|
|
|
@@ -166,7 +168,8 @@ Generated from Commet API version `2026-08-27`.
|
|
|
166
168
|
### BalanceTopup
|
|
167
169
|
|
|
168
170
|
- `amount` (`number`, required)
|
|
169
|
-
- `status` (`"succeeded" | "processing"`, required) — `succeeded` when the payment was confirmed and the balance was added. `processing` when the payment method confirms later: the balance is added once the payment is confirmed, and nothing is added if it is declined.
|
|
171
|
+
- `status` (`"succeeded" | "processing" | "requires_checkout"`, required) — `succeeded` when the payment was confirmed and the balance was added. `processing` when the payment method confirms later: the balance is added once the payment is confirmed, and nothing is added if it is declined. `requires_checkout` when `successUrl` was sent and the subscription has no saved payment method or the saved one was declined: the balance is added once the customer pays at `checkoutUrl`.
|
|
172
|
+
- `checkoutUrl` (`string`, optional) — Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`.
|
|
170
173
|
- `object` (`"balance_topup"`, required)
|
|
171
174
|
- `livemode` (`boolean`, required)
|
|
172
175
|
|
|
@@ -240,7 +243,8 @@ Generated from Commet API version `2026-08-27`.
|
|
|
240
243
|
### CreditGrant
|
|
241
244
|
|
|
242
245
|
- `credits` (`number`, required)
|
|
243
|
-
- `status` (`"succeeded" | "processing"`, required) — `succeeded` when the payment was confirmed and the credits were added. `processing` when the payment method confirms later: the credits are added once the payment is confirmed, and nothing is added if it is declined.
|
|
246
|
+
- `status` (`"succeeded" | "processing" | "requires_checkout"`, required) — `succeeded` when the payment was confirmed and the credits were added. `processing` when the payment method confirms later: the credits are added once the payment is confirmed, and nothing is added if it is declined. `requires_checkout` when `successUrl` was sent and the subscription has no saved payment method or the saved one was declined: the credits are added once the customer pays at `checkoutUrl`.
|
|
247
|
+
- `checkoutUrl` (`string`, optional) — Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`.
|
|
244
248
|
- `object` (`"credit_grant"`, required)
|
|
245
249
|
- `livemode` (`boolean`, required)
|
|
246
250
|
|
|
@@ -461,6 +465,8 @@ Variants:
|
|
|
461
465
|
- `startsAt` (`string | null`, required)
|
|
462
466
|
- `endsAt` (`string | null`, required)
|
|
463
467
|
- `active` (`boolean`, required)
|
|
468
|
+
- `planIds` (`Array<string>`, required) — Plans the offer is limited to. Empty when it applies to any plan.
|
|
469
|
+
- `billingInterval` (`"weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | "one_time" | null`, required) — Billing interval the offer is limited to. Null when it applies to any interval.
|
|
464
470
|
- `managedBy` (`ManagedBy`, required) — Integration that manages this record, or null when the merchant does. While an integration manages it, its terms change only in that integration and edits answer 409 managed_by_integration.
|
|
465
471
|
- `createdAt` (`string`, required)
|
|
466
472
|
- `updatedAt` (`string`, required)
|
|
@@ -560,6 +566,7 @@ Variants:
|
|
|
560
566
|
- `{ outcome: "requires_checkout"; requiresCheckout: true; checkoutUrl: string; offerApplication?: { id: string; offerId: string; name: string; currency: string; subtotal: number; discountAmount: number; total: number; phases: Array<{ type: "free_trial"; durationDays: number; startsAt: string | null; endsAt: string | null } | { type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; amount: number } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; price: number }>; appliesTo: { type: "plan_price"; id: string } | { type: "addon"; id: string } | { type: "credit_pack"; id: string } }; object: "plan_change"; livemode: boolean }`
|
|
561
567
|
- `{ outcome: "scheduled"; id: string; scheduled: true; scheduledFor: string; changeType: "subscription.plan_downgrade" | "subscription.interval_change" | "subscription.cancel"; customerId: string; newPlanId?: string; newPlanName?: string; newBillingInterval?: string; seatLimitWarning?: { featureCode: string; featureName: string; currentSeats: number; included: number; newPlanName: string; effectiveDate: string }; object: "plan_change"; livemode: boolean }`
|
|
562
568
|
- `{ outcome: "completed"; id: string; scheduled: false; customerId: string; previousPlan: { id: string; name: string }; currentPlan: { id: string; name: string; price: number }; billingInterval: string; billing: { credit: number; creditsApplied: number; charge: number; taxAmount: number; netAmount: number; totalCharged: number; remainingCreditBalance: number }; invoiceId?: string; offerApplication?: { id: string; offerId: string; name: string; currency: string; subtotal: number; discountAmount: number; total: number; phases: Array<{ type: "free_trial"; durationDays: number; startsAt: string | null; endsAt: string | null } | { type: "percentage"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; percentage: number } | { type: "amount_off"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; amount: number } | { type: "fixed_price"; durationCycles: number | null; durationInterval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly" | null; startsAt: string | null; endsAt: string | null; price: number }>; appliesTo: { type: "plan_price"; id: string } | { type: "addon"; id: string } | { type: "credit_pack"; id: string } }; object: "plan_change"; livemode: boolean }`
|
|
569
|
+
- `{ outcome: "processing"; invoiceId: string; object: "plan_change"; livemode: boolean }`
|
|
563
570
|
|
|
564
571
|
### PlanDraft
|
|
565
572
|
|
|
@@ -910,8 +917,9 @@ Variants:
|
|
|
910
917
|
### SubscriptionAddon
|
|
911
918
|
|
|
912
919
|
- `addonId` (`string`, required)
|
|
913
|
-
- `status` (`"active" | "processing"`, required) — `active` when the add-on is active. `processing` when the payment method confirms later: the add-on is activated once the payment is confirmed, and stays inactive if it is declined.
|
|
920
|
+
- `status` (`"active" | "processing" | "requires_checkout"`, required) — `active` when the add-on is active. `processing` when the payment method confirms later: the add-on is activated once the payment is confirmed, and stays inactive if it is declined. `requires_checkout` when `successUrl` was sent and the subscription has no saved payment method or the saved one was declined: the add-on is activated once the customer pays at `checkoutUrl`.
|
|
914
921
|
- `proratedCharge` (`number`, required)
|
|
922
|
+
- `checkoutUrl` (`string`, optional) — Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`.
|
|
915
923
|
- `object` (`"subscription_addon"`, required)
|
|
916
924
|
- `livemode` (`boolean`, required)
|
|
917
925
|
|
|
@@ -1027,7 +1035,7 @@ Variants:
|
|
|
1027
1035
|
- `amountRefunded` (`number`, required) — Cumulative confirmed refunds in the payment currency’s smallest unit.
|
|
1028
1036
|
- `currency` (`string`, required)
|
|
1029
1037
|
- `provider` (`PaymentProvider`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
|
|
1030
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card,
|
|
1038
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
1031
1039
|
- `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
|
|
1032
1040
|
- `status` (`TransactionStatus`, required)
|
|
1033
1041
|
- `customerEmail` (`string | null`, required)
|
|
@@ -1051,7 +1059,7 @@ Variants:
|
|
|
1051
1059
|
- `amountRefunded` (`number`, required) — Cumulative confirmed refunds in the payment currency’s smallest unit.
|
|
1052
1060
|
- `currency` (`string`, required)
|
|
1053
1061
|
- `provider` (`PaymentProvider`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
|
|
1054
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card,
|
|
1062
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The method used for this charge: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
1055
1063
|
- `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
|
|
1056
1064
|
- `status` (`TransactionStatus`, required)
|
|
1057
1065
|
- `customerEmail` (`string | null`, required)
|
package/docs/webhooks.md
CHANGED
|
@@ -38,7 +38,7 @@ Fired once, when the subscription's first charge succeeds and it becomes active
|
|
|
38
38
|
|
|
39
39
|
## subscription.reactivated
|
|
40
40
|
|
|
41
|
-
Fired when a canceled subscription is reactivated
|
|
41
|
+
Fired when a canceled subscription is reactivated: its reactivation charge succeeds, or its reactivation invoice totals zero and is paid without a charge. The subscription returns to active with a fresh invoice and a billing period anchored to the reactivation date. Distinct from subscription.activated (first activation) and payment.recovered (past_due recovery, which keeps the original anchor).
|
|
42
42
|
|
|
43
43
|
### Data
|
|
44
44
|
|
|
@@ -52,7 +52,7 @@ Fired when a canceled subscription is reactivated and its reactivation charge su
|
|
|
52
52
|
- `invoiceNumber` (`string`, required) — The human-readable invoice number.
|
|
53
53
|
- `invoiceTotal` (`number`, required) — Invoice total in cents (100 = $1.00).
|
|
54
54
|
- `invoiceCurrency` (`string`, required) — The invoice currency code.
|
|
55
|
-
- `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider
|
|
55
|
+
- `provider` (`"stripe" | "commet" | "dlocal"`, required) — The subscription's payment provider, which processed the reactivation charge: stripe, commet, or dlocal. A reactivation whose invoice totals zero runs no charge and still carries the subscription's provider.
|
|
56
56
|
|
|
57
57
|
## subscription.pause_scheduled
|
|
58
58
|
|
|
@@ -167,6 +167,7 @@ Fired when a subscription changes from one plan to another, including upgrades,
|
|
|
167
167
|
- `credit` (`number`, required) — Prorated credit in cents from the previous plan.
|
|
168
168
|
- `charge` (`number`, required) — Prorated charge in cents for the new plan.
|
|
169
169
|
- `totalCharged` (`number`, required) — Total amount charged in cents.
|
|
170
|
+
- `cancelReason` (`string | null`, required) — The cancellation reason when a cancellation moved the subscription to its group's default plan instead of ending it. Null for any other plan change.
|
|
170
171
|
|
|
171
172
|
## subscription.cancellation_scheduled
|
|
172
173
|
|
|
@@ -206,6 +207,7 @@ Fired when a plan change (downgrade or shorter interval) is scheduled for the en
|
|
|
206
207
|
- `billingInterval` (`string | null`, required) — The current billing interval.
|
|
207
208
|
- `scheduledBillingInterval` (`string | null`, required) — The new billing interval, if the change includes one. Null when only the plan changes.
|
|
208
209
|
- `effectiveAt` (`string`, required) — ISO 8601 datetime when the change executes (the billing period end).
|
|
210
|
+
- `cancelReason` (`string | null`, required) — The cancellation reason when a cancellation scheduled the move to the group's default plan instead of ending the subscription. Null for any other scheduled change.
|
|
209
211
|
|
|
210
212
|
## subscription.plan_change_revoked
|
|
211
213
|
|
|
@@ -297,7 +299,7 @@ Fired when a trial period runs out. With a payment method the billing cycle acti
|
|
|
297
299
|
|
|
298
300
|
## trial.will_end
|
|
299
301
|
|
|
300
|
-
Predictive event fired once, 3 days before a trial ends. Use it to remind the customer that billing starts soon. Emitted by a
|
|
302
|
+
Predictive event fired once, 3 days before a trial ends. Use it to remind the customer that billing starts soon. Emitted by a recurring scan with a deterministic idempotency key, so it never fires twice for the same trial end date.
|
|
301
303
|
|
|
302
304
|
### Data
|
|
303
305
|
|
|
@@ -348,7 +350,7 @@ Fired every time a payment settles successfully — the first payment and every
|
|
|
348
350
|
- `subscriptionId` (`string | null`, required) — The subscription ID.
|
|
349
351
|
- `paymentTransactionId` (`string | null`, required) — The payment transaction ID.
|
|
350
352
|
- `provider` (`"stripe" | "commet" | "dlocal" | null`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal. Null for billing-only charges with no Commet ledger row.
|
|
351
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card,
|
|
353
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
352
354
|
- `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
|
|
353
355
|
- `grossAmount` (`number | null`, required) — Gross amount in cents before fees.
|
|
354
356
|
- `currency` (`string | null`, required) — The payment currency code.
|
|
@@ -368,7 +370,7 @@ Fired when an invoice-linked subscription charge fails.
|
|
|
368
370
|
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
369
371
|
- `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
|
|
370
372
|
- `provider` (`"stripe" | "commet" | "dlocal"`, required) — The payment provider the charge was routed to: stripe, commet, or dlocal.
|
|
371
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card,
|
|
373
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
372
374
|
- `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
|
|
373
375
|
- `failureCode` (`string`, required) — The failure code from the payment processor.
|
|
374
376
|
- `failureMessage` (`string`, required) — A human-readable failure message.
|
|
@@ -386,7 +388,7 @@ Fired when an outstanding invoice that previously failed is successfully paid
|
|
|
386
388
|
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
387
389
|
- `subscriptionId` (`string | null`, required) — The subscription ID, if the invoice is linked to a subscription.
|
|
388
390
|
- `provider` (`"stripe" | "commet" | "dlocal" | null`, required) — The payment provider that recovered the payment, or null when the invoice was recovered without a processor charge.
|
|
389
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card,
|
|
391
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
390
392
|
- `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
|
|
391
393
|
|
|
392
394
|
## payment.retry_failed
|
|
@@ -483,7 +485,7 @@ Fired when a payment link is paid. The charge settled and a one-time invoice was
|
|
|
483
485
|
- `invoiceId` (`string`, required) — The one-time invoice generated for this payment.
|
|
484
486
|
- `invoiceNumber` (`string`, required) — The human-readable invoice number.
|
|
485
487
|
- `paymentTransactionId` (`string | null`, required) — The payment transaction ID for the settled charge.
|
|
486
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card,
|
|
488
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
487
489
|
- `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
|
|
488
490
|
|
|
489
491
|
## payment_link.failed
|
|
@@ -501,7 +503,7 @@ Fired when a payment link charge attempt is declined. The link stays open and ca
|
|
|
501
503
|
- `customerId` (`string | null`, required) — The customer ID, or null when the link is not tied to a customer. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
502
504
|
- `failureCode` (`string`, required) — The failure code from the payment processor.
|
|
503
505
|
- `failureMessage` (`string`, required) — A human-readable failure message.
|
|
504
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card,
|
|
506
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
505
507
|
- `subPaymentMethod` (`SubPaymentMethod | null`, required) — The source of funds for this charge, when reported by the provider. Null when unavailable or unknown.
|
|
506
508
|
|
|
507
509
|
## payment_link.canceled
|
|
@@ -557,7 +559,7 @@ Fired when an invoice is voided — nullified before collection, for example whe
|
|
|
557
559
|
|
|
558
560
|
## invoice.overdue
|
|
559
561
|
|
|
560
|
-
Fired once when an outstanding
|
|
562
|
+
Fired once when an invoice is still outstanding 24 hours after its due date. The invoice keeps its outstanding status — overdue is a fact about the due date, not a new status. Use it to start your own dunning flow.
|
|
561
563
|
|
|
562
564
|
### Data
|
|
563
565
|
|
|
@@ -576,7 +578,7 @@ Fired once when an outstanding invoice passes its due date without payment. The
|
|
|
576
578
|
|
|
577
579
|
## invoice.upcoming
|
|
578
580
|
|
|
579
|
-
Predictive event fired once, 3 days before an active subscription renews. Use it to notify the customer before they are charged. Carries no amount — usage-based charges are only final at renewal, when invoice.created delivers the actual invoice.
|
|
581
|
+
Predictive event fired once, 3 days before an active subscription renews. A subscription on a free plan issues no renewal invoice and does not fire it. Use it to notify the customer before they are charged. Carries no amount — usage-based charges are only final at renewal, when invoice.created delivers the actual invoice.
|
|
580
582
|
|
|
581
583
|
### Data
|
|
582
584
|
|
|
@@ -596,7 +598,7 @@ Fired when Commet records a payment method for a subscription: after a paid chec
|
|
|
596
598
|
|
|
597
599
|
- `subscriptionId` (`string`, required) — The subscription the payment method was saved for.
|
|
598
600
|
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
599
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card,
|
|
601
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
600
602
|
- `card` (`WebhookCardInfo | null`, required) — Card display metadata: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
|
|
601
603
|
|
|
602
604
|
## payment_method.updated
|
|
@@ -606,7 +608,7 @@ Fired when a customer replaces their default payment method through the customer
|
|
|
606
608
|
### Data
|
|
607
609
|
|
|
608
610
|
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
609
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card,
|
|
611
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
610
612
|
- `card` (`WebhookCardInfo | null`, required) — Card display metadata for the new method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
|
|
611
613
|
|
|
612
614
|
## payment_method.detached
|
|
@@ -616,7 +618,7 @@ Fired when a saved payment method is removed from a customer: the customer unlin
|
|
|
616
618
|
### Data
|
|
617
619
|
|
|
618
620
|
- `customerId` (`string`, required) — The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId.
|
|
619
|
-
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card,
|
|
621
|
+
- `paymentMethod` (`PaymentMethod | null`, required) — The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown.
|
|
620
622
|
- `card` (`WebhookCardInfo | null`, required) — Card display metadata of the removed method: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved.
|
|
621
623
|
- `reason` (`"unlinked_at_provider" | "removed_by_customer"`, required) — Why the method was removed: `unlinked_at_provider` when the customer revoked it at the payment provider, `removed_by_customer` when the customer removed it through the customer portal.
|
|
622
624
|
|
|
@@ -818,7 +820,7 @@ Fired each time a subscription's available credits cross to zero or below. Usage
|
|
|
818
820
|
|
|
819
821
|
## credits.expired
|
|
820
822
|
|
|
821
|
-
Fired at a reset when unused plan credits are discarded. On a plan whose unused plan credits expire, every unused plan credit expires at each reset. On a plan that rolls them over, a reset keeps them, up to the plan's maxPlanCredits when it has one, and only the excess expires. A change to another credits plan applies the new plan's terms the same way. Purchased credits never expire and are not affected.
|
|
823
|
+
Fired at a reset when unused plan credits are discarded. On a plan whose unused plan credits expire, every unused plan credit expires at each reset. On a plan that rolls them over, a reset keeps them, up to the plan's maxPlanCredits when it has one, and only the excess expires. A change to another credits plan applies the new plan's terms the same way, and an immediate change also discards the credits the previous plan gave for the period it cuts short. Purchased credits never expire and are not affected.
|
|
822
824
|
|
|
823
825
|
### Data
|
|
824
826
|
|