@leaflow/sdk 0.102.0 → 0.103.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;
@@ -1978,7 +1944,7 @@ export interface components {
1978
1944
  * An unresolved channel payment is reused; retries do not apply the grant or balance portions twice.
1979
1945
  * Without a gateway selection, insufficient account funds fail without starting an online payment.
1980
1946
  */
1981
- CollectInvoicePaymentRequest: {
1947
+ PayInvoiceRequest: {
1982
1948
  /** @description Required to collect an online remainder. An existing attempt keeps its original gateway. */
1983
1949
  payment_gateway?: string;
1984
1950
  /** @description Required with payment_gateway; for example card, wechat_pay or alipay. */
@@ -2169,6 +2135,8 @@ export interface components {
2169
2135
  /** @description Subtotal less discount plus tax. Balance and credit grants are payment sources, not reductions of the receivable. */
2170
2136
  total: components["schemas"]["Money"];
2171
2137
  amount_paid?: components["schemas"]["Money"];
2138
+ /** @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. */
2139
+ amount_due: components["schemas"]["Money"];
2172
2140
  /** Format: date-time */
2173
2141
  period_start?: string | null;
2174
2142
  /**
@@ -2414,7 +2382,10 @@ export interface components {
2414
2382
  * - `subscription_canceled`: the subscription was canceled and its unused value returned under
2415
2383
  * its refund terms.
2416
2384
  * - `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.
2385
+ * - `downgrade_difference`: after a downgrade, the remaining value of what was paid, valued as refund
2386
+ * policy `prorated` describes, minus the new configuration's cost for the remaining time at the
2387
+ * change item's `refund_monthly_amount` and `refund_hourly_amount`. Nothing is refunded when that is
2388
+ * zero or less.
2418
2389
  * - `usage_true_up`: usage priced again over the whole month cost less than was charged.
2419
2390
  * - `payment_not_applied`: a payment arrived after its invoice could no longer be paid.
2420
2391
  * - `operator`: made by the platform operator.
@@ -2488,14 +2459,15 @@ export interface components {
2488
2459
  * through checkout and delivery. One order may create several subscriptions, such as an instance,
2489
2460
  * its system disk and its address; it has no single subscription ID.
2490
2461
  *
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
2462
+ * Pending and provisioning do not grant service or accrue usage. A service-owned subscription
2463
+ * becomes provisioning when the owning service accepts the order, and active when the service
2464
+ * confirms delivery, with started_at set to the confirmed effective time; payment changes neither. Prepaid service periods start
2494
2465
  * then; postpaid usage starts only when the service reports actual delivery and metering.
2495
2466
  *
2496
2467
  * 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.
2468
+ * rather than creating another; a change keeps the subscription ID and switches its terms when it
2469
+ * takes effect. Canceling or failing an
2470
+ * unfulfilled purchase closes its pending or provisioning subscriptions without starting a service period.
2499
2471
  * Fixed renewals use the agreed recurring_amount and interval; already paid periods retain their
2500
2472
  * original value. Technical state belongs to the owning service.
2501
2473
  *
@@ -2521,7 +2493,10 @@ export interface components {
2521
2493
  refund_policy?: components["schemas"]["RefundPolicy"];
2522
2494
  /** Format: uuid */
2523
2495
  order_item_id?: string;
2524
- /** Format: uuid */
2496
+ /**
2497
+ * Format: uuid
2498
+ * @description Present only on subscriptions created by an earlier change that replaced the subscription. A change now keeps the subscription ID.
2499
+ */
2525
2500
  replaces_subscription_id?: string;
2526
2501
  /** Format: uuid */
2527
2502
  coupon_id?: string;
@@ -2569,20 +2544,21 @@ export interface components {
2569
2544
  quantity: string;
2570
2545
  /**
2571
2546
  * 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.
2547
+ * @description End of the prepaid service already activated. Null until a new subscription becomes active,
2548
+ * even when its purchase has been paid, and for postpaid subscriptions with no prepaid end date.
2574
2549
  */
2575
2550
  paid_until?: string | null;
2576
2551
  auto_renew: boolean;
2577
2552
  /**
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.
2553
+ * @description pending means the purchase relationship exists but its order has not been accepted.
2554
+ * provisioning means the service accepted the order and is delivering. For a service-owned
2555
+ * purchase, only confirmed delivery moves it to active; paying alone does not.
2580
2556
  * @enum {string}
2581
2557
  */
2582
- status: "pending" | "active" | "suspended" | "canceled" | "terminated";
2558
+ status: "pending" | "provisioning" | "active" | "suspended" | "canceled" | "terminated";
2583
2559
  /**
2584
2560
  * Format: date-time
2585
- * @description Confirmed start of service. Null for a new pending subscription, including after payment.
2561
+ * @description Confirmed start of service. Null until a new subscription becomes active, including after payment.
2586
2562
  */
2587
2563
  started_at?: string | null;
2588
2564
  /** Format: date-time */
@@ -2631,7 +2607,9 @@ export interface components {
2631
2607
  *
2632
2608
  * Leaving both out renews at the price this item already bills at, which a later price
2633
2609
  * 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.
2610
+ * choice, so it is bought at today's price. Naming the current term changes nothing. A
2611
+ * term sold at several prices that differ in termination policy is refused with 409
2612
+ * `BILLING_RENEWAL_OPTION_AMBIGUOUS` unless `termination_policy` is given.
2635
2613
  *
2636
2614
  * List the terms on offer with the renewal prices operation.
2637
2615
  */
@@ -2641,6 +2619,8 @@ export interface components {
2641
2619
  * @enum {string}
2642
2620
  */
2643
2621
  interval?: "day" | "month" | "year";
2622
+ /** @description With `interval` and `interval_count`, chooses among prices of that term that differ in termination policy. */
2623
+ termination_policy?: components["schemas"]["TerminationPolicy"];
2644
2624
  /** Format: uuid */
2645
2625
  payment_method_id?: string;
2646
2626
  /**
@@ -2679,8 +2659,9 @@ export interface components {
2679
2659
  auto_renew: boolean;
2680
2660
  };
2681
2661
  /**
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
2662
+ * @description pending_checkout has recorded purchase terms but no confirmed checkout; only a deferred order
2663
+ * with an amount due reaches it, since a zero-total order completes checkout at placement.
2664
+ * Confirmation moves it to pending. Both pending_checkout
2684
2665
  * and pending can expire or be canceled; neither establishes service delivery.
2685
2666
  *
2686
2667
  * Follows the items. `pending` has confirmed checkout, is not yet accepted and may be paid or unpaid. `active` is
@@ -2798,75 +2779,6 @@ export interface components {
2798
2779
  brand?: string;
2799
2780
  last4?: string;
2800
2781
  };
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
2782
  /**
2871
2783
  * @description Which purchase this applies to. `upgrade` and `downgrade` are told apart by money: a change
2872
2784
  * that costs more for the remainder of the period is an upgrade, one that returns money
@@ -2918,7 +2830,7 @@ export interface components {
2918
2830
  items: components["schemas"]["Discount"][];
2919
2831
  pagination: components["schemas"]["OffsetPagination"];
2920
2832
  };
2921
- /** @description A price's display terms, including retired prices referenced by an applicability list. */
2833
+ /** @description A price's display terms, including archived prices referenced by an applicability list. */
2922
2834
  PriceOption: {
2923
2835
  product: components["schemas"]["Product"];
2924
2836
  plan: components["schemas"]["ObjectIdentity"];
@@ -2969,8 +2881,8 @@ export interface components {
2969
2881
  /**
2970
2882
  * Format: uuid
2971
2883
  * @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.
2884
+ * pending subscription here; renewals and changes reference the existing subscription, which
2885
+ * keeps its ID. Absent for delivery without a subscription. This is not a business resource ID.
2974
2886
  */
2975
2887
  subscription_id?: string;
2976
2888
  /** @enum {string} */
@@ -2978,6 +2890,17 @@ export interface components {
2978
2890
  interval_count?: number;
2979
2891
  termination_policy?: components["schemas"]["TerminationPolicy"];
2980
2892
  refund_policy?: components["schemas"]["RefundPolicy"];
2893
+ /**
2894
+ * @description Prepaid items only: the plan's one-month prepaid price for this item's quantity before tax, frozen
2895
+ * at purchase, used to value time used under a prorated refund or a downgrade. Null when the plan has
2896
+ * no prepaid period shorter than the one bought.
2897
+ */
2898
+ refund_monthly_amount?: string | null;
2899
+ /**
2900
+ * @description Prepaid items only: the plan's postpaid hourly price for this item's quantity before tax, frozen at
2901
+ * purchase, used for time used short of a full month. Null when the plan has no postpaid price.
2902
+ */
2903
+ refund_hourly_amount?: string | null;
2981
2904
  completes_on_payment: boolean;
2982
2905
  recurring_amount?: string;
2983
2906
  setup_amount?: string;
@@ -3012,14 +2935,16 @@ export interface components {
3012
2935
  quantity: string;
3013
2936
  /**
3014
2937
  * @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.
2938
+ * single unit amount, and for a change that takes effect at once, which is charged as `gross_amount`
2939
+ * describes.
3017
2940
  */
3018
2941
  unit_amount?: components["schemas"]["Money"];
3019
2942
  /**
3020
2943
  * @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`.
2944
+ * times `quantity`; a minimum charge can make it higher. For an upgrade that takes effect at once it is
2945
+ * the new price minus the old price for the time left in the paid period, both at the subscription's
2946
+ * own period price, and the period end does not move; a downgrade charges nothing and may refund the
2947
+ * difference instead. A change between equal period prices charges and refunds nothing. The setup fee is not part of it; see `setup_amount`.
3023
2948
  *
3024
2949
  * Under an inclusive tax rate it includes tax, as the price does, and the included part is
3025
2950
  * `tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes
@@ -3131,6 +3056,8 @@ export interface components {
3131
3056
  tax_amount: string;
3132
3057
  total: string;
3133
3058
  amount_paid: string;
3059
+ /** @description What is still collectible after applied credits and successful payments; never below zero. */
3060
+ amount_due: string;
3134
3061
  amount_refunded: string;
3135
3062
  /** Format: date-time */
3136
3063
  due_at?: string;
@@ -3733,7 +3660,7 @@ export interface operations {
3733
3660
  default: components["responses"]["Error"];
3734
3661
  };
3735
3662
  };
3736
- "collect-invoice-payment": {
3663
+ "pay-invoice": {
3737
3664
  parameters: {
3738
3665
  query?: never;
3739
3666
  header?: never;
@@ -3744,7 +3671,7 @@ export interface operations {
3744
3671
  };
3745
3672
  requestBody?: {
3746
3673
  content: {
3747
- "application/json": components["schemas"]["CollectInvoicePaymentRequest"];
3674
+ "application/json": components["schemas"]["PayInvoiceRequest"];
3748
3675
  };
3749
3676
  };
3750
3677
  responses: {
@@ -4398,31 +4325,6 @@ export interface operations {
4398
4325
  default: components["responses"]["Error"];
4399
4326
  };
4400
4327
  };
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
4328
  "list-allowances": {
4427
4329
  parameters: {
4428
4330
  query?: {
@@ -17,8 +17,8 @@ export interface paths {
17
17
  * `currency` is required: a plan has a price in each currency it is sold in, so "what does
18
18
  * this cost" has no answer without one.
19
19
  *
20
- * Retired prices are left out. Existing subscriptions still reference them, so this is not
21
- * the place to look up what an existing purchase is paying.
20
+ * Archived prices are left out. Existing subscriptions keep the terms they were bought at, so
21
+ * this is not the place to look up what an existing purchase is paying.
22
22
  */
23
23
  get: operations["list-prices"];
24
24
  put?: never;
@@ -103,7 +103,7 @@ export interface paths {
103
103
  };
104
104
  /**
105
105
  * Get a price
106
- * @description Returns the catalog price, including retired prices. Fixed purchase history and renewal agreements are shown on orders and subscriptions rather than reconstructed from today's catalog.
106
+ * @description Returns the catalog price, including archived prices. Fixed purchase history and renewal agreements are shown on orders and subscriptions rather than reconstructed from today's catalog.
107
107
  */
108
108
  get: operations["get-price"];
109
109
  put?: never;
@@ -216,7 +216,16 @@ export interface components {
216
216
  */
217
217
  TerminationPolicy: "immediate" | "period_end";
218
218
  /**
219
- * @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.
219
+ * @description none refunds nothing. prorated refunds the amount paid for the current period minus the value of
220
+ * the time used, never below zero and never more than what remains unrefunded. The time used runs
221
+ * from the period start to the effective cancellation time and is valued at the plan's
222
+ * shorter-period prices in the same currency, frozen at purchase as the order item's
223
+ * refund_monthly_amount and refund_hourly_amount: each full calendar month at the one-month prepaid
224
+ * price, the remainder at the postpaid hourly price or, without one, at the one-month price by the
225
+ * second. When the plan has no prepaid period shorter than the one bought, the time used is valued
226
+ * at the price paid, pro rata by the second. Discounts are not refunded, as they were never paid,
227
+ * and setup fees are excluded. The refunded part returns to the payment sources it came from. Tax
228
+ * paid is refunded in the same proportion as the amount it was paid on.
220
229
  * @enum {string}
221
230
  */
222
231
  RefundPolicy: "none" | "prorated";
@@ -245,7 +254,8 @@ export interface components {
245
254
  pagination: components["schemas"]["OffsetPagination"];
246
255
  };
247
256
  Plan: {
248
- enabled: boolean;
257
+ /** @description False once archived. An archived plan cannot be bought until it is active again. */
258
+ active: boolean;
249
259
  lookup_key?: string;
250
260
  product: components["schemas"]["Product"];
251
261
  features: components["schemas"]["PlanFeature"][];
@@ -268,7 +278,8 @@ export interface components {
268
278
  meter_id?: string;
269
279
  meter?: components["schemas"]["ObjectIdentity"];
270
280
  unit_quantity: string;
271
- enabled?: boolean;
281
+ /** @description False once archived. An archived price cannot be bought until it is active again. */
282
+ active: boolean;
272
283
  termination_policy?: components["schemas"]["TerminationPolicy"];
273
284
  refund_policy?: components["schemas"]["RefundPolicy"];
274
285
  product_id?: components["schemas"]["ProductID"];