@leaflow/sdk 0.101.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.
@@ -388,15 +388,19 @@ export interface paths {
388
388
  get?: never;
389
389
  put?: never;
390
390
  /**
391
- * Pay invoice
392
- * @description Applies the account balance first, then charges the remainder to a payment method. Give
393
- * `payment_method_id` to choose one, or omit it to use the default.
391
+ * Pay an invoice
392
+ * @description Applies eligible credit grants and available balance as requested, then collects the remainder
393
+ * through the selected payment gateway and method. With no gateway selection, insufficient
394
+ * account funds fail without starting an online payment. Card and non-card methods use this same
395
+ * operation. Promotion codes are confirmed by checkout, before collecting payment.
394
396
  *
395
- * Returns a checkout address when the gateway requires the cardholder to confirm the
396
- * payment; the invoice is marked paid once the gateway confirms it.
397
+ * Returns a payment action when customer interaction is required. requires_action and processing
398
+ * do not mean paid; the invoice is marked paid after payment is confirmed. An unresolved payment
399
+ * attempt is reused, and retries do not apply credit grants or balance twice.
397
400
  *
398
- * Calling this on an invoice that is already paid returns the invoice unchanged. A void invoice
399
- * is refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an order that has failed or was
401
+ * Calling this on an invoice that is already paid returns the existing payment result without
402
+ * another charge. A draft order invoice must first be confirmed through checkout. It and a void
403
+ * invoice are refused with `BILLING_INVOICE_NOT_PAYABLE`; the invoice of an order that has failed or was
400
404
  * canceled, with `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`; and that of an order whose
401
405
  * payment deadline has passed, with `BILLING_ORDER_EXPIRED`.
402
406
  */
@@ -453,7 +457,7 @@ export interface paths {
453
457
  * Either every invoice is paid or none is. When the credit grants and balance cannot cover
454
458
  * them all, the request fails with `BILLING_INSUFFICIENT_FUNDS` and nothing is charged.
455
459
  * Invoices that are already paid are not charged again. An invoice with an online payment
456
- * still in progress is refused with `BILLING_PAYMENT_PENDING`, a void invoice with
460
+ * still in progress is refused with `BILLING_PAYMENT_PENDING`, a draft order invoice or void invoice with
457
461
  * `BILLING_INVOICE_NOT_PAYABLE`, an order that has failed or was canceled with
458
462
  * `BILLING_ORDER_FAILED` or `BILLING_ORDER_CANCELED`, and an order whose payment deadline has
459
463
  * passed with `BILLING_ORDER_EXPIRED`.
@@ -693,23 +697,33 @@ export interface paths {
693
697
  get?: never;
694
698
  put?: never;
695
699
  /**
696
- * Quote renewals or a cancellation
697
- * @description Priced in the currency of the billing account that pays for the subscriptions, and at any rate
698
- * negotiated for that account. Nothing is reserved and nothing is recorded, so this may be called
699
- * as often as required. Prices may change between quoting and renewing, so a quote should be
700
- * refreshed before a final confirmation is shown.
700
+ * Quote order checkout, renewals or a cancellation
701
+ * @description Computes a price preview without creating a resource or saving a quote. Nothing is charged,
702
+ * reserved or applied to an order, and no discount redemption is consumed. The response has no
703
+ * quote ID and does not guarantee a price or reserve a promotion code.
704
+ *
705
+ * With order_id, uses that order's recorded purchase terms and billing account. An optional
706
+ * promotion_code previews one code; without it, Billing selects an applicable account discount.
707
+ * An invalid or inapplicable explicit code is refused rather than silently replaced. Give total
708
+ * as expected_amount when confirming checkout; eligibility and availability are checked again.
709
+ * An order already checked out returns its confirmed amounts, without reapplying its discount;
710
+ * a different code is refused with BILLING_ORDER_CHECKOUT_CONFLICT.
701
711
  *
702
712
  * A renewal is priced exactly as renewing would charge it: at the agreed amount or the price
703
- * named, with the discounts the account holds, and with tax.
713
+ * named, with the discounts the account holds, and with tax. A renewal list does not accept a
714
+ * promotion code because its entries create separate orders. To use a new code on a renewal,
715
+ * first create a renewal order and quote its checkout by order_id. Prices and discount eligibility
716
+ * may change between preview and confirmation.
704
717
  *
705
718
  * A cancellation is quoted as creating it would compute the refund, as of now and under the refund
706
- * terms agreed when each subscription was bought. It is quoted on its own: combined with renewals
719
+ * terms agreed when each subscription was bought. It is quoted on its own: combined with another target
707
720
  * the request is refused with HTTP 400 `BILLING_PURCHASE_INVALID` and `meta.field`
708
721
  * `cancellation`. It is refused with the same errors as creating the cancellation, except that the
709
722
  * amount is not checked. Give the returned `cancellation.proration_date` and
710
723
  * `cancellation.refundable_amount` when creating it.
711
724
  *
712
- * Every subscription must be paid for by the same one of your billing accounts; otherwise the
725
+ * Orders must belong to one of your billing accounts. Every subscription in a renewal or cancellation
726
+ * quote must be paid for by the same one of your billing accounts; otherwise the
713
727
  * request is refused with HTTP 400 `BILLING_PURCHASE_INVALID`. Returns 404 when a subscription does
714
728
  * not exist, and 403 `BILLING_ACCOUNT_FORBIDDEN` when it is paid for by an account you do not own.
715
729
  */
@@ -764,7 +778,7 @@ export interface paths {
764
778
  * - 409 `BILLING_CANCELLATION_SCHEDULES_DIFFER` when, for `period_end`, the paid terms end at
765
779
  * different times;
766
780
  * - 409 `BILLING_SUBSCRIPTION_OPERATION_PENDING` when a subscription is already being canceled
767
- * (`meta.cancellation_id`) or reclaimed (`meta.job_id`);
781
+ * (`meta.cancellation_id`) or reclaimed (`meta.action_id`);
768
782
  * - 409 `BILLING_ORDER_PAYMENT_IN_FLIGHT` while an online payment for a renewal of one of them
769
783
  * is in progress;
770
784
  * - 409 `BILLING_CANCELLATION_REFUND_CHANGED` when the refund is no longer
@@ -894,11 +908,13 @@ export interface paths {
894
908
  put?: never;
895
909
  /**
896
910
  * Create renewal order
897
- * @description Places a renewal order and issues its invoice without charging anything; pay the invoice to
898
- * renew. The periods and price are chosen as for renewing. The order can be paid until the
899
- * current paid period ends, and never after the end of the first period it renews; unpaid by
911
+ * @description Places a renewal order with a draft invoice, without applying a new discount or charging anything.
912
+ * Quote and confirm its checkout before collecting payment to renew. Existing subscription
913
+ * discount commitments are retained. The periods and price are chosen as for renewing. The order
914
+ * can be paid until the current paid period ends, and never after the end of the first period it renews; unpaid by
900
915
  * then, it is canceled. While auto-renew is on, the renewal due at the end of the period pays
901
- * this order instead of placing another.
916
+ * this order instead of placing another, confirming checkout with an applicable account discount
917
+ * first if it has not already been confirmed.
902
918
  *
903
919
  * Save `order_id` before submitting and read the order after an unknown outcome; creating it a
904
920
  * second time conflicts.
@@ -937,27 +953,6 @@ export interface paths {
937
953
  patch?: never;
938
954
  trace?: never;
939
955
  };
940
- "/account/v1/promotion-codes/preview": {
941
- parameters: {
942
- query?: never;
943
- header?: never;
944
- path?: never;
945
- cookie?: never;
946
- };
947
- get?: never;
948
- put?: never;
949
- /**
950
- * Preview promotion code
951
- * @description Nothing is recorded and the code is not consumed. Use it to show the customer the effect
952
- * before they commit.
953
- */
954
- post: operations["preview-promotion-code"];
955
- delete?: never;
956
- options?: never;
957
- head?: never;
958
- patch?: never;
959
- trace?: never;
960
- };
961
956
  "/account/v1/allowances": {
962
957
  parameters: {
963
958
  query?: never;
@@ -993,7 +988,7 @@ export interface paths {
993
988
  };
994
989
  /**
995
990
  * List orders
996
- * @description Lists acceptance status and associated invoice amounts. Pending may be unpaid or paid; active means accepted, not delivered. Only pending orders expire at expires_at.
991
+ * @description Lists acceptance status and associated invoice amounts. pending_checkout awaits confirmation; pending has confirmed checkout and may be unpaid or paid. active means accepted, not delivered. pending_checkout and pending orders can expire at expires_at.
997
992
  */
998
993
  get: operations["list-orders"];
999
994
  put?: never;
@@ -1023,6 +1018,55 @@ export interface paths {
1023
1018
  patch?: never;
1024
1019
  trace?: never;
1025
1020
  };
1021
+ "/account/v1/orders/{orderId}/checkout": {
1022
+ parameters: {
1023
+ query?: never;
1024
+ header?: never;
1025
+ path: {
1026
+ orderId: components["parameters"]["OrderId"];
1027
+ };
1028
+ cookie?: never;
1029
+ };
1030
+ get?: never;
1031
+ put?: never;
1032
+ /**
1033
+ * Confirm order checkout
1034
+ * @description Confirms the purchase's final amount and discount. Supply the same promotion_code used for the
1035
+ * preview, or omit it to select an applicable account discount. At most one new coupon is applied
1036
+ * to an order; existing subscription discount commitments are not stacked with a new coupon on
1037
+ * the same line. Promotion codes are evaluated against the order, not client-supplied line amounts.
1038
+ *
1039
+ * Rechecks eligibility and redemption availability. A different total fails with
1040
+ * BILLING_AMOUNT_CHANGED. An invalid or inapplicable code fails rather than collecting full price.
1041
+ * A failed confirmation leaves the invoice draft and reserves no discount redemption.
1042
+ *
1043
+ * A successful confirmation records the discount, including any recurring discount terms,
1044
+ * reserves its redemption, moves pending_checkout to pending and finalizes the invoice when one
1045
+ * is required. The reservation counts toward the code's limits and is consumed when the invoice
1046
+ * is paid, or at confirmation when nothing is due. Use pay-invoice to collect
1047
+ * its outstanding amount from account funds or a payment gateway. No payment attempt or checkout
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.
1051
+ *
1052
+ * Retrying with the same code and expected amount returns the existing order without another
1053
+ * redemption. Omitting the code on a confirmed checkout retains its recorded discount. Changing
1054
+ * that code is refused with BILLING_ORDER_CHECKOUT_CONFLICT. Payment retries reuse the confirmed
1055
+ * terms. Cancellation, expiry or complete fulfillment failure releases the reservation or returns
1056
+ * the consumed redemption; a refund alone does not.
1057
+ *
1058
+ * The order must belong to one of your billing accounts. A canceled, failed or expired order
1059
+ * cannot be checked out. A period-end change cannot be checked out before its renewal invoice is
1060
+ * available. Orders retain their billing account and currency after a project is linked elsewhere;
1061
+ * discounts from another account cannot be used for them.
1062
+ */
1063
+ post: operations["checkout-order"];
1064
+ delete?: never;
1065
+ options?: never;
1066
+ head?: never;
1067
+ patch?: never;
1068
+ trace?: never;
1069
+ };
1026
1070
  "/account/v1/orders/{orderId}/cancel": {
1027
1071
  parameters: {
1028
1072
  query?: never;
@@ -1113,19 +1157,59 @@ export interface components {
1113
1157
  */
1114
1158
  TerminationPolicy: "immediate" | "period_end";
1115
1159
  /**
1116
- * @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.
1117
1170
  * @enum {string}
1118
1171
  */
1119
1172
  RefundPolicy: "none" | "prorated";
1120
- /** @description Specify renewals for existing subscriptions, or one cancellation on its own. */
1173
+ /**
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.
1179
+ */
1121
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
+ */
1122
1191
  renewals?: components["schemas"]["QuoteRenewal"][];
1123
1192
  cancellation?: components["schemas"]["QuoteCancellation"];
1193
+ promotion_code?: string;
1194
+ };
1195
+ CheckoutOrderRequest: {
1196
+ /**
1197
+ * @description The code to apply, evaluated again at confirmation. Omit to select an applicable account
1198
+ * discount. On an already confirmed checkout, omission retains the recorded discount.
1199
+ */
1200
+ promotion_code?: string;
1201
+ /**
1202
+ * @description Quote.total in the order's currency, after discounts and tax but before applying credit
1203
+ * grants or balance. A different total fails with BILLING_AMOUNT_CHANGED.
1204
+ */
1205
+ expected_amount: components["schemas"]["Money"];
1124
1206
  };
1125
1207
  /**
1126
1208
  * @description Price renewing a prepaid subscription. Give `price_id`, or `interval` with
1127
1209
  * `interval_count`, to renew for another term at the price currently sold for it. Naming
1128
- * 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.
1129
1213
  */
1130
1214
  QuoteRenewal: {
1131
1215
  /** Format: uuid */
@@ -1135,6 +1219,8 @@ export interface components {
1135
1219
  /** @enum {string} */
1136
1220
  interval?: "day" | "month" | "year";
1137
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"];
1138
1224
  /**
1139
1225
  * @description How many consecutive periods to renew for.
1140
1226
  * @default 1
@@ -1178,18 +1264,110 @@ export interface components {
1178
1264
  */
1179
1265
  total: components["schemas"]["Money"];
1180
1266
  };
1267
+ /**
1268
+ * @description A purchase quote line or one recorded order item. Monetary fields use the account currency.
1269
+ * Fixed purchase amounts are rounded as checkout rounds them. Usage estimates are not amounts
1270
+ * collectible at checkout. When priced is false, monetary fields and price_id are absent.
1271
+ */
1272
+ QuotedLine: {
1273
+ /** @description Tax on the discounted amount, including any tax already contained in that amount. */
1274
+ tax_amount?: components["schemas"]["Money"];
1275
+ /** @description The part of tax_amount already contained in amount minus discount_amount. */
1276
+ tax_included_amount?: components["schemas"]["Money"];
1277
+ /** @description Zero-based request line index, or the recorded order item's position for an order quote. */
1278
+ index: number;
1279
+ /**
1280
+ * Format: uuid
1281
+ * @description Present for an existing order quote; identifies the recorded item being priced.
1282
+ */
1283
+ order_item_id?: string;
1284
+ /**
1285
+ * @description Whether a price was found for this line. Read this before anything else.
1286
+ *
1287
+ * A single item with no price no longer fails the whole request. A catalogue
1288
+ * almost always has something not yet priced, and refusing the request would
1289
+ * leave no way to render a list in which a few entries are simply not on sale.
1290
+ *
1291
+ * When false, `price_id`, `unit_amount` and `amount` are absent and
1292
+ * `unpriced_reason` states what is missing.
1293
+ */
1294
+ priced: boolean;
1295
+ /**
1296
+ * @description Why no price was found; `none` while `priced` is true.
1297
+ * @enum {string}
1298
+ */
1299
+ unpriced_reason?: "none" | "no_price";
1300
+ /**
1301
+ * Format: uuid
1302
+ * @description The price selected. Returned whenever `priced` is true, including when the
1303
+ * request identified the item indirectly, so that the choice can be confirmed.
1304
+ */
1305
+ price_id?: string;
1306
+ plan_name?: string;
1307
+ /** @description Unit price before discounts, with tax included only where the price includes it. */
1308
+ unit_amount?: components["schemas"]["Money"];
1309
+ /** @description The quantity priced. */
1310
+ quantity?: string;
1311
+ /**
1312
+ * @description Before discounts, including any setup charges. Contains tax only where the price includes it.
1313
+ * Zero for a priced order item with no immediate charge.
1314
+ */
1315
+ amount?: components["schemas"]["Money"];
1316
+ /** @description Total reduction on this line, including any committed recurring discount. */
1317
+ discount_amount?: components["schemas"]["Money"];
1318
+ /** @description amount minus discount_amount plus tax_amount minus tax_included_amount. */
1319
+ total?: components["schemas"]["Money"];
1320
+ currency: string;
1321
+ };
1322
+ /**
1323
+ * @description A computed price preview, without a saved quote or a price guarantee. No funds or discount
1324
+ * redemptions are reserved. Amounts use currency and exclude payment from credit grants or balance.
1325
+ */
1181
1326
  Quote: {
1327
+ /**
1328
+ * @description Sum before discounts, less tax already included in the discounted line amounts, as on an
1329
+ * invoice. Null when any line cannot be priced. Zero for a cancellation-only quote.
1330
+ */
1331
+ subtotal: components["schemas"]["Money"] | null;
1332
+ /** @description Total line discounts. Null when any line cannot be priced; zero for a cancellation-only quote. */
1333
+ discount_amount: components["schemas"]["Money"] | null;
1334
+ /** @description Total tax on the discounted amounts. Null when any line cannot be priced; zero for a cancellation-only quote. */
1335
+ tax_amount: components["schemas"]["Money"] | null;
1336
+ /**
1337
+ * @description The one new discount evaluated for a purchase or order, without applying it. Null when
1338
+ * none is selected, pricing is incomplete, or the quote targets a renewal list or cancellation.
1339
+ * A confirmed order instead reports its recorded discount.
1340
+ */
1341
+ discount: components["schemas"]["QuotedDiscount"] | null;
1342
+ lines?: components["schemas"]["QuotedLine"][];
1182
1343
  renewals?: components["schemas"]["QuoteRenewalResult"][];
1183
1344
  /** @description What the cancellation requested would return. Present only when one was requested. */
1184
1345
  cancellation?: components["schemas"]["CancellationRefundPreview"];
1185
1346
  /**
1186
- * @description What the renewals would charge in total. Amounts to be returned are not netted off it: a
1187
- * quote of a cancellation alone has a total of zero, and what it would return is in
1188
- * `cancellation`.
1347
+ * @description subtotal minus discount_amount plus tax_amount, before applying credit grants or balance.
1348
+ * For a purchase or order with no usage estimates, pass this as expected_amount at checkout.
1349
+ * A renewal list sums separate orders; use each renewal's total when confirming that order.
1350
+ * Refunds are not netted off: a cancellation-only quote has zero totals and its refund is in
1351
+ * cancellation. Usage estimates are projections, not checkout amounts.
1352
+ *
1353
+ * Null when any line could not be priced. What would be owed is not knowable then, and a
1354
+ * total that silently left the unpriced lines out would read as a smaller bill rather than
1355
+ * an incomplete one — the per-line `priced` flag is easy to skip, a missing total is not.
1189
1356
  */
1190
- total: components["schemas"]["Money"];
1357
+ total: components["schemas"]["Money"] | null;
1191
1358
  currency: string;
1192
1359
  };
1360
+ /**
1361
+ * @description The discount selected for this calculation. Its presence in a quote does not apply it or
1362
+ * reserve a redemption. Discount amounts are reported on the quote and its lines.
1363
+ */
1364
+ QuotedDiscount: {
1365
+ /** @enum {string} */
1366
+ type: "promotion_code" | "account_discount";
1367
+ name: string;
1368
+ /** @description Code text for a promotion_code discount; null for an account_discount. */
1369
+ promotion_code: string | null;
1370
+ };
1193
1371
  /**
1194
1372
  * @description A cancellation to quote: what ending these subscriptions together would return. One mode per
1195
1373
  * request; to compare, quote `immediate` and `period_end` separately.
@@ -1203,8 +1381,8 @@ export interface components {
1203
1381
  * @description What the cancellation would return, subscription by subscription and in total, as of now. Give
1204
1382
  * `proration_date` and `refundable_amount` when creating the cancellation.
1205
1383
  *
1206
- * - `unused_amount`: before tax, the value of the paid service still unused, whatever the refund
1207
- * 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.
1208
1386
  * - `refundable_amount`: what is returned the way it was paid, including the tax paid on it;
1209
1387
  * `refund_amount` plus `credit_amount`.
1210
1388
  * - `refund_amount`: the part returned to the balance or to the payment method.
@@ -1415,57 +1593,6 @@ export interface components {
1415
1593
  };
1416
1594
  /** @description Immutable platform service identifier, such as compute, canopy or assistant. */
1417
1595
  ProductID: string;
1418
- /**
1419
- * @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.
1420
- *
1421
- * A line that gives a meter, `dimensions` or `duration_seconds` estimates usage and is
1422
- * priced only at a postpaid price. Such a line is refused with HTTP 400
1423
- * `BILLING_PURCHASE_INVALID` when `price_type` is `prepaid` or `one_time`, or when the price
1424
- * it names is not postpaid; `meta.field` is `price_type`, `price_id` or `price_lookup_key`
1425
- * accordingly. When the plan has no postpaid price, the line is returned unpriced with
1426
- * `no_price`.
1427
- */
1428
- QuoteLine: {
1429
- price_lookup_key?: string;
1430
- plan_lookup_key?: string;
1431
- meter_lookup_key?: string;
1432
- /** Format: uuid */
1433
- price_id?: string;
1434
- product_id?: components["schemas"]["ProductID"];
1435
- /** Format: uuid */
1436
- plan_id?: string;
1437
- /** Format: uuid */
1438
- meter_id?: string;
1439
- /**
1440
- * @description The attributes the price depends on — region, instance type, token class.
1441
- *
1442
- * Required when the price draws its rates from a price list, which is how anything
1443
- * sold by region or by machine type is priced. A price that carries a single unit
1444
- * amount, or a ladder, has no attributes to give and takes none.
1445
- *
1446
- * Every attribute the meter declares must be present. A combination with no rate
1447
- * covering it is refused rather than priced at zero.
1448
- */
1449
- dimensions?: {
1450
- [key: string]: string;
1451
- };
1452
- /**
1453
- * @description Narrows the selection when a plan offers more than one billing type.
1454
- * @enum {string}
1455
- */
1456
- price_type?: "postpaid" | "prepaid" | "one_time";
1457
- /** @enum {string} */
1458
- interval?: "none" | "day" | "month" | "year";
1459
- interval_count?: number;
1460
- quantity: string;
1461
- /**
1462
- * Format: int64
1463
- * @description For metered items, how long to price for. This allows an estimate such as "about
1464
- * this much per month" to be shown before anything exists. The priced quantity is
1465
- * `quantity` multiplied by this duration.
1466
- */
1467
- duration_seconds?: number;
1468
- };
1469
1596
  BillingAccount: {
1470
1597
  /** Format: int64 */
1471
1598
  id: number;
@@ -1817,7 +1944,7 @@ export interface components {
1817
1944
  * An unresolved channel payment is reused; retries do not apply the grant or balance portions twice.
1818
1945
  * Without a gateway selection, insufficient account funds fail without starting an online payment.
1819
1946
  */
1820
- PayRequest: {
1947
+ PayInvoiceRequest: {
1821
1948
  /** @description Required to collect an online remainder. An existing attempt keeps its original gateway. */
1822
1949
  payment_gateway?: string;
1823
1950
  /** @description Required with payment_gateway; for example card, wechat_pay or alipay. */
@@ -1954,7 +2081,11 @@ export interface components {
1954
2081
  failure_reason?: string;
1955
2082
  };
1956
2083
  /**
1957
- * @description A usage invoice stays `draft` through its month: each charge is added to it as it is priced
2084
+ * @description An order invoice stays `draft` until checkout confirms its discount and final amounts. It
2085
+ * cannot be collected while draft. Confirmation makes it `open`, or `paid` when its total is zero
2086
+ * without creating a payment transaction. A quote never changes this status.
2087
+ *
2088
+ * A usage invoice stays `draft` through its month: each charge is added to it as it is priced
1958
2089
  * and paid from credits and balance as it goes. It is issued at the end of the month, becoming
1959
2090
  * `paid` when everything was covered and `open` when something is still owed.
1960
2091
  *
@@ -2004,6 +2135,8 @@ export interface components {
2004
2135
  /** @description Subtotal less discount plus tax. Balance and credit grants are payment sources, not reductions of the receivable. */
2005
2136
  total: components["schemas"]["Money"];
2006
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"];
2007
2140
  /** Format: date-time */
2008
2141
  period_start?: string | null;
2009
2142
  /**
@@ -2249,7 +2382,10 @@ export interface components {
2249
2382
  * - `subscription_canceled`: the subscription was canceled and its unused value returned under
2250
2383
  * its refund terms.
2251
2384
  * - `future_period_canceled`: a renewal that had not started yet was withdrawn.
2252
- * - `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.
2253
2389
  * - `usage_true_up`: usage priced again over the whole month cost less than was charged.
2254
2390
  * - `payment_not_applied`: a payment arrived after its invoice could no longer be paid.
2255
2391
  * - `operator`: made by the platform operator.
@@ -2316,7 +2452,30 @@ export interface components {
2316
2452
  items: components["schemas"]["Subscription"][];
2317
2453
  pagination: components["schemas"]["OffsetPagination"];
2318
2454
  };
2319
- /** @description An independently billed purchase. Fixed renewals use the agreed recurring_amount and interval; already paid periods retain their original value. Technical state belongs to the owning service. */
2455
+ /**
2456
+ * @description An independently billed purchase relationship, separate from the owning service's resource.
2457
+ * Placing a new prepaid or postpaid service order creates a pending subscription for each line
2458
+ * in the same purchase transaction. Its ID is returned on the order item and remains stable
2459
+ * through checkout and delivery. One order may create several subscriptions, such as an instance,
2460
+ * its system disk and its address; it has no single subscription ID.
2461
+ *
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
2465
+ * then; postpaid usage starts only when the service reports actual delivery and metering.
2466
+ *
2467
+ * One-time delivery may omit a subscription. Renewals reference and extend existing subscriptions
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.
2471
+ * Fixed renewals use the agreed recurring_amount and interval; already paid periods retain their
2472
+ * original value. Technical state belongs to the owning service.
2473
+ *
2474
+ * A purchased shared capacity limit, such as a regional snapshot count quota, can have its own
2475
+ * subscription. Activating that capacity confirms delivery of the quota, not individual snapshots.
2476
+ * Creating or deleting snapshots within it does not create, activate or terminate more subscriptions;
2477
+ * the owning service enforces current holdings against the purchased count.
2478
+ */
2320
2479
  Subscription: {
2321
2480
  currency: string;
2322
2481
  /** @enum {string} */
@@ -2324,13 +2483,20 @@ export interface components {
2324
2483
  /** @enum {string} */
2325
2484
  interval: "none" | "day" | "month" | "year";
2326
2485
  interval_count?: number;
2327
- /** @description Whole-subscription prepaid renewal amount, after continuing discounts and before tax. Absent for other billing types. */
2486
+ /**
2487
+ * @description Whole-subscription prepaid renewal amount, after continuing discounts and before tax.
2488
+ * Pending subscriptions show base terms until checkout confirms any new continuing discount.
2489
+ * Absent for other billing types.
2490
+ */
2328
2491
  recurring_amount?: string;
2329
2492
  termination_policy?: components["schemas"]["TerminationPolicy"];
2330
2493
  refund_policy?: components["schemas"]["RefundPolicy"];
2331
2494
  /** Format: uuid */
2332
2495
  order_item_id?: string;
2333
- /** 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
+ */
2334
2500
  replaces_subscription_id?: string;
2335
2501
  /** Format: uuid */
2336
2502
  coupon_id?: string;
@@ -2378,13 +2544,22 @@ export interface components {
2378
2544
  quantity: string;
2379
2545
  /**
2380
2546
  * Format: date-time
2381
- * @description Present for prepaid items. Absent for metered ones, which have no 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.
2382
2549
  */
2383
2550
  paid_until?: string | null;
2384
2551
  auto_renew: boolean;
2385
- /** @enum {string} */
2386
- status: "pending" | "active" | "suspended" | "canceled" | "terminated";
2387
- /** Format: date-time */
2552
+ /**
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.
2556
+ * @enum {string}
2557
+ */
2558
+ status: "pending" | "provisioning" | "active" | "suspended" | "canceled" | "terminated";
2559
+ /**
2560
+ * Format: date-time
2561
+ * @description Confirmed start of service. Null until a new subscription becomes active, including after payment.
2562
+ */
2388
2563
  started_at?: string | null;
2389
2564
  /** Format: date-time */
2390
2565
  ended_at?: string | null;
@@ -2432,7 +2607,9 @@ export interface components {
2432
2607
  *
2433
2608
  * Leaving both out renews at the price this item already bills at, which a later price
2434
2609
  * change does not affect. Naming a term that differs from the current one is a fresh
2435
- * 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.
2436
2613
  *
2437
2614
  * List the terms on offer with the renewal prices operation.
2438
2615
  */
@@ -2442,6 +2619,8 @@ export interface components {
2442
2619
  * @enum {string}
2443
2620
  */
2444
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"];
2445
2624
  /** Format: uuid */
2446
2625
  payment_method_id?: string;
2447
2626
  /**
@@ -2480,7 +2659,12 @@ export interface components {
2480
2659
  auto_renew: boolean;
2481
2660
  };
2482
2661
  /**
2483
- * @description Follows the items. `pending` is not yet accepted and may be paid or unpaid. `active` is
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
2665
+ * and pending can expire or be canceled; neither establishes service delivery.
2666
+ *
2667
+ * Follows the items. `pending` has confirmed checkout, is not yet accepted and may be paid or unpaid. `active` is
2484
2668
  * accepted with items still being set up. `completed` means every item was set up.
2485
2669
  * `partially_completed` means some items were set up and the others failed and were
2486
2670
  * refunded to their original payment sources. `failed` means every item failed and the
@@ -2488,7 +2672,7 @@ export interface components {
2488
2672
  * nothing was charged.
2489
2673
  * @enum {string}
2490
2674
  */
2491
- OrderStatus: "pending" | "active" | "completed" | "partially_completed" | "failed" | "canceled";
2675
+ OrderStatus: "pending_checkout" | "pending" | "active" | "completed" | "partially_completed" | "failed" | "canceled";
2492
2676
  /**
2493
2677
  * @description `pending` is waiting to be set up. `completed` was confirmed by the service.
2494
2678
  * `failed` was not set up and its amount was refunded to the original payment sources.
@@ -2497,13 +2681,19 @@ export interface components {
2497
2681
  * @enum {string}
2498
2682
  */
2499
2683
  OrderItemStatus: "pending" | "completed" | "failed" | "canceled";
2684
+ /**
2685
+ * @description A recorded purchase. pending_checkout requires explicit Billing confirmation before collection
2686
+ * or acceptance, even without an invoice. Coupon fields describe a discount confirmed at checkout and are absent
2687
+ * before confirmation; a quote never populates them. A draft invoice contains base purchase
2688
+ * amounts awaiting checkout. Payment and acceptance remain separate from resource delivery.
2689
+ */
2500
2690
  Order: {
2501
2691
  /** Format: uuid */
2502
2692
  coupon_id?: string;
2503
2693
  coupon?: components["schemas"]["ObjectIdentity"];
2504
2694
  /** Format: uuid */
2505
2695
  promotion_code_id?: string;
2506
- /** @description Code text frozen when this order applied the coupon. */
2696
+ /** @description Code text frozen when checkout applied the coupon. Absent for an account discount. */
2507
2697
  promotion_code?: string;
2508
2698
  invoice?: components["schemas"]["InvoiceSummary"];
2509
2699
  /** @description How the order was paid. Absent until it is paid. */
@@ -2554,7 +2744,7 @@ export interface components {
2554
2744
  change_effective?: "none" | "immediate" | "period_end";
2555
2745
  /**
2556
2746
  * Format: date-time
2557
- * @description Acceptance deadline. Only pending orders expire automatically.
2747
+ * @description Acceptance deadline. pending_checkout and pending orders can expire automatically.
2558
2748
  */
2559
2749
  expires_at?: string | null;
2560
2750
  /** Format: date-time */
@@ -2589,75 +2779,6 @@ export interface components {
2589
2779
  brand?: string;
2590
2780
  last4?: string;
2591
2781
  };
2592
- /** @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. */
2593
- PromotionCodePreviewRequest: {
2594
- /** Format: int64 */
2595
- billing_account_id: number;
2596
- promotion_code: string;
2597
- /** @description New purchases to test against, in the same shape as a quote. */
2598
- lines?: components["schemas"]["QuoteLine"][];
2599
- };
2600
- /** @description Describes a usable promotion code and its applicability to the requested purchase. Invalid codes return an error response. */
2601
- PromotionCodePreview: {
2602
- min_amount?: string;
2603
- /** @enum {string} */
2604
- type?: "percentage" | "fixed_amount" | "price_override" | "free_setup";
2605
- recurring?: boolean;
2606
- recurring_cycles?: number;
2607
- name?: string;
2608
- /** @description For a fixed-amount discount. */
2609
- amount?: components["schemas"]["Money"];
2610
- /** @description For a percentage discount. */
2611
- percent_off?: string;
2612
- max_discount?: components["schemas"]["Money"];
2613
- currency?: string;
2614
- /**
2615
- * @description What it may be used for. Present whether or not a purchase was given, so that the
2616
- * terms can be shown before anything is chosen.
2617
- */
2618
- applies_to?: components["schemas"]["Applicability"];
2619
- /**
2620
- * @description The terms in one sentence, ready to display — for example "Compute, new purchases
2621
- * only, from 100.00" or "No restriction on product or purchase type".
2622
- */
2623
- summary?: string;
2624
- /** Format: date-time */
2625
- valid_until?: string | null;
2626
- /**
2627
- * @description Whether it applies to the purchase given in `lines`. Absent when no purchase was
2628
- * given.
2629
- */
2630
- applicable?: boolean;
2631
- applicable_reason?: components["schemas"]["PromotionCodeRejection"];
2632
- /**
2633
- * @description The total of the lines that match the restrictions. This is what the threshold is
2634
- * measured against, not the order total.
2635
- */
2636
- qualifying_amount?: components["schemas"]["Money"];
2637
- /**
2638
- * @description How much more of a qualifying purchase is needed to reach the threshold. `"0"` once
2639
- * it is met.
2640
- */
2641
- shortfall?: components["schemas"]["Money"];
2642
- /**
2643
- * @description What it would take off this purchase. An estimate: the amount is settled at the
2644
- * moment the order is placed.
2645
- */
2646
- estimated_discount?: components["schemas"]["Money"];
2647
- };
2648
- /**
2649
- * @description Why a code cannot be used. `none` when it can.
2650
- *
2651
- * `operation_not_covered` means the code is limited to certain purchase actions — a
2652
- * first-purchase code presented for a renewal, for example.
2653
- *
2654
- * `term_not_covered` means the code is limited to certain term lengths. A purchase with
2655
- * no term, such as metered usage, is reported the same way.
2656
- *
2657
- * `below_minimum` is accompanied by `shortfall`.
2658
- * @enum {string}
2659
- */
2660
- 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";
2661
2782
  /**
2662
2783
  * @description Which purchase this applies to. `upgrade` and `downgrade` are told apart by money: a change
2663
2784
  * that costs more for the remainder of the period is an upgrade, one that returns money
@@ -2709,7 +2830,7 @@ export interface components {
2709
2830
  items: components["schemas"]["Discount"][];
2710
2831
  pagination: components["schemas"]["OffsetPagination"];
2711
2832
  };
2712
- /** @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. */
2713
2834
  PriceOption: {
2714
2835
  product: components["schemas"]["Product"];
2715
2836
  plan: components["schemas"]["ObjectIdentity"];
@@ -2747,19 +2868,39 @@ export interface components {
2747
2868
  /** @description The longest term a purchase may have, in months. */
2748
2869
  max_term_months?: number;
2749
2870
  };
2750
- /** @description Frozen purchase terms. Monetary fields come from related invoice-line snapshots and are absent when there is no immediate invoice. Later catalog changes do not reprice this line. */
2871
+ /**
2872
+ * @description Frozen purchase terms. Monetary fields come from related invoice-line snapshots and are absent
2873
+ * when there is no immediate invoice. Later catalog changes do not reprice this line. A new service
2874
+ * purchase creates its pending subscription when this item is recorded, not when payment succeeds.
2875
+ */
2751
2876
  OrderItem: {
2752
2877
  position?: number;
2753
2878
  configuration?: {
2754
2879
  [key: string]: unknown;
2755
2880
  };
2756
- /** Format: uuid */
2881
+ /**
2882
+ * Format: uuid
2883
+ * @description Stable Billing subscription ID. A new prepaid or postpaid service purchase returns the
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.
2886
+ */
2757
2887
  subscription_id?: string;
2758
2888
  /** @enum {string} */
2759
2889
  interval: "none" | "day" | "month" | "year";
2760
2890
  interval_count?: number;
2761
2891
  termination_policy?: components["schemas"]["TerminationPolicy"];
2762
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;
2763
2904
  completes_on_payment: boolean;
2764
2905
  recurring_amount?: string;
2765
2906
  setup_amount?: string;
@@ -2794,14 +2935,16 @@ export interface components {
2794
2935
  quantity: string;
2795
2936
  /**
2796
2937
  * @description The unit amount of the price this line is charged under. Absent for a tiered price, which has no
2797
- * single unit amount, and for a change that takes effect at once, which is charged the prorated
2798
- * difference.
2938
+ * single unit amount, and for a change that takes effect at once, which is charged as `gross_amount`
2939
+ * describes.
2799
2940
  */
2800
2941
  unit_amount?: components["schemas"]["Money"];
2801
2942
  /**
2802
2943
  * @description Before discounts: the price applied to the quantity, which for a per-unit price is `unit_amount`
2803
- * times `quantity`; a minimum charge can make it higher. For a change that takes effect at once it is
2804
- * 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`.
2805
2948
  *
2806
2949
  * Under an inclusive tax rate it includes tax, as the price does, and the included part is
2807
2950
  * `tax_included_amount`. A renewal at the agreed terms is the exception: the agreed amount excludes
@@ -2891,7 +3034,11 @@ export interface components {
2891
3034
  items: components["schemas"]["Entitlement"][];
2892
3035
  pagination: components["schemas"]["OffsetPagination"];
2893
3036
  };
2894
- /** @description Purchase-related invoice amounts, without account contact details or payment methods. Absent on an order with no immediate invoice. */
3037
+ /**
3038
+ * @description Purchase-related invoice amounts, without account contact details or payment methods. A draft
3039
+ * order invoice shows base amounts awaiting checkout, not a confirmed discount or collectible total.
3040
+ * Absent when no invoice has been created; absence does not establish acceptance or delivery.
3041
+ */
2895
3042
  InvoiceSummary: {
2896
3043
  /** Format: uuid */
2897
3044
  id: string;
@@ -2909,6 +3056,8 @@ export interface components {
2909
3056
  tax_amount: string;
2910
3057
  total: string;
2911
3058
  amount_paid: string;
3059
+ /** @description What is still collectible after applied credits and successful payments; never below zero. */
3060
+ amount_due: string;
2912
3061
  amount_refunded: string;
2913
3062
  /** Format: date-time */
2914
3063
  due_at?: string;
@@ -3522,7 +3671,7 @@ export interface operations {
3522
3671
  };
3523
3672
  requestBody?: {
3524
3673
  content: {
3525
- "application/json": components["schemas"]["PayRequest"];
3674
+ "application/json": components["schemas"]["PayInvoiceRequest"];
3526
3675
  };
3527
3676
  };
3528
3677
  responses: {
@@ -4176,31 +4325,6 @@ export interface operations {
4176
4325
  default: components["responses"]["Error"];
4177
4326
  };
4178
4327
  };
4179
- "preview-promotion-code": {
4180
- parameters: {
4181
- query?: never;
4182
- header?: never;
4183
- path?: never;
4184
- cookie?: never;
4185
- };
4186
- requestBody: {
4187
- content: {
4188
- "application/json": components["schemas"]["PromotionCodePreviewRequest"];
4189
- };
4190
- };
4191
- responses: {
4192
- /** @description OK */
4193
- 200: {
4194
- headers: {
4195
- [name: string]: unknown;
4196
- };
4197
- content: {
4198
- "application/json": components["schemas"]["PromotionCodePreview"];
4199
- };
4200
- };
4201
- default: components["responses"]["Error"];
4202
- };
4203
- };
4204
4328
  "list-allowances": {
4205
4329
  parameters: {
4206
4330
  query?: {
@@ -4289,6 +4413,48 @@ export interface operations {
4289
4413
  default: components["responses"]["Error"];
4290
4414
  };
4291
4415
  };
4416
+ "checkout-order": {
4417
+ parameters: {
4418
+ query?: never;
4419
+ header?: never;
4420
+ path: {
4421
+ orderId: components["parameters"]["OrderId"];
4422
+ };
4423
+ cookie?: never;
4424
+ };
4425
+ requestBody: {
4426
+ content: {
4427
+ /**
4428
+ * @example {
4429
+ * "promotion_code": "WELCOME",
4430
+ * "expected_amount": "90.00"
4431
+ * }
4432
+ */
4433
+ "application/json": components["schemas"]["CheckoutOrderRequest"];
4434
+ };
4435
+ };
4436
+ responses: {
4437
+ /** @description The order with confirmed checkout terms and its invoice, when applicable. */
4438
+ 200: {
4439
+ headers: {
4440
+ [name: string]: unknown;
4441
+ };
4442
+ content: {
4443
+ "application/json": components["schemas"]["Order"];
4444
+ };
4445
+ };
4446
+ /** @description The order no longer permits checkout or another discount has already been confirmed. */
4447
+ 409: {
4448
+ headers: {
4449
+ [name: string]: unknown;
4450
+ };
4451
+ content: {
4452
+ "application/json": components["schemas"]["Error"];
4453
+ };
4454
+ };
4455
+ default: components["responses"]["Error"];
4456
+ };
4457
+ };
4292
4458
  "cancel-order": {
4293
4459
  parameters: {
4294
4460
  query?: never;