@leaflow/sdk 0.102.0 → 0.104.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.
@@ -59,10 +59,10 @@ export type CreatePaymentMethodSetupResult = operations["create-payment-method-s
59
59
  export type CreatePaymentMethodSetupBody = NonNullable<operations["create-payment-method-setup"]["requestBody"]>["content"]["application/json"];
60
60
  /** The success response body of `PUT /account/v1/payment-methods/{paymentMethodId}/default`. */
61
61
  export type SetDefaultPaymentMethodResult = operations["set-default-payment-method"]["responses"][200]["content"]["application/json"];
62
- /** The success response body of `POST /account/v1/invoices/{invoiceId}/collect-payment`. */
63
- export type CollectInvoicePaymentResult = operations["collect-invoice-payment"]["responses"][200]["content"]["application/json"];
64
- /** The request body of `POST /account/v1/invoices/{invoiceId}/collect-payment`. */
65
- export type CollectInvoicePaymentBody = NonNullable<operations["collect-invoice-payment"]["requestBody"]>["content"]["application/json"];
62
+ /** The success response body of `POST /account/v1/invoices/{invoiceId}/pay`. */
63
+ export type PayInvoiceResult = operations["pay-invoice"]["responses"][200]["content"]["application/json"];
64
+ /** The request body of `POST /account/v1/invoices/{invoiceId}/pay`. */
65
+ export type PayInvoiceBody = NonNullable<operations["pay-invoice"]["requestBody"]>["content"]["application/json"];
66
66
  /** The success response body of `GET /account/v1/invoices/{invoiceId}/payment-preview`. */
67
67
  export type PreviewInvoicePaymentResult = operations["preview-invoice-payment"]["responses"][200]["content"]["application/json"];
68
68
  /** The query parameters of `GET /account/v1/invoices/{invoiceId}/payment-preview`. */
@@ -143,10 +143,6 @@ export type CreateRenewalOrderBody = NonNullable<operations["create-renewal-orde
143
143
  export type SetAutoRenewResult = operations["set-auto-renew"]["responses"][200]["content"]["application/json"];
144
144
  /** The request body of `PUT /account/v1/subscriptions/{subscriptionId}/auto-renew`. */
145
145
  export type SetAutoRenewBody = NonNullable<operations["set-auto-renew"]["requestBody"]>["content"]["application/json"];
146
- /** The success response body of `POST /account/v1/promotion-codes/preview`. */
147
- export type PreviewPromotionCodeResult = operations["preview-promotion-code"]["responses"][200]["content"]["application/json"];
148
- /** The request body of `POST /account/v1/promotion-codes/preview`. */
149
- export type PreviewPromotionCodeBody = NonNullable<operations["preview-promotion-code"]["requestBody"]>["content"]["application/json"];
150
146
  /** The success response body of `GET /account/v1/allowances`. */
151
147
  export type ListAllowancesResult = operations["list-allowances"]["responses"][200]["content"]["application/json"];
152
148
  /** The query parameters of `GET /account/v1/allowances`. */
@@ -376,7 +376,7 @@ export interface paths {
376
376
  patch?: never;
377
377
  trace?: never;
378
378
  };
379
- "/account/v1/invoices/{invoiceId}/collect-payment": {
379
+ "/account/v1/invoices/{invoiceId}/pay": {
380
380
  parameters: {
381
381
  query?: never;
382
382
  header?: never;
@@ -388,7 +388,7 @@ export interface paths {
388
388
  get?: never;
389
389
  put?: never;
390
390
  /**
391
- * Collect payment for an invoice
391
+ * Pay an invoice
392
392
  * @description Applies eligible credit grants and available balance as requested, then collects the remainder
393
393
  * through the selected payment gateway and method. With no gateway selection, insufficient
394
394
  * account funds fail without starting an online payment. Card and non-card methods use this same
@@ -404,7 +404,7 @@ export interface paths {
404
404
  * canceled, with `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`; and that of an order whose
405
405
  * payment deadline has passed, with `BILLING_ORDER_EXPIRED`.
406
406
  */
407
- post: operations["collect-invoice-payment"];
407
+ post: operations["pay-invoice"];
408
408
  delete?: never;
409
409
  options?: never;
410
410
  head?: never;
@@ -778,7 +778,7 @@ export interface paths {
778
778
  * - 409 `BILLING_CANCELLATION_SCHEDULES_DIFFER` when, for `period_end`, the paid terms end at
779
779
  * different times;
780
780
  * - 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being canceled
781
- * (`meta.cancellation_id`) or reclaimed (`meta.job_id`);
781
+ * (`meta.cancellation_id`) or reclaimed (`meta.action_id`);
782
782
  * - 409 `BILLING_ORDER_PAYMENT_IN_FLIGHT` while an online payment for a renewal of one of them
783
783
  * is in progress;
784
784
  * - 409 `BILLING_CANCELLATION_REFUND_CHANGED` when the refund is no longer
@@ -953,27 +953,6 @@ export interface paths {
953
953
  patch?: never;
954
954
  trace?: never;
955
955
  };
956
- "/account/v1/promotion-codes/preview": {
957
- parameters: {
958
- query?: never;
959
- header?: never;
960
- path?: never;
961
- cookie?: never;
962
- };
963
- get?: never;
964
- put?: never;
965
- /**
966
- * Preview promotion code
967
- * @description Nothing is recorded and the code is not consumed. Use it to show the customer the effect
968
- * before they commit.
969
- */
970
- post: operations["preview-promotion-code"];
971
- delete?: never;
972
- options?: never;
973
- head?: never;
974
- patch?: never;
975
- trace?: never;
976
- };
977
956
  "/account/v1/allowances": {
978
957
  parameters: {
979
958
  query?: never;
@@ -1064,11 +1043,11 @@ export interface paths {
1064
1043
  * A successful confirmation records the discount, including any recurring discount terms,
1065
1044
  * reserves its redemption, moves pending_checkout to pending and finalizes the invoice when one
1066
1045
  * is required. The reservation counts toward the code's limits and is consumed when the invoice
1067
- * is paid, or at confirmation when nothing is due. Use collect-invoice-payment to collect
1046
+ * is paid, or at confirmation when nothing is due. Use pay-invoice to collect
1068
1047
  * its outstanding amount from account funds or a payment gateway. No payment attempt or checkout
1069
- * session is created by this operation. A purchase with nothing to collect can proceed to Billing
1070
- * admission without a payment transaction. An absent invoice or zero immediate amount still
1071
- * requires checkout confirmation; checkout alone does not confirm resource delivery.
1048
+ * session is created by this operation. An order whose total is zero completes checkout at
1049
+ * placement in either mode and does not need this operation; an order with an amount due, even
1050
+ * when credits would cover it, still does. Checkout alone does not confirm resource delivery.
1072
1051
  *
1073
1052
  * Retrying with the same code and expected amount returns the existing order without another
1074
1053
  * redemption. Omitting the code on a confirmed checkout retains its recorded discount. Changing
@@ -1178,34 +1157,41 @@ export interface components {
1178
1157
  */
1179
1158
  TerminationPolicy: "immediate" | "period_end";
1180
1159
  /**
1181
- * @description Prorated returns the unused value of paid service periods using integer-second duration ratios. Setup fees are excluded. Tax and funds follow the original invoice and payment sources.
1160
+ * @description none refunds nothing. prorated refunds the amount paid for the current period minus the value of
1161
+ * the time used, never below zero and never more than what remains unrefunded. The time used runs
1162
+ * from the period start to the effective cancellation time and is valued at the plan's
1163
+ * shorter-period prices in the same currency, frozen at purchase as the order item's
1164
+ * refund_monthly_amount and refund_hourly_amount: each full calendar month at the one-month prepaid
1165
+ * price, the remainder at the postpaid hourly price or, without one, at the one-month price by the
1166
+ * second. When the plan has no prepaid period shorter than the one bought, the time used is valued
1167
+ * at the price paid, pro rata by the second. Discounts are not refunded, as they were never paid,
1168
+ * and setup fees are excluded. The refunded part returns to the payment sources it came from. Tax
1169
+ * paid is refunded in the same proportion as the amount it was paid on.
1182
1170
  * @enum {string}
1183
1171
  */
1184
1172
  RefundPolicy: "none" | "prorated";
1185
- /** @description Quote exactly one target. An existing order, a renewal list and a cancellation are mutually exclusive. */
1186
- QuoteRequest: components["schemas"]["OrderQuoteRequest"] | components["schemas"]["RenewalQuoteRequest"] | components["schemas"]["CancellationQuoteRequest"];
1187
1173
  /**
1188
- * @description Preview checkout of one existing order. Its recorded purchase terms supply every line.
1189
- * Without a code, an applicable account discount is selected. A preview neither changes the
1190
- * order nor reserves or consumes a redemption. A confirmed order returns its recorded amounts.
1174
+ * @description Quote exactly one target: an existing `order_id`, `renewals` or a `cancellation`. Giving none or
1175
+ * more than one, or a `promotion_code` with `renewals` or a `cancellation`, fails with HTTP 400
1176
+ * `BILLING_PURCHASE_INVALID` and `meta.field` naming the offending field. Without a code, an
1177
+ * applicable account discount is selected. An explicit code is evaluated without reserving or
1178
+ * consuming a redemption and must be supplied again when confirming checkout through Billing.
1191
1179
  */
1192
- OrderQuoteRequest: {
1193
- /** Format: uuid */
1194
- order_id: string;
1195
- /** @description Code to evaluate for this order. Must be supplied again when confirming checkout. */
1180
+ QuoteRequest: {
1181
+ /**
1182
+ * Format: uuid
1183
+ * @description Preview checkout of this existing order. Its recorded purchase terms supply every line, and a
1184
+ * confirmed order returns its recorded amounts. A preview does not change the order.
1185
+ */
1186
+ order_id?: string;
1187
+ /**
1188
+ * @description Preview renewing these subscriptions, each at most once. Each entry represents a separate
1189
+ * renewal order. To preview a new promotion code, create a renewal order and quote it by order_id.
1190
+ */
1191
+ renewals?: components["schemas"]["QuoteRenewal"][];
1192
+ cancellation?: components["schemas"]["QuoteCancellation"];
1196
1193
  promotion_code?: string;
1197
1194
  };
1198
- /**
1199
- * @description Preview renewing subscriptions, each at most once. Each entry represents a separate renewal
1200
- * order. To preview a new promotion code, create a renewal order and quote it by order_id.
1201
- */
1202
- RenewalQuoteRequest: {
1203
- renewals: components["schemas"]["QuoteRenewal"][];
1204
- };
1205
- /** @description Preview one cancellation without combining it with a purchase, renewal or promotion code. */
1206
- CancellationQuoteRequest: {
1207
- cancellation: components["schemas"]["QuoteCancellation"];
1208
- };
1209
1195
  CheckoutOrderRequest: {
1210
1196
  /**
1211
1197
  * @description The code to apply, evaluated again at confirmation. Omit to select an applicable account
@@ -1221,7 +1207,9 @@ export interface components {
1221
1207
  /**
1222
1208
  * @description Price renewing a prepaid subscription. Give `price_id`, or `interval` with
1223
1209
  * `interval_count`, to renew for another term at the price currently sold for it. Naming
1224
- * the current term, or giving neither, renews at the agreed amount.
1210
+ * the current term, or giving neither, renews at the agreed amount. A term sold at several
1211
+ * prices that differ in termination policy is refused with 409
1212
+ * `BILLING_RENEWAL_OPTION_AMBIGUOUS` unless `termination_policy` or `price_id` is given.
1225
1213
  */
1226
1214
  QuoteRenewal: {
1227
1215
  /** Format: uuid */
@@ -1231,6 +1219,8 @@ export interface components {
1231
1219
  /** @enum {string} */
1232
1220
  interval?: "day" | "month" | "year";
1233
1221
  interval_count?: number;
1222
+ /** @description With `interval` and `interval_count`, chooses among prices of that term that differ in termination policy. */
1223
+ termination_policy?: components["schemas"]["TerminationPolicy"];
1234
1224
  /**
1235
1225
  * @description How many consecutive periods to renew for.
1236
1226
  * @default 1
@@ -1391,8 +1381,8 @@ export interface components {
1391
1381
  * @description What the cancellation would return, subscription by subscription and in total, as of now. Give
1392
1382
  * `proration_date` and `refundable_amount` when creating the cancellation.
1393
1383
  *
1394
- * - `unused_amount`: before tax, the value of the paid service still unused, whatever the refund
1395
- * terms say.
1384
+ * - `unused_amount`: before tax, the amount paid for the current periods minus the value of the
1385
+ * time used, valued as refund policy `prorated` describes, whatever the refund terms say.
1396
1386
  * - `refundable_amount`: what is returned the way it was paid, including the tax paid on it;
1397
1387
  * `refund_amount` plus `credit_amount`.
1398
1388
  * - `refund_amount`: the part returned to the balance or to the payment method.
@@ -1603,30 +1593,6 @@ export interface components {
1603
1593
  };
1604
1594
  /** @description Immutable platform service identifier, such as compute, canopy or assistant. */
1605
1595
  ProductID: string;
1606
- /**
1607
- * @description Identify a price directly, or select a price for a plan. For each resource give its ID or lookup key, never both. Lookup keys require product_id.
1608
- *
1609
- * Charges for future usage are not estimated here; the service that sells the product quotes
1610
- * them with its purchase.
1611
- */
1612
- QuoteLine: {
1613
- price_lookup_key?: string;
1614
- plan_lookup_key?: string;
1615
- /** Format: uuid */
1616
- price_id?: string;
1617
- product_id?: components["schemas"]["ProductID"];
1618
- /** Format: uuid */
1619
- plan_id?: string;
1620
- /**
1621
- * @description Narrows the selection when a plan offers more than one billing type.
1622
- * @enum {string}
1623
- */
1624
- price_type?: "postpaid" | "prepaid" | "one_time";
1625
- /** @enum {string} */
1626
- interval?: "none" | "day" | "month" | "year";
1627
- interval_count?: number;
1628
- quantity: string;
1629
- };
1630
1596
  BillingAccount: {
1631
1597
  /** Format: int64 */
1632
1598
  id: number;
@@ -1771,6 +1737,8 @@ export interface components {
1771
1737
  CreditGroup: {
1772
1738
  /** @description What the credit in this group may pay for. No restrictions means anything on the account. */
1773
1739
  applies_to: components["schemas"]["Applicability"];
1740
+ /** @description Restricted to your first purchase of anything it applies to. */
1741
+ first_purchase_only?: boolean;
1774
1742
  amount: components["schemas"]["Money"];
1775
1743
  };
1776
1744
  ProjectBillingInfo: {
@@ -1978,7 +1946,7 @@ export interface components {
1978
1946
  * An unresolved channel payment is reused; retries do not apply the grant or balance portions twice.
1979
1947
  * Without a gateway selection, insufficient account funds fail without starting an online payment.
1980
1948
  */
1981
- CollectInvoicePaymentRequest: {
1949
+ PayInvoiceRequest: {
1982
1950
  /** @description Required to collect an online remainder. An existing attempt keeps its original gateway. */
1983
1951
  payment_gateway?: string;
1984
1952
  /** @description Required with payment_gateway; for example card, wechat_pay or alipay. */
@@ -2169,6 +2137,8 @@ export interface components {
2169
2137
  /** @description Subtotal less discount plus tax. Balance and credit grants are payment sources, not reductions of the receivable. */
2170
2138
  total: components["schemas"]["Money"];
2171
2139
  amount_paid?: components["schemas"]["Money"];
2140
+ /** @description What is still collectible after applied credits and successful payments; never below zero. A draft order invoice is not collectible until checkout confirms it, and a paid or void invoice has none. */
2141
+ amount_due: components["schemas"]["Money"];
2172
2142
  /** Format: date-time */
2173
2143
  period_start?: string | null;
2174
2144
  /**
@@ -2332,6 +2302,8 @@ export interface components {
2332
2302
  currency: string;
2333
2303
  /** @description What this credit may pay for. No restrictions means anything on the account. */
2334
2304
  applies_to: components["schemas"]["Applicability"];
2305
+ /** @description Restricted to your first purchase of anything it applies to. */
2306
+ first_purchase_only?: boolean;
2335
2307
  /** @enum {string} */
2336
2308
  status: "active" | "depleted" | "expired" | "voided";
2337
2309
  /** Format: date-time */
@@ -2414,7 +2386,10 @@ export interface components {
2414
2386
  * - `subscription_canceled`: the subscription was canceled and its unused value returned under
2415
2387
  * its refund terms.
2416
2388
  * - `future_period_canceled`: a renewal that had not started yet was withdrawn.
2417
- * - `downgrade_difference`: the unused value above the new price after a downgrade.
2389
+ * - `downgrade_difference`: after a downgrade, the remaining value of what was paid, valued as refund
2390
+ * policy `prorated` describes, minus the new configuration's cost for the remaining time at the
2391
+ * change item's `refund_monthly_amount` and `refund_hourly_amount`. Nothing is refunded when that is
2392
+ * zero or less.
2418
2393
  * - `usage_true_up`: usage priced again over the whole month cost less than was charged.
2419
2394
  * - `payment_not_applied`: a payment arrived after its invoice could no longer be paid.
2420
2395
  * - `operator`: made by the platform operator.
@@ -2488,14 +2463,15 @@ export interface components {
2488
2463
  * through checkout and delivery. One order may create several subscriptions, such as an instance,
2489
2464
  * its system disk and its address; it has no single subscription ID.
2490
2465
  *
2491
- * Pending does not grant service or accrue usage. Payment confirmation and order acceptance do
2492
- * not activate a service-owned subscription. It becomes active when the owning service confirms
2493
- * delivery, with started_at set to the confirmed effective time. Prepaid service periods start
2466
+ * Pending and provisioning do not grant service or accrue usage. A service-owned subscription
2467
+ * becomes provisioning when the owning service accepts the order, and active when the service
2468
+ * confirms delivery, with started_at set to the confirmed effective time; payment changes neither. Prepaid service periods start
2494
2469
  * then; postpaid usage starts only when the service reports actual delivery and metering.
2495
2470
  *
2496
2471
  * One-time delivery may omit a subscription. Renewals reference and extend existing subscriptions
2497
- * rather than creating another; changes may create pending replacements. Canceling or failing an
2498
- * unfulfilled purchase closes its pending subscriptions without starting a service period.
2472
+ * rather than creating another; a change keeps the subscription ID and switches its terms when it
2473
+ * takes effect. Canceling or failing an
2474
+ * unfulfilled purchase closes its pending or provisioning subscriptions without starting a service period.
2499
2475
  * Fixed renewals use the agreed recurring_amount and interval; already paid periods retain their
2500
2476
  * original value. Technical state belongs to the owning service.
2501
2477
  *
@@ -2521,7 +2497,10 @@ export interface components {
2521
2497
  refund_policy?: components["schemas"]["RefundPolicy"];
2522
2498
  /** Format: uuid */
2523
2499
  order_item_id?: string;
2524
- /** Format: uuid */
2500
+ /**
2501
+ * Format: uuid
2502
+ * @description Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID.
2503
+ */
2525
2504
  replaces_subscription_id?: string;
2526
2505
  /** Format: uuid */
2527
2506
  coupon_id?: string;
@@ -2569,20 +2548,21 @@ export interface components {
2569
2548
  quantity: string;
2570
2549
  /**
2571
2550
  * Format: date-time
2572
- * @description End of the prepaid service already activated. Null for a new pending subscription, even
2573
- * when its purchase has been paid, and for postpaid subscriptions with no prepaid end date.
2551
+ * @description End of the prepaid service already activated. Null until a new subscription becomes active,
2552
+ * even when its purchase has been paid, and for postpaid subscriptions with no prepaid end date.
2574
2553
  */
2575
2554
  paid_until?: string | null;
2576
2555
  auto_renew: boolean;
2577
2556
  /**
2578
- * @description pending means the purchase relationship exists but service has not started. For a
2579
- * service-owned purchase, only confirmed delivery moves it to active; paying alone does not.
2557
+ * @description pending means the purchase relationship exists but its order has not been accepted.
2558
+ * provisioning means the service accepted the order and is delivering. For a service-owned
2559
+ * purchase, only confirmed delivery moves it to active; paying alone does not.
2580
2560
  * @enum {string}
2581
2561
  */
2582
- status: "pending" | "active" | "suspended" | "canceled" | "terminated";
2562
+ status: "pending" | "provisioning" | "active" | "suspended" | "canceled" | "terminated";
2583
2563
  /**
2584
2564
  * Format: date-time
2585
- * @description Confirmed start of service. Null for a new pending subscription, including after payment.
2565
+ * @description Confirmed start of service. Null until a new subscription becomes active, including after payment.
2586
2566
  */
2587
2567
  started_at?: string | null;
2588
2568
  /** Format: date-time */
@@ -2631,7 +2611,9 @@ export interface components {
2631
2611
  *
2632
2612
  * Leaving both out renews at the price this item already bills at, which a later price
2633
2613
  * change does not affect. Naming a term that differs from the current one is a fresh
2634
- * choice, so it is bought at today's price. Naming the current term changes nothing.
2614
+ * choice, so it is bought at today's price. Naming the current term changes nothing. A
2615
+ * term sold at several prices that differ in termination policy is refused with 409
2616
+ * `BILLING_RENEWAL_OPTION_AMBIGUOUS` unless `termination_policy` is given.
2635
2617
  *
2636
2618
  * List the terms on offer with the renewal prices operation.
2637
2619
  */
@@ -2641,6 +2623,8 @@ export interface components {
2641
2623
  * @enum {string}
2642
2624
  */
2643
2625
  interval?: "day" | "month" | "year";
2626
+ /** @description With `interval` and `interval_count`, chooses among prices of that term that differ in termination policy. */
2627
+ termination_policy?: components["schemas"]["TerminationPolicy"];
2644
2628
  /** Format: uuid */
2645
2629
  payment_method_id?: string;
2646
2630
  /**
@@ -2679,8 +2663,9 @@ export interface components {
2679
2663
  auto_renew: boolean;
2680
2664
  };
2681
2665
  /**
2682
- * @description pending_checkout has recorded purchase terms but no confirmed checkout. An absent invoice
2683
- * or zero total does not permit acceptance. Confirmation moves it to pending. Both pending_checkout
2666
+ * @description pending_checkout has recorded purchase terms but no confirmed checkout; only a deferred order
2667
+ * with an amount due reaches it, since a zero-total order completes checkout at placement.
2668
+ * Confirmation moves it to pending. Both pending_checkout
2684
2669
  * and pending can expire or be canceled; neither establishes service delivery.
2685
2670
  *
2686
2671
  * Follows the items. `pending` has confirmed checkout, is not yet accepted and may be paid or unpaid. `active` is
@@ -2798,75 +2783,6 @@ export interface components {
2798
2783
  brand?: string;
2799
2784
  last4?: string;
2800
2785
  };
2801
- /** @description Specify lines to check whether the promotion code applies to new purchases and to estimate its discount. Without lines, the response contains the code terms without a purchase-specific applicability decision. */
2802
- PromotionCodePreviewRequest: {
2803
- /** Format: int64 */
2804
- billing_account_id: number;
2805
- promotion_code: string;
2806
- /** @description New purchases to test against, in the same shape as a quote. */
2807
- lines?: components["schemas"]["QuoteLine"][];
2808
- };
2809
- /** @description Describes a usable promotion code and its applicability to the requested purchase. Invalid codes return an error response. */
2810
- PromotionCodePreview: {
2811
- min_amount?: string;
2812
- /** @enum {string} */
2813
- type?: "percentage" | "fixed_amount" | "price_override" | "free_setup";
2814
- recurring?: boolean;
2815
- recurring_cycles?: number;
2816
- name?: string;
2817
- /** @description For a fixed-amount discount. */
2818
- amount?: components["schemas"]["Money"];
2819
- /** @description For a percentage discount. */
2820
- percent_off?: string;
2821
- max_discount?: components["schemas"]["Money"];
2822
- currency?: string;
2823
- /**
2824
- * @description What it may be used for. Present whether or not a purchase was given, so that the
2825
- * terms can be shown before anything is chosen.
2826
- */
2827
- applies_to?: components["schemas"]["Applicability"];
2828
- /**
2829
- * @description The terms in one sentence, ready to display — for example "Compute, new purchases
2830
- * only, from 100.00" or "No restriction on product or purchase type".
2831
- */
2832
- summary?: string;
2833
- /** Format: date-time */
2834
- valid_until?: string | null;
2835
- /**
2836
- * @description Whether it applies to the purchase given in `lines`. Absent when no purchase was
2837
- * given.
2838
- */
2839
- applicable?: boolean;
2840
- applicable_reason?: components["schemas"]["PromotionCodeRejection"];
2841
- /**
2842
- * @description The total of the lines that match the restrictions. This is what the threshold is
2843
- * measured against, not the order total.
2844
- */
2845
- qualifying_amount?: components["schemas"]["Money"];
2846
- /**
2847
- * @description How much more of a qualifying purchase is needed to reach the threshold. `"0"` once
2848
- * it is met.
2849
- */
2850
- shortfall?: components["schemas"]["Money"];
2851
- /**
2852
- * @description What it would take off this purchase. An estimate: the discount is confirmed during
2853
- * order checkout. Use CreateQuote for the purchase's complete total, including tax.
2854
- */
2855
- estimated_discount?: components["schemas"]["Money"];
2856
- };
2857
- /**
2858
- * @description Why a code cannot be used. `none` when it can.
2859
- *
2860
- * `operation_not_covered` means the code is limited to certain purchase actions — a
2861
- * first-purchase code presented for a renewal, for example.
2862
- *
2863
- * `term_not_covered` means the code is limited to certain term lengths. A purchase with
2864
- * no term, such as metered usage, is reported the same way.
2865
- *
2866
- * `below_minimum` is accompanied by `shortfall`.
2867
- * @enum {string}
2868
- */
2869
- PromotionCodeRejection: "none" | "not_found" | "expired" | "not_yet_valid" | "exhausted" | "already_redeemed" | "currency_mismatch" | "product_not_covered" | "plan_not_covered" | "price_not_covered" | "price_type_not_covered" | "operation_not_covered" | "term_not_covered" | "not_first_purchase" | "below_minimum";
2870
2786
  /**
2871
2787
  * @description Which purchase this applies to. `upgrade` and `downgrade` are told apart by money: a change
2872
2788
  * that costs more for the remainder of the period is an upgrade, one that returns money
@@ -2909,6 +2825,8 @@ export interface components {
2909
2825
  * including setup fees and traffic.
2910
2826
  */
2911
2827
  applies_to: components["schemas"]["Applicability"];
2828
+ /** @description Restricted to your first purchase of anything it applies to. */
2829
+ first_purchase_only?: boolean;
2912
2830
  /** Format: date-time */
2913
2831
  started_at?: string;
2914
2832
  /** Format: date-time */
@@ -2918,7 +2836,7 @@ export interface components {
2918
2836
  items: components["schemas"]["Discount"][];
2919
2837
  pagination: components["schemas"]["OffsetPagination"];
2920
2838
  };
2921
- /** @description A price's display terms, including retired prices referenced by an applicability list. */
2839
+ /** @description A price's display terms, including archived prices referenced by an applicability list. */
2922
2840
  PriceOption: {
2923
2841
  product: components["schemas"]["Product"];
2924
2842
  plan: components["schemas"]["ObjectIdentity"];
@@ -2935,19 +2853,20 @@ export interface components {
2935
2853
  /** @description How many periods one purchase covers. */
2936
2854
  interval_count?: number;
2937
2855
  unit_amount?: components["schemas"]["Money"];
2856
+ /** @description False once the price is archived. It still applies to purchases already made at this price. */
2857
+ active: boolean;
2938
2858
  };
2939
2859
  /**
2940
- * @description Product, plan and price lists form a union; three empty lists permit every item.
2941
- * Other conditions apply together. Entries always include their display fields.
2860
+ * @description Anything not excluded that matches an inclusion, or anything not excluded when no inclusion is
2861
+ * given, subject to the billing type, operation and term conditions. Entries always include their
2862
+ * display fields; archived plans and prices stay listed with active set to false.
2942
2863
  */
2943
2864
  Applicability: {
2944
2865
  products?: components["schemas"]["Product"][];
2945
- plans?: components["schemas"]["ObjectIdentity"][];
2866
+ plans?: components["schemas"]["ApplicablePlan"][];
2946
2867
  prices?: components["schemas"]["PriceOption"][];
2947
2868
  price_types?: string[];
2948
2869
  operations?: components["schemas"]["PurchaseOperation"][];
2949
- /** @description Restricted to your first purchase of a covered product. */
2950
- first_purchase_only?: boolean;
2951
2870
  /**
2952
2871
  * @description The shortest term a purchase may have, in months. A purchase with no term, such as
2953
2872
  * metered usage, never qualifies while this is set.
@@ -2955,6 +2874,16 @@ export interface components {
2955
2874
  min_term_months?: number;
2956
2875
  /** @description The longest term a purchase may have, in months. */
2957
2876
  max_term_months?: number;
2877
+ excluded_products?: components["schemas"]["Product"][];
2878
+ excluded_plans?: components["schemas"]["ApplicablePlan"][];
2879
+ excluded_prices?: components["schemas"]["PriceOption"][];
2880
+ };
2881
+ /** @description A plan it refers to. active is false once the plan is archived; it still applies to subscriptions already on this plan. */
2882
+ ApplicablePlan: {
2883
+ /** Format: uuid */
2884
+ id: string;
2885
+ name: string;
2886
+ active: boolean;
2958
2887
  };
2959
2888
  /**
2960
2889
  * @description Frozen purchase terms. Monetary fields come from related invoice-line snapshots and are absent
@@ -2969,8 +2898,8 @@ export interface components {
2969
2898
  /**
2970
2899
  * Format: uuid
2971
2900
  * @description Stable Billing subscription ID. A new prepaid or postpaid service purchase returns the
2972
- * pending subscription here; renewals reference the existing subscription and changes the
2973
- * replacement. Absent for delivery without a subscription. This is not a business resource ID.
2901
+ * pending subscription here; renewals and changes reference the existing subscription, which
2902
+ * keeps its ID. Absent for delivery without a subscription. This is not a business resource ID.
2974
2903
  */
2975
2904
  subscription_id?: string;
2976
2905
  /** @enum {string} */
@@ -2978,6 +2907,17 @@ export interface components {
2978
2907
  interval_count?: number;
2979
2908
  termination_policy?: components["schemas"]["TerminationPolicy"];
2980
2909
  refund_policy?: components["schemas"]["RefundPolicy"];
2910
+ /**
2911
+ * @description Prepaid items only: the plan's one-month prepaid price for this item's quantity before tax, frozen
2912
+ * at purchase, used to value time used under a prorated refund or a downgrade. Null when the plan has
2913
+ * no prepaid period shorter than the one bought.
2914
+ */
2915
+ refund_monthly_amount?: string | null;
2916
+ /**
2917
+ * @description Prepaid items only: the plan's postpaid hourly price for this item's quantity before tax, frozen at
2918
+ * purchase, used for time used short of a full month. Null when the plan has no postpaid price.
2919
+ */
2920
+ refund_hourly_amount?: string | null;
2981
2921
  completes_on_payment: boolean;
2982
2922
  recurring_amount?: string;
2983
2923
  setup_amount?: string;
@@ -3012,14 +2952,16 @@ export interface components {
3012
2952
  quantity: string;
3013
2953
  /**
3014
2954
  * @description The unit amount of the price this line is charged under. Absent for a tiered price, which has no
3015
- * single unit amount, and for a change that takes effect at once, which is charged the prorated
3016
- * difference.
2955
+ * single unit amount, and for a change that takes effect at once, which is charged as `gross_amount`
2956
+ * describes.
3017
2957
  */
3018
2958
  unit_amount?: components["schemas"]["Money"];
3019
2959
  /**
3020
2960
  * @description Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`
3021
- * times `quantity`; a minimum charge can make it higher. For a change that takes effect at once it is
3022
- * the prorated difference. The setup fee is not part of it; see `setup_amount`.
2961
+ * times `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is
2962
+ * the new price minus the old price for the time left in the paid period, both at the subscription's
2963
+ * own period price, and the period end does not move; a downgrade charges nothing and may refund the
2964
+ * difference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.
3023
2965
  *
3024
2966
  * Under an inclusive tax rate it includes tax, as the price does, and the included part is
3025
2967
  * `tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes
@@ -3131,6 +3073,8 @@ export interface components {
3131
3073
  tax_amount: string;
3132
3074
  total: string;
3133
3075
  amount_paid: string;
3076
+ /** @description What is still collectible after applied credits and successful payments; never below zero. */
3077
+ amount_due: string;
3134
3078
  amount_refunded: string;
3135
3079
  /** Format: date-time */
3136
3080
  due_at?: string;
@@ -3733,7 +3677,7 @@ export interface operations {
3733
3677
  default: components["responses"]["Error"];
3734
3678
  };
3735
3679
  };
3736
- "collect-invoice-payment": {
3680
+ "pay-invoice": {
3737
3681
  parameters: {
3738
3682
  query?: never;
3739
3683
  header?: never;
@@ -3744,7 +3688,7 @@ export interface operations {
3744
3688
  };
3745
3689
  requestBody?: {
3746
3690
  content: {
3747
- "application/json": components["schemas"]["CollectInvoicePaymentRequest"];
3691
+ "application/json": components["schemas"]["PayInvoiceRequest"];
3748
3692
  };
3749
3693
  };
3750
3694
  responses: {
@@ -4398,31 +4342,6 @@ export interface operations {
4398
4342
  default: components["responses"]["Error"];
4399
4343
  };
4400
4344
  };
4401
- "preview-promotion-code": {
4402
- parameters: {
4403
- query?: never;
4404
- header?: never;
4405
- path?: never;
4406
- cookie?: never;
4407
- };
4408
- requestBody: {
4409
- content: {
4410
- "application/json": components["schemas"]["PromotionCodePreviewRequest"];
4411
- };
4412
- };
4413
- responses: {
4414
- /** @description OK */
4415
- 200: {
4416
- headers: {
4417
- [name: string]: unknown;
4418
- };
4419
- content: {
4420
- "application/json": components["schemas"]["PromotionCodePreview"];
4421
- };
4422
- };
4423
- default: components["responses"]["Error"];
4424
- };
4425
- };
4426
4345
  "list-allowances": {
4427
4346
  parameters: {
4428
4347
  query?: {