@commet/node 9.11.0 → 9.12.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 +53 -34
- package/dist/index.d.ts +53 -34
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/docs/api-reference/features.md +1 -1
- package/docs/api-reference/subscriptions.md +8 -5
- package/docs/documentation/error-handling.md +11 -0
- 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/sales/promotional-offers.md +1 -1
- package/docs/documentation/subscriptions/plan-grants.md +22 -6
- package/docs/knowledge-base/how-do-discounts-work.md +19 -1
- package/docs/schemas.md +11 -5
- package/docs/webhooks.md +14 -14
- package/docs/webhooks.openapi.json +63 -37
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -127,7 +127,7 @@ type BillingInterval = "weekly" | "monthly" | "quarterly" | "semiannual" | "year
|
|
|
127
127
|
type ConsumptionModel = "metered" | "credits" | "balance";
|
|
128
128
|
type FeatureType = "boolean" | "usage" | "seats" | "quota";
|
|
129
129
|
type InvoiceType = "recurring" | "overage" | "plan_change" | "adjustment" | "credit_purchase" | "balance_topup" | "addon_activation" | "one_time_payment" | "reactivation" | "resume" | "prepayment";
|
|
130
|
-
type PaymentMethod = "card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix";
|
|
130
|
+
type PaymentMethod = "card" | "oxxo" | "mercado_pago" | "google_pay" | "smartpix" | "apple_pay" | "link";
|
|
131
131
|
type PaymentProvider = "stripe" | "commet" | "dlocal";
|
|
132
132
|
type SubPaymentMethod = "credit_card" | "debit_card" | "prepaid_card" | "bank_transfer" | "account_money";
|
|
133
133
|
type SubscriptionStatus = "draft" | "pending_payment" | "trialing" | "active" | "past_due" | "paused" | "canceled";
|
|
@@ -193,8 +193,10 @@ interface BalanceAdjustment {
|
|
|
193
193
|
}
|
|
194
194
|
interface BalanceTopup {
|
|
195
195
|
amount: number;
|
|
196
|
-
/** `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. */
|
|
197
|
-
status: "succeeded" | "processing";
|
|
196
|
+
/** `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 the subscription has no saved payment method and `successUrl` was sent: the balance is added once the customer pays at `checkoutUrl`. */
|
|
197
|
+
status: "succeeded" | "processing" | "requires_checkout";
|
|
198
|
+
/** Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`. */
|
|
199
|
+
checkoutUrl?: string;
|
|
198
200
|
object: "balance_topup";
|
|
199
201
|
livemode: boolean;
|
|
200
202
|
}
|
|
@@ -315,8 +317,10 @@ interface CreatedWebhook {
|
|
|
315
317
|
}
|
|
316
318
|
interface CreditGrant {
|
|
317
319
|
credits: number;
|
|
318
|
-
/** `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. */
|
|
319
|
-
status: "succeeded" | "processing";
|
|
320
|
+
/** `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 the subscription has no saved payment method and `successUrl` was sent: the credits are added once the customer pays at `checkoutUrl`. */
|
|
321
|
+
status: "succeeded" | "processing" | "requires_checkout";
|
|
322
|
+
/** Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`. */
|
|
323
|
+
checkoutUrl?: string;
|
|
320
324
|
object: "credit_grant";
|
|
321
325
|
livemode: boolean;
|
|
322
326
|
}
|
|
@@ -1069,6 +1073,11 @@ interface Plan {
|
|
|
1069
1073
|
livemode: boolean;
|
|
1070
1074
|
}
|
|
1071
1075
|
type PlanChange = {
|
|
1076
|
+
outcome: "processing";
|
|
1077
|
+
invoiceId: string;
|
|
1078
|
+
object: "plan_change";
|
|
1079
|
+
livemode: boolean;
|
|
1080
|
+
} | {
|
|
1072
1081
|
outcome: "requires_checkout";
|
|
1073
1082
|
requiresCheckout: true;
|
|
1074
1083
|
checkoutUrl: string;
|
|
@@ -2011,9 +2020,11 @@ interface Subscription {
|
|
|
2011
2020
|
}
|
|
2012
2021
|
interface SubscriptionAddon {
|
|
2013
2022
|
addonId: string;
|
|
2014
|
-
/** `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. */
|
|
2015
|
-
status: "active" | "processing";
|
|
2023
|
+
/** `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 the subscription has no saved payment method and `successUrl` was sent: the add-on is activated once the customer pays at `checkoutUrl`. */
|
|
2024
|
+
status: "active" | "processing" | "requires_checkout";
|
|
2016
2025
|
proratedCharge: number;
|
|
2026
|
+
/** Hosted checkout where the customer pays the purchase and saves the payment method. Present only when `status` is `requires_checkout`. */
|
|
2027
|
+
checkoutUrl?: string;
|
|
2017
2028
|
object: "subscription_addon";
|
|
2018
2029
|
livemode: boolean;
|
|
2019
2030
|
}
|
|
@@ -2271,7 +2282,7 @@ interface Transaction {
|
|
|
2271
2282
|
currency: string;
|
|
2272
2283
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. */
|
|
2273
2284
|
provider: PaymentProvider;
|
|
2274
|
-
/** The method used for this charge: card,
|
|
2285
|
+
/** The method used for this charge: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
2275
2286
|
paymentMethod: PaymentMethod | null;
|
|
2276
2287
|
/** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
|
|
2277
2288
|
subPaymentMethod: SubPaymentMethod | null;
|
|
@@ -2318,7 +2329,7 @@ interface TransactionListItem {
|
|
|
2318
2329
|
currency: string;
|
|
2319
2330
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. */
|
|
2320
2331
|
provider: PaymentProvider;
|
|
2321
|
-
/** The method used for this charge: card,
|
|
2332
|
+
/** The method used for this charge: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
2322
2333
|
paymentMethod: PaymentMethod | null;
|
|
2323
2334
|
/** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
|
|
2324
2335
|
subPaymentMethod: SubPaymentMethod | null;
|
|
@@ -3058,7 +3069,7 @@ declare class FeaturesResource {
|
|
|
3058
3069
|
get(params: GetFeatureParams, options?: RequestOptions): Promise<Feature>;
|
|
3059
3070
|
/** Update a feature's name, description, or unit name. At least one field must be provided. */
|
|
3060
3071
|
update(params: UpdateFeatureParams, options?: RequestOptions): Promise<Feature>;
|
|
3061
|
-
/** Delete a feature. Fails
|
|
3072
|
+
/** Delete a feature. Fails while a plan's current version, a running experiment or a draft includes it, or while it has an active add-on. Subscribers whose plan version includes it keep it, and its code can be used by a new feature right away. */
|
|
3062
3073
|
delete(params: DeleteFeatureParams, options?: RequestOptions): Promise<DeletedObject>;
|
|
3063
3074
|
/** List every feature defined in the organization. This is the organization's feature catalog (definitions), not a customer's feature access. */
|
|
3064
3075
|
list(): Promise<{
|
|
@@ -4258,6 +4269,8 @@ interface DeactivateAddonParams {
|
|
|
4258
4269
|
interface ActivateAddonParams {
|
|
4259
4270
|
id: string;
|
|
4260
4271
|
addonId: string;
|
|
4272
|
+
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way. */
|
|
4273
|
+
successUrl?: string;
|
|
4261
4274
|
}
|
|
4262
4275
|
interface GetSubscriptionAutoTopUpParams {
|
|
4263
4276
|
id: string;
|
|
@@ -4282,6 +4295,8 @@ interface TopupBalanceParams {
|
|
|
4282
4295
|
id: string;
|
|
4283
4296
|
/** The amount to add, in minor units of the subscription currency (cents; whole units for zero-decimal currencies). */
|
|
4284
4297
|
amount: number;
|
|
4298
|
+
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way. */
|
|
4299
|
+
successUrl?: string;
|
|
4285
4300
|
}
|
|
4286
4301
|
interface CancelSubscriptionParams {
|
|
4287
4302
|
id: string;
|
|
@@ -4317,9 +4332,13 @@ type PurchaseCreditsParams = {
|
|
|
4317
4332
|
id: string;
|
|
4318
4333
|
creditPackId: string;
|
|
4319
4334
|
quantity?: never;
|
|
4335
|
+
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way. */
|
|
4336
|
+
successUrl?: string;
|
|
4320
4337
|
} | {
|
|
4321
4338
|
id: string;
|
|
4322
4339
|
quantity: number;
|
|
4340
|
+
/** Where the customer returns after paying. When it is set and the subscription has no saved payment method, the response has status `requires_checkout` and a `checkoutUrl` where the customer pays this purchase and saves the method in one step. Without it, the request is rejected when there is no saved payment method. A saved method is always charged directly, and a declined charge is rejected either way. */
|
|
4341
|
+
successUrl?: string;
|
|
4323
4342
|
};
|
|
4324
4343
|
interface ApplySubscriptionOfferParams {
|
|
4325
4344
|
id: string;
|
|
@@ -4407,7 +4426,7 @@ type CreateSubscriptionParams = {
|
|
|
4407
4426
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4408
4427
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4409
4428
|
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4410
|
-
paymentMethodTypes?: Array<"card" | "
|
|
4429
|
+
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4411
4430
|
name?: string;
|
|
4412
4431
|
/** @format date-time */
|
|
4413
4432
|
startDate?: string;
|
|
@@ -4433,7 +4452,7 @@ type CreateSubscriptionParams = {
|
|
|
4433
4452
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4434
4453
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4435
4454
|
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4436
|
-
paymentMethodTypes?: Array<"card" | "
|
|
4455
|
+
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4437
4456
|
name?: string;
|
|
4438
4457
|
/** @format date-time */
|
|
4439
4458
|
startDate?: string;
|
|
@@ -4460,7 +4479,7 @@ type CreateSubscriptionParams = {
|
|
|
4460
4479
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4461
4480
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4462
4481
|
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4463
|
-
paymentMethodTypes?: Array<"card" | "
|
|
4482
|
+
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4464
4483
|
name?: string;
|
|
4465
4484
|
/** @format date-time */
|
|
4466
4485
|
startDate?: string;
|
|
@@ -4486,7 +4505,7 @@ type CreateSubscriptionParams = {
|
|
|
4486
4505
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4487
4506
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4488
4507
|
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4489
|
-
paymentMethodTypes?: Array<"card" | "
|
|
4508
|
+
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4490
4509
|
name?: string;
|
|
4491
4510
|
/** @format date-time */
|
|
4492
4511
|
startDate?: string;
|
|
@@ -4513,7 +4532,7 @@ type CreateSubscriptionParams = {
|
|
|
4513
4532
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4514
4533
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4515
4534
|
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4516
|
-
paymentMethodTypes?: Array<"card" | "
|
|
4535
|
+
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4517
4536
|
name?: string;
|
|
4518
4537
|
/** @format date-time */
|
|
4519
4538
|
startDate?: string;
|
|
@@ -4540,7 +4559,7 @@ type CreateSubscriptionParams = {
|
|
|
4540
4559
|
/** Payment provider name or exact public payment connection ID for the initial checkout. Overrides country routing when present. */
|
|
4541
4560
|
provider?: "stripe" | "commet" | "dlocal" | string;
|
|
4542
4561
|
/** Payment methods the initial checkout may offer. Restricts what the checkout already offers for the buyer's country, currency and payment connection; it never enables a method the connection does not have and never changes routing. When none of them is available to the buyer, the checkout shows that it cannot accept payments. */
|
|
4543
|
-
paymentMethodTypes?: Array<"card" | "
|
|
4562
|
+
paymentMethodTypes?: Array<"card" | "mercado_pago" | "oxxo" | "google_pay" | "smartpix" | "apple_pay" | "link">;
|
|
4544
4563
|
name?: string;
|
|
4545
4564
|
/** @format date-time */
|
|
4546
4565
|
startDate?: string;
|
|
@@ -4565,7 +4584,7 @@ declare class SubscriptionsResource {
|
|
|
4565
4584
|
constructor(httpClient: CommetHTTPClient);
|
|
4566
4585
|
/** Deactivate an add-on from a subscription. */
|
|
4567
4586
|
deactivateAddon(params: DeactivateAddonParams, options?: RequestOptions): Promise<DeletedSubscriptionAddon>;
|
|
4568
|
-
/** Activate an add-on on a subscription. Creates the activation invoice and charges a prorated amount for the current billing period; the add-on is active once the payment is confirmed. Rejected with 409 while the add-on is active or an activation of it is still processing. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable. */
|
|
4587
|
+
/** Activate an add-on on a subscription. Creates the activation invoice and charges a prorated amount for the current billing period; the add-on is active once the payment is confirmed. Without a saved payment method, send successUrl to receive a checkout that charges the activation and saves the method. Rejected with 409 while the add-on is active or an activation of it is still processing. An add-on that the subscription's plan version does not sell is rejected with addon_unavailable. */
|
|
4569
4588
|
activateAddon(params: ActivateAddonParams, options?: RequestOptions): Promise<SubscriptionAddon>;
|
|
4570
4589
|
/** Read whether the subscription tops up automatically with its saved payment method when its available credits or balance reach a threshold, with the top-ups used this period and the last failure. */
|
|
4571
4590
|
getAutoTopUp(params: GetSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
@@ -4573,7 +4592,7 @@ declare class SubscriptionsResource {
|
|
|
4573
4592
|
updateAutoTopUp(params: UpdateSubscriptionAutoTopUpParams, options?: RequestOptions): Promise<SubscriptionAutoTopUp>;
|
|
4574
4593
|
/** Adjust a subscription's balance or credits by a signed amount. Positive adds, negative subtracts. */
|
|
4575
4594
|
adjustBalance(params: AdjustBalanceParams, options?: RequestOptions): Promise<BalanceAdjustment>;
|
|
4576
|
-
/** Top up a balance subscription. Creates the top-up invoice and charges the customer's payment method for the amount plus tax. Once the payment is confirmed, adds the amount to the subscription's purchased balance (after paying back any overage owed on the plan balance), marks the invoice paid and emits `balance.topped_up`. Purchased balance is spent after the plan balance and is kept until the subscription ends. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge. */
|
|
4595
|
+
/** Top up a balance subscription. Creates the top-up invoice and charges the customer's payment method for the amount plus tax. Once the payment is confirmed, adds the amount to the subscription's purchased balance (after paying back any overage owed on the plan balance), marks the invoice paid and emits `balance.topped_up`. Purchased balance is spent after the plan balance and is kept until the subscription ends. Without a saved payment method, send successUrl to receive a checkout that charges the top-up and saves the method. Rejected with 400 when the subscription is not on a balance plan, its plan has top-ups turned off, or the amount is below the effective minimum: the plan's minimum top-up in the subscription currency, raised to the currency's minimum charge. */
|
|
4577
4596
|
topupBalance(params: TopupBalanceParams, options?: RequestOptions): Promise<BalanceTopup>;
|
|
4578
4597
|
/** Cancel immediately or at period end and return the updated subscription. */
|
|
4579
4598
|
cancel(params: CancelSubscriptionParams, options?: RequestOptions): Promise<Subscription>;
|
|
@@ -4581,7 +4600,7 @@ declare class SubscriptionsResource {
|
|
|
4581
4600
|
changePlan(params: ChangePlanParams, options?: RequestOptions): Promise<PlanChange>;
|
|
4582
4601
|
/** Move a subscription to a newer published version of its plan, now or at the end of the period, without proration; an older version is rejected with version_not_newer, and a subscription on a running experiment moves only to a later version of that experiment. The subscription keeps its currency and its price: a destination that does not sell its currency is rejected with missing_regional_price unless currency asks to charge it in USD from its renewal, and one that does not sell the price it pays with price_not_found. A free version moves only to a free version and a paid one only to a paid one (validation_error). A subscription whose usage does not fit the destination, or with an active add-on the destination does not sell, is not moved either, and the error says why. Each change is recorded as a move of this one subscription in the plan's moves. Repeating the same request changes nothing; a new one replaces the pending move. */
|
|
4583
4602
|
changeVersion(params: ChangeSubscriptionVersionParams, options?: RequestOptions): Promise<Subscription>;
|
|
4584
|
-
/** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Creates the purchase invoice, charges the saved payment method and adds the purchased credits once the payment is confirmed. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
|
|
4603
|
+
/** Purchase a fixed credit pack or choose a whole credit quantity at the subscription plan price and minimum. Creates the purchase invoice, charges the saved payment method and adds the purchased credits once the payment is confirmed. Without a saved payment method, send successUrl to receive a checkout that charges the purchase and saves the method. A credit pack that the subscription's plan version does not sell is rejected with credit_pack_unavailable. */
|
|
4585
4604
|
purchaseCredits(params: PurchaseCreditsParams, options?: RequestOptions): Promise<CreditGrant>;
|
|
4586
4605
|
/** Apply a direct Offer to a subscription. On a pending checkout it quotes or replaces the checkout discount, which starts after the plan price trial when there is one, and the existing checkout URL remains unchanged. On an active subscription it applies the Offer immediately with its discount phases starting at the next billing cycle; the call is rejected while another applied Offer still has active or upcoming discount phases. */
|
|
4587
4606
|
applyOffer(params: ApplySubscriptionOfferParams, options?: RequestOptions): Promise<Subscription>;
|
|
@@ -4599,7 +4618,7 @@ declare class SubscriptionsResource {
|
|
|
4599
4618
|
createPrepaidPeriodsCheckout(params: CreatePrepaidPeriodsCheckoutParams, options?: RequestOptions): Promise<PrepaidPeriodsCheckout>;
|
|
4600
4619
|
/** Preview proration details for an immediate plan change without applying it. Free-to-paid changes are never scheduled and the change-plan endpoint returns hosted checkout for them, except a change without offerId or promoCode to a price whose free trial needs no payment method, for a customer who never had that plan: it starts the trial at once, so the preview reports nothing due today. For paid plans, interval direction takes precedence: a longer interval is immediate and a shorter interval is scheduled. When the interval is unchanged, a higher-sort-order plan is immediate and a lower-sort-order plan is scheduled. A paid-to-free change is always scheduled. Returns credit, charge, and net amount. The target plan must belong to the same plan group as the current plan, otherwise a 400 with code `plans_not_in_same_group` is returned. A change between two free plans has nothing to prorate and returns a zero-amount estimate. Scheduled changes return a 400 with code `plan_change_scheduled`; apply those via the change-plan endpoint. Pass offerId to quote the destination plan with an Offer, or promoCode to quote it with the Offer of a promo code validated with the checkout's rules. */
|
|
4601
4620
|
previewChange(params: PreviewChangePlanParams, options?: RequestOptions): Promise<PreviewChange>;
|
|
4602
|
-
/** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply an Offer by offerId; past-due recovery cannot. */
|
|
4621
|
+
/** Reactivates a subscription. A past_due subscription retries its outstanding renewal charge (recovering to active on success). A canceled subscription generates a fresh invoice, charges the saved card, and resets the billing period; when that invoice totals zero, for example under an Offer, it is marked paid without a charge and the subscription becomes active at once, still requiring a saved payment method. On a successful charge the subscription becomes active; a declined charge returns an error with a recoveryUrl in the error details that can be sent to the customer to update their card. A canceled subscription may apply an Offer by offerId; past-due recovery cannot. */
|
|
4603
4622
|
reactivate(params: ReactivateSubscriptionParams, options?: RequestOptions): Promise<ReactivatedSubscription>;
|
|
4604
4623
|
/** Generates a hosted, signed recovery link that lets the customer pay the outstanding renewal charge for a past_due subscription. Unlike reactivate, which charges server-to-server, this returns a link the merchant can deliver through their own email, SMS, or dashboard. The link carries a self-contained signed token and stays valid until the charge is paid or the subscription is no longer past due. */
|
|
4605
4624
|
createRecoveryLink(params: CreateSubscriptionRecoveryLinkParams, options?: RequestOptions): Promise<RecoveryLink>;
|
|
@@ -4805,7 +4824,7 @@ interface SubscriptionActivatedData {
|
|
|
4805
4824
|
/** The payment provider that processed the activating charge: stripe, commet, or dlocal. Null when the subscription activated without a charge (zero-total or setup-based activation). */
|
|
4806
4825
|
provider: "stripe" | "commet" | "dlocal" | null;
|
|
4807
4826
|
}
|
|
4808
|
-
/** Fired when a canceled subscription is reactivated
|
|
4827
|
+
/** 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). */
|
|
4809
4828
|
interface SubscriptionReactivatedData {
|
|
4810
4829
|
/** The subscription ID. */
|
|
4811
4830
|
subscriptionId: string;
|
|
@@ -4827,7 +4846,7 @@ interface SubscriptionReactivatedData {
|
|
|
4827
4846
|
invoiceTotal: number;
|
|
4828
4847
|
/** The invoice currency code. */
|
|
4829
4848
|
invoiceCurrency: string;
|
|
4830
|
-
/** The payment provider
|
|
4849
|
+
/** 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. */
|
|
4831
4850
|
provider: "stripe" | "commet" | "dlocal";
|
|
4832
4851
|
}
|
|
4833
4852
|
/** Fired when a period-end pause is scheduled. Access and billing continue until effectiveAt. */
|
|
@@ -5118,7 +5137,7 @@ interface TrialExpiredData {
|
|
|
5118
5137
|
/** ISO 8601 datetime when the trial ended. */
|
|
5119
5138
|
trialEndsAt: string;
|
|
5120
5139
|
}
|
|
5121
|
-
/** Predictive event fired once, 3 days before a trial ends. Use it to remind the customer that billing starts soon. Emitted by a
|
|
5140
|
+
/** 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. */
|
|
5122
5141
|
interface TrialWillEndData {
|
|
5123
5142
|
/** The subscription ID. */
|
|
5124
5143
|
subscriptionId: string;
|
|
@@ -5195,7 +5214,7 @@ interface PaymentReceivedData {
|
|
|
5195
5214
|
paymentTransactionId: string | null;
|
|
5196
5215
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. Null for billing-only charges with no Commet ledger row. */
|
|
5197
5216
|
provider: "stripe" | "commet" | "dlocal" | null;
|
|
5198
|
-
/** The payment method: card,
|
|
5217
|
+
/** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
5199
5218
|
paymentMethod: PaymentMethod | null;
|
|
5200
5219
|
/** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
|
|
5201
5220
|
subPaymentMethod: SubPaymentMethod | null;
|
|
@@ -5238,7 +5257,7 @@ interface PaymentFailedData {
|
|
|
5238
5257
|
subscriptionId: string | null;
|
|
5239
5258
|
/** The payment provider the charge was routed to: stripe, commet, or dlocal. */
|
|
5240
5259
|
provider: "stripe" | "commet" | "dlocal";
|
|
5241
|
-
/** The payment method: card,
|
|
5260
|
+
/** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
5242
5261
|
paymentMethod: PaymentMethod | null;
|
|
5243
5262
|
/** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
|
|
5244
5263
|
subPaymentMethod: SubPaymentMethod | null;
|
|
@@ -5263,7 +5282,7 @@ interface PaymentRecoveredData {
|
|
|
5263
5282
|
subscriptionId: string | null;
|
|
5264
5283
|
/** The payment provider that recovered the payment, or null when the invoice was recovered without a processor charge. */
|
|
5265
5284
|
provider: "stripe" | "commet" | "dlocal" | null;
|
|
5266
|
-
/** The payment method: card,
|
|
5285
|
+
/** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
5267
5286
|
paymentMethod: PaymentMethod | null;
|
|
5268
5287
|
/** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
|
|
5269
5288
|
subPaymentMethod: SubPaymentMethod | null;
|
|
@@ -5405,7 +5424,7 @@ interface PaymentLinkCompletedData {
|
|
|
5405
5424
|
invoiceNumber: string;
|
|
5406
5425
|
/** The payment transaction ID for the settled charge. */
|
|
5407
5426
|
paymentTransactionId: string | null;
|
|
5408
|
-
/** The payment method: card,
|
|
5427
|
+
/** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
5409
5428
|
paymentMethod: PaymentMethod | null;
|
|
5410
5429
|
/** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
|
|
5411
5430
|
subPaymentMethod: SubPaymentMethod | null;
|
|
@@ -5444,7 +5463,7 @@ interface PaymentLinkFailedData {
|
|
|
5444
5463
|
failureCode: string;
|
|
5445
5464
|
/** A human-readable failure message. */
|
|
5446
5465
|
failureMessage: string;
|
|
5447
|
-
/** The payment method: card,
|
|
5466
|
+
/** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
5448
5467
|
paymentMethod: PaymentMethod | null;
|
|
5449
5468
|
/** The source of funds for this charge, when reported by the provider. Null when unavailable or unknown. */
|
|
5450
5469
|
subPaymentMethod: SubPaymentMethod | null;
|
|
@@ -5518,7 +5537,7 @@ interface InvoiceVoidedData {
|
|
|
5518
5537
|
/** The subscription ID, if the invoice is linked to a subscription. */
|
|
5519
5538
|
subscriptionId: string | null;
|
|
5520
5539
|
}
|
|
5521
|
-
/** Fired once when an outstanding
|
|
5540
|
+
/** 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. */
|
|
5522
5541
|
interface InvoiceOverdueData {
|
|
5523
5542
|
/** The invoice ID. */
|
|
5524
5543
|
invoiceId: string;
|
|
@@ -5545,7 +5564,7 @@ interface InvoiceOverdueData {
|
|
|
5545
5564
|
/** The subscription ID, if the invoice is linked to a subscription. */
|
|
5546
5565
|
subscriptionId: string | null;
|
|
5547
5566
|
}
|
|
5548
|
-
/** 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. */
|
|
5567
|
+
/** 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. */
|
|
5549
5568
|
interface InvoiceUpcomingData {
|
|
5550
5569
|
/** The subscription ID. */
|
|
5551
5570
|
subscriptionId: string;
|
|
@@ -5568,7 +5587,7 @@ interface PaymentMethodAttachedData {
|
|
|
5568
5587
|
subscriptionId: string;
|
|
5569
5588
|
/** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
|
|
5570
5589
|
customerId: string;
|
|
5571
|
-
/** The payment method: card,
|
|
5590
|
+
/** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
5572
5591
|
paymentMethod: PaymentMethod | null;
|
|
5573
5592
|
/** Card display metadata: brand, last4, expMonth, expYear. Null when the method is not a card or its details cannot be retrieved. */
|
|
5574
5593
|
card: WebhookCardInfo | null;
|
|
@@ -5577,7 +5596,7 @@ interface PaymentMethodAttachedData {
|
|
|
5577
5596
|
interface PaymentMethodUpdatedData {
|
|
5578
5597
|
/** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
|
|
5579
5598
|
customerId: string;
|
|
5580
|
-
/** The payment method: card,
|
|
5599
|
+
/** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
5581
5600
|
paymentMethod: PaymentMethod | null;
|
|
5582
5601
|
/** 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. */
|
|
5583
5602
|
card: WebhookCardInfo | null;
|
|
@@ -5586,7 +5605,7 @@ interface PaymentMethodUpdatedData {
|
|
|
5586
5605
|
interface PaymentMethodDetachedData {
|
|
5587
5606
|
/** The customer ID. Returns your externalId if you provided one when creating the customer, otherwise returns the Commet publicId. */
|
|
5588
5607
|
customerId: string;
|
|
5589
|
-
/** The payment method: card,
|
|
5608
|
+
/** The payment method: card, apple_pay, google_pay, link, smartpix, oxxo or mercado_pago. Null when unknown. */
|
|
5590
5609
|
paymentMethod: PaymentMethod | null;
|
|
5591
5610
|
/** 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. */
|
|
5592
5611
|
card: WebhookCardInfo | null;
|
|
@@ -6138,7 +6157,7 @@ interface CreditsDepletedData {
|
|
|
6138
6157
|
/** Credits remaining after depletion. Always 0. */
|
|
6139
6158
|
remainingCredits: number;
|
|
6140
6159
|
}
|
|
6141
|
-
/** 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. */
|
|
6160
|
+
/** 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. */
|
|
6142
6161
|
interface CreditsExpiredData {
|
|
6143
6162
|
/** The subscription ID. */
|
|
6144
6163
|
subscriptionId: string;
|