@metronome/sdk 2.0.0 → 2.2.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.
Files changed (175) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/client.d.mts +1 -1
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +1 -1
  5. package/client.d.ts.map +1 -1
  6. package/package.json +1 -1
  7. package/resources/shared.d.mts +73 -20
  8. package/resources/shared.d.mts.map +1 -1
  9. package/resources/shared.d.ts +73 -20
  10. package/resources/shared.d.ts.map +1 -1
  11. package/resources/v1/alerts.d.mts +20 -1
  12. package/resources/v1/alerts.d.mts.map +1 -1
  13. package/resources/v1/alerts.d.ts +20 -1
  14. package/resources/v1/alerts.d.ts.map +1 -1
  15. package/resources/v1/contracts/contracts.d.mts +89 -12
  16. package/resources/v1/contracts/contracts.d.mts.map +1 -1
  17. package/resources/v1/contracts/contracts.d.ts +89 -12
  18. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  19. package/resources/v1/contracts/contracts.js +1 -1
  20. package/resources/v1/contracts/contracts.js.map +1 -1
  21. package/resources/v1/contracts/contracts.mjs +1 -1
  22. package/resources/v1/contracts/contracts.mjs.map +1 -1
  23. package/resources/v1/credit-grants.d.mts +10 -5
  24. package/resources/v1/credit-grants.d.mts.map +1 -1
  25. package/resources/v1/credit-grants.d.ts +10 -5
  26. package/resources/v1/credit-grants.d.ts.map +1 -1
  27. package/resources/v1/credit-grants.js +10 -5
  28. package/resources/v1/credit-grants.js.map +1 -1
  29. package/resources/v1/credit-grants.mjs +10 -5
  30. package/resources/v1/credit-grants.mjs.map +1 -1
  31. package/resources/v1/customers/alerts.d.mts +39 -1
  32. package/resources/v1/customers/alerts.d.mts.map +1 -1
  33. package/resources/v1/customers/alerts.d.ts +39 -1
  34. package/resources/v1/customers/alerts.d.ts.map +1 -1
  35. package/resources/v1/customers/billing-config.d.mts +25 -7
  36. package/resources/v1/customers/billing-config.d.mts.map +1 -1
  37. package/resources/v1/customers/billing-config.d.ts +25 -7
  38. package/resources/v1/customers/billing-config.d.ts.map +1 -1
  39. package/resources/v1/customers/billing-config.js +6 -3
  40. package/resources/v1/customers/billing-config.js.map +1 -1
  41. package/resources/v1/customers/billing-config.mjs +6 -3
  42. package/resources/v1/customers/billing-config.mjs.map +1 -1
  43. package/resources/v1/customers/commits.d.mts +3 -2
  44. package/resources/v1/customers/commits.d.mts.map +1 -1
  45. package/resources/v1/customers/commits.d.ts +3 -2
  46. package/resources/v1/customers/commits.d.ts.map +1 -1
  47. package/resources/v1/customers/commits.js +2 -1
  48. package/resources/v1/customers/commits.js.map +1 -1
  49. package/resources/v1/customers/commits.mjs +2 -1
  50. package/resources/v1/customers/commits.mjs.map +1 -1
  51. package/resources/v1/customers/customers.d.mts +89 -14
  52. package/resources/v1/customers/customers.d.mts.map +1 -1
  53. package/resources/v1/customers/customers.d.ts +89 -14
  54. package/resources/v1/customers/customers.d.ts.map +1 -1
  55. package/resources/v1/customers/customers.js +13 -8
  56. package/resources/v1/customers/customers.js.map +1 -1
  57. package/resources/v1/customers/customers.mjs +13 -8
  58. package/resources/v1/customers/customers.mjs.map +1 -1
  59. package/resources/v1/customers/index.d.mts +1 -1
  60. package/resources/v1/customers/index.d.mts.map +1 -1
  61. package/resources/v1/customers/index.d.ts +1 -1
  62. package/resources/v1/customers/index.d.ts.map +1 -1
  63. package/resources/v1/customers/index.js.map +1 -1
  64. package/resources/v1/customers/index.mjs.map +1 -1
  65. package/resources/v1/customers/invoices.d.mts +62 -5
  66. package/resources/v1/customers/invoices.d.mts.map +1 -1
  67. package/resources/v1/customers/invoices.d.ts +62 -5
  68. package/resources/v1/customers/invoices.d.ts.map +1 -1
  69. package/resources/v1/customers/invoices.js +2 -1
  70. package/resources/v1/customers/invoices.js.map +1 -1
  71. package/resources/v1/customers/invoices.mjs +2 -1
  72. package/resources/v1/customers/invoices.mjs.map +1 -1
  73. package/resources/v1/customers/plans.d.mts +9 -4
  74. package/resources/v1/customers/plans.d.mts.map +1 -1
  75. package/resources/v1/customers/plans.d.ts +9 -4
  76. package/resources/v1/customers/plans.d.ts.map +1 -1
  77. package/resources/v1/customers/plans.js +8 -4
  78. package/resources/v1/customers/plans.js.map +1 -1
  79. package/resources/v1/customers/plans.mjs +8 -4
  80. package/resources/v1/customers/plans.mjs.map +1 -1
  81. package/resources/v1/index.d.mts +2 -1
  82. package/resources/v1/index.d.mts.map +1 -1
  83. package/resources/v1/index.d.ts +2 -1
  84. package/resources/v1/index.d.ts.map +1 -1
  85. package/resources/v1/index.js +3 -1
  86. package/resources/v1/index.js.map +1 -1
  87. package/resources/v1/index.mjs +1 -0
  88. package/resources/v1/index.mjs.map +1 -1
  89. package/resources/v1/payments.d.mts +1 -0
  90. package/resources/v1/payments.d.mts.map +1 -1
  91. package/resources/v1/payments.d.ts +1 -0
  92. package/resources/v1/payments.d.ts.map +1 -1
  93. package/resources/v1/plans.d.mts +8 -4
  94. package/resources/v1/plans.d.mts.map +1 -1
  95. package/resources/v1/plans.d.ts +8 -4
  96. package/resources/v1/plans.d.ts.map +1 -1
  97. package/resources/v1/plans.js +8 -4
  98. package/resources/v1/plans.js.map +1 -1
  99. package/resources/v1/plans.mjs +8 -4
  100. package/resources/v1/plans.mjs.map +1 -1
  101. package/resources/v1/settings/billing-providers.d.mts +103 -0
  102. package/resources/v1/settings/billing-providers.d.mts.map +1 -0
  103. package/resources/v1/settings/billing-providers.d.ts +103 -0
  104. package/resources/v1/settings/billing-providers.d.ts.map +1 -0
  105. package/resources/v1/settings/billing-providers.js +48 -0
  106. package/resources/v1/settings/billing-providers.js.map +1 -0
  107. package/resources/v1/settings/billing-providers.mjs +44 -0
  108. package/resources/v1/settings/billing-providers.mjs.map +1 -0
  109. package/resources/v1/settings/index.d.mts +3 -0
  110. package/resources/v1/settings/index.d.mts.map +1 -0
  111. package/resources/v1/settings/index.d.ts +3 -0
  112. package/resources/v1/settings/index.d.ts.map +1 -0
  113. package/resources/v1/settings/index.js +9 -0
  114. package/resources/v1/settings/index.js.map +1 -0
  115. package/resources/v1/settings/index.mjs +4 -0
  116. package/resources/v1/settings/index.mjs.map +1 -0
  117. package/resources/v1/settings/settings.d.mts +60 -0
  118. package/resources/v1/settings/settings.d.mts.map +1 -0
  119. package/resources/v1/settings/settings.d.ts +60 -0
  120. package/resources/v1/settings/settings.d.ts.map +1 -0
  121. package/resources/v1/settings/settings.js +40 -0
  122. package/resources/v1/settings/settings.js.map +1 -0
  123. package/resources/v1/settings/settings.mjs +35 -0
  124. package/resources/v1/settings/settings.mjs.map +1 -0
  125. package/resources/v1/settings.d.mts +2 -0
  126. package/resources/v1/settings.d.mts.map +1 -0
  127. package/resources/v1/settings.d.ts +2 -0
  128. package/resources/v1/settings.d.ts.map +1 -0
  129. package/resources/v1/settings.js +6 -0
  130. package/resources/v1/settings.js.map +1 -0
  131. package/resources/v1/settings.mjs +3 -0
  132. package/resources/v1/settings.mjs.map +1 -0
  133. package/resources/v1/usage.d.mts +3 -2
  134. package/resources/v1/usage.d.mts.map +1 -1
  135. package/resources/v1/usage.d.ts +3 -2
  136. package/resources/v1/usage.d.ts.map +1 -1
  137. package/resources/v1/v1.d.mts +6 -2
  138. package/resources/v1/v1.d.mts.map +1 -1
  139. package/resources/v1/v1.d.ts +6 -2
  140. package/resources/v1/v1.d.ts.map +1 -1
  141. package/resources/v1/v1.js +4 -0
  142. package/resources/v1/v1.js.map +1 -1
  143. package/resources/v1/v1.mjs +4 -0
  144. package/resources/v1/v1.mjs.map +1 -1
  145. package/resources/v2/contracts.d.mts +204 -3
  146. package/resources/v2/contracts.d.mts.map +1 -1
  147. package/resources/v2/contracts.d.ts +204 -3
  148. package/resources/v2/contracts.d.ts.map +1 -1
  149. package/src/client.ts +1 -1
  150. package/src/resources/shared.ts +80 -20
  151. package/src/resources/v1/alerts.ts +24 -1
  152. package/src/resources/v1/contracts/contracts.ts +97 -12
  153. package/src/resources/v1/credit-grants.ts +10 -5
  154. package/src/resources/v1/customers/alerts.ts +45 -0
  155. package/src/resources/v1/customers/billing-config.ts +32 -7
  156. package/src/resources/v1/customers/commits.ts +3 -2
  157. package/src/resources/v1/customers/customers.ts +112 -18
  158. package/src/resources/v1/customers/index.ts +1 -0
  159. package/src/resources/v1/customers/invoices.ts +80 -3
  160. package/src/resources/v1/customers/plans.ts +10 -4
  161. package/src/resources/v1/index.ts +6 -0
  162. package/src/resources/v1/payments.ts +2 -0
  163. package/src/resources/v1/plans.ts +8 -4
  164. package/src/resources/v1/settings/billing-providers.ts +139 -0
  165. package/src/resources/v1/settings/index.ts +14 -0
  166. package/src/resources/v1/settings/settings.ts +94 -0
  167. package/src/resources/v1/settings.ts +3 -0
  168. package/src/resources/v1/usage.ts +3 -2
  169. package/src/resources/v1/v1.ts +16 -0
  170. package/src/resources/v2/contracts.ts +249 -3
  171. package/src/version.ts +1 -1
  172. package/version.d.mts +1 -1
  173. package/version.d.ts +1 -1
  174. package/version.js +1 -1
  175. package/version.mjs +1 -1
@@ -248,7 +248,8 @@ export class Customers extends APIResource {
248
248
  /**
249
249
  * Fetch daily pending costs for the specified customer, broken down by credit type
250
250
  * and line items. Note: this is not supported for customers whose plan includes a
251
- * UNIQUE-type billable metric.
251
+ * UNIQUE-type billable metric. This is a Plans (deprecated) endpoint. New clients
252
+ * should implement using Contracts.
252
253
  *
253
254
  * @example
254
255
  * ```ts
@@ -280,7 +281,8 @@ export class Customers extends APIResource {
280
281
  * Preview how a set of events will affect a customer's invoices. Generates draft
281
282
  * invoices for a customer using their current contract configuration and the
282
283
  * provided events. This is useful for testing how new events will affect the
283
- * customer's invoices before they are actually processed.
284
+ * customer's invoices before they are actually processed. Customers on contracts
285
+ * with SQL billable metrics are not supported.
284
286
  *
285
287
  * @example
286
288
  * ```ts
@@ -293,6 +295,7 @@ export class Customers extends APIResource {
293
295
  * properties: { cpu_hours: 100, memory_gb_hours: 200 },
294
296
  * },
295
297
  * ],
298
+ * mode: 'replace',
296
299
  * });
297
300
  * ```
298
301
  */
@@ -369,7 +372,7 @@ export class Customers extends APIResource {
369
372
  *
370
373
  * @example
371
374
  * ```ts
372
- * await client.v1.customers.setBillingConfigurations({
375
+ * const response = await client.v1.customers.setBillingConfigurations({
373
376
  * data: [
374
377
  * {
375
378
  * customer_id: '4db51251-61de-4bfe-b9ce-495e244f3491',
@@ -395,6 +398,12 @@ export class Customers extends APIResource {
395
398
  * configuration: { ... },
396
399
  * delivery_method: 'direct_to_billing_provider',
397
400
  * },
401
+ * {
402
+ * customer_id: '4db51251-61de-4bfe-b9ce-495e244f3491',
403
+ * billing_provider: 'gcp_marketplace',
404
+ * configuration: { ... },
405
+ * delivery_method: 'direct_to_billing_provider',
406
+ * },
398
407
  * ],
399
408
  * });
400
409
  * ```
@@ -402,12 +411,8 @@ export class Customers extends APIResource {
402
411
  setBillingConfigurations(
403
412
  body: CustomerSetBillingConfigurationsParams,
404
413
  options?: RequestOptions,
405
- ): APIPromise<void> {
406
- return this._client.post('/v1/setCustomerBillingProviderConfigurations', {
407
- body,
408
- ...options,
409
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
410
- });
414
+ ): APIPromise<CustomerSetBillingConfigurationsResponse> {
415
+ return this._client.post('/v1/setCustomerBillingProviderConfigurations', { body, ...options });
411
416
  }
412
417
 
413
418
  /**
@@ -728,7 +733,8 @@ export namespace CustomerRetrieveBillingConfigurationsResponse {
728
733
  | 'azure_marketplace'
729
734
  | 'quickbooks_online'
730
735
  | 'workday'
731
- | 'gcp_marketplace';
736
+ | 'gcp_marketplace'
737
+ | 'metronome';
732
738
 
733
739
  /**
734
740
  * Configuration for the billing provider. The structure of this object is specific
@@ -756,6 +762,54 @@ export namespace CustomerRetrieveBillingConfigurationsResponse {
756
762
  }
757
763
  }
758
764
 
765
+ export interface CustomerSetBillingConfigurationsResponse {
766
+ data: Array<CustomerSetBillingConfigurationsResponse.Data>;
767
+ }
768
+
769
+ export namespace CustomerSetBillingConfigurationsResponse {
770
+ export interface Data {
771
+ /**
772
+ * ID of the created configuration
773
+ */
774
+ id?: string;
775
+
776
+ /**
777
+ * The billing provider set for this configuration.
778
+ */
779
+ billing_provider?:
780
+ | 'aws_marketplace'
781
+ | 'stripe'
782
+ | 'netsuite'
783
+ | 'custom'
784
+ | 'azure_marketplace'
785
+ | 'quickbooks_online'
786
+ | 'workday'
787
+ | 'gcp_marketplace'
788
+ | 'metronome';
789
+
790
+ /**
791
+ * Configuration for the billing provider. The structure of this object is specific
792
+ * to the billing provider and delivery method combination.
793
+ */
794
+ configuration?: { [key: string]: unknown };
795
+
796
+ /**
797
+ * ID of the customer this configuration is associated with.
798
+ */
799
+ customer_id?: string;
800
+
801
+ /**
802
+ * ID of the delivery method used for this customer configuration.
803
+ */
804
+ delivery_method_id?: string;
805
+
806
+ /**
807
+ * The tax provider set for this configuration.
808
+ */
809
+ tax_provider?: 'anrok' | 'avalara' | 'stripe';
810
+ }
811
+ }
812
+
759
813
  export interface CustomerSetNameResponse {
760
814
  data: Customer;
761
815
  }
@@ -775,6 +829,8 @@ export interface CustomerCreateParams {
775
829
 
776
830
  customer_billing_provider_configurations?: Array<CustomerCreateParams.CustomerBillingProviderConfiguration>;
777
831
 
832
+ customer_revenue_system_configurations?: Array<CustomerCreateParams.CustomerRevenueSystemConfiguration>;
833
+
778
834
  /**
779
835
  * (deprecated, use ingest_aliases instead) an alias that can be used to refer to
780
836
  * this customer in usage events
@@ -799,7 +855,12 @@ export namespace CustomerCreateParams {
799
855
  | 'azure_marketplace'
800
856
  | 'quickbooks_online'
801
857
  | 'workday'
802
- | 'gcp_marketplace';
858
+ | 'gcp_marketplace'
859
+ | 'metronome';
860
+
861
+ aws_customer_account_id?: string;
862
+
863
+ aws_customer_id?: string;
803
864
 
804
865
  /**
805
866
  * True if the aws_product_code is a SAAS subscription product, false otherwise.
@@ -835,6 +896,10 @@ export namespace CustomerCreateParams {
835
896
  | 'us-west-1'
836
897
  | 'us-west-2';
837
898
 
899
+ /**
900
+ * The collection method for the customer's invoices. NOTE:
901
+ * `auto_charge_payment_intent` and `manually_charge_payment_intent` are in beta.
902
+ */
838
903
  stripe_collection_method?:
839
904
  | 'charge_automatically'
840
905
  | 'send_invoice'
@@ -876,6 +941,32 @@ export namespace CustomerCreateParams {
876
941
  */
877
942
  tax_provider?: 'anrok' | 'avalara' | 'stripe';
878
943
  }
944
+
945
+ export interface CustomerRevenueSystemConfiguration {
946
+ /**
947
+ * The revenue system provider set for this configuration.
948
+ */
949
+ provider: 'netsuite';
950
+
951
+ /**
952
+ * Configuration for the revenue system provider. The structure of this object is
953
+ * specific to the revenue system provider. For NetSuite, this should contain
954
+ * `netsuite_customer_id`.
955
+ */
956
+ configuration?: { [key: string]: unknown };
957
+
958
+ /**
959
+ * The method to use for delivering invoices to this customer. If not provided, the
960
+ * `delivery_method_id` must be provided.
961
+ */
962
+ delivery_method?: 'direct_to_billing_provider';
963
+
964
+ /**
965
+ * ID of the delivery method to use for this customer. If not provided, the
966
+ * `delivery_method` must be provided.
967
+ */
968
+ delivery_method_id?: string;
969
+ }
879
970
  }
880
971
 
881
972
  export interface CustomerRetrieveParams {
@@ -952,20 +1043,21 @@ export interface CustomerPreviewEventsParams {
952
1043
  customer_id: string;
953
1044
 
954
1045
  /**
955
- * Body param:
1046
+ * Body param: Array of usage events to include in the preview calculation. Must
1047
+ * contain at least one event in `merge` mode.
956
1048
  */
957
1049
  events: Array<CustomerPreviewEventsParams.Event>;
958
1050
 
959
1051
  /**
960
- * Body param: If set to "replace", the preview will be generated as if those were
961
- * the only events for the specified customer. If set to "merge", the events will
962
- * be merged with any existing events for the specified customer. Defaults to
963
- * "replace".
1052
+ * Body param: Controls how the provided events are combined with existing usage
1053
+ * data. Use `replace` to calculate the preview as if these are the only events for
1054
+ * the customer, ignoring all historical usage. Use `merge` to combine these events
1055
+ * with the customer's existing usage. Defaults to `replace`.
964
1056
  */
965
1057
  mode?: 'replace' | 'merge';
966
1058
 
967
1059
  /**
968
- * Body param: If set, all zero quantity line items will be filtered out of the
1060
+ * Body param: When `true`, line items with zero quantity are excluded from the
969
1061
  * response.
970
1062
  */
971
1063
  skip_zero_qty_line_items?: boolean;
@@ -1014,7 +1106,8 @@ export namespace CustomerSetBillingConfigurationsParams {
1014
1106
  | 'azure_marketplace'
1015
1107
  | 'quickbooks_online'
1016
1108
  | 'workday'
1017
- | 'gcp_marketplace';
1109
+ | 'gcp_marketplace'
1110
+ | 'metronome';
1018
1111
 
1019
1112
  customer_id: string;
1020
1113
 
@@ -1113,6 +1206,7 @@ export declare namespace Customers {
1113
1206
  type CustomerListCostsResponse as CustomerListCostsResponse,
1114
1207
  type CustomerPreviewEventsResponse as CustomerPreviewEventsResponse,
1115
1208
  type CustomerRetrieveBillingConfigurationsResponse as CustomerRetrieveBillingConfigurationsResponse,
1209
+ type CustomerSetBillingConfigurationsResponse as CustomerSetBillingConfigurationsResponse,
1116
1210
  type CustomerSetNameResponse as CustomerSetNameResponse,
1117
1211
  type CustomerDetailsCursorPage as CustomerDetailsCursorPage,
1118
1212
  type CustomerListBillableMetricsResponsesCursorPage as CustomerListBillableMetricsResponsesCursorPage,
@@ -43,6 +43,7 @@ export {
43
43
  type CustomerListCostsResponse,
44
44
  type CustomerPreviewEventsResponse,
45
45
  type CustomerRetrieveBillingConfigurationsResponse,
46
+ type CustomerSetBillingConfigurationsResponse,
46
47
  type CustomerSetNameResponse,
47
48
  type CustomerCreateParams,
48
49
  type CustomerRetrieveParams,
@@ -133,7 +133,8 @@ export class Invoices extends APIResource {
133
133
  }
134
134
 
135
135
  /**
136
- * Add a one time charge to the specified invoice
136
+ * Add a one time charge to the specified invoice. This is a Plans (deprecated)
137
+ * endpoint. New clients should implement using Contracts.
137
138
  *
138
139
  * @example
139
140
  * ```ts
@@ -297,6 +298,12 @@ export interface Invoice {
297
298
  */
298
299
  billable_status?: unknown;
299
300
 
301
+ /**
302
+ * Account hierarchy M3 - Required on invoices with type USAGE_CONSOLIDATED. List
303
+ * of constituent invoices that were consolidated to create this invoice.
304
+ */
305
+ constituent_invoices?: Array<Invoice.ConstituentInvoice>;
306
+
300
307
  /**
301
308
  * Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
302
309
  */
@@ -340,6 +347,12 @@ export interface Invoice {
340
347
  */
341
348
  netsuite_sales_order_id?: string;
342
349
 
350
+ /**
351
+ * Account hierarchy M3 - Required for account hierarchy usage invoices. An object
352
+ * containing the contract and customer UUIDs that pay for this invoice.
353
+ */
354
+ payer?: Invoice.Payer;
355
+
343
356
  /**
344
357
  * Custom fields to be added eg. { "key1": "value1", "key2": "value2" }
345
358
  */
@@ -484,6 +497,13 @@ export namespace Invoice {
484
497
 
485
498
  netsuite_item_id?: string;
486
499
 
500
+ /**
501
+ * Account hierarchy M3 - Present on line items from invoices with type
502
+ * USAGE_CONSOLIDATED. Indicates the original customer, contract, invoice and line
503
+ * item from which this line item was copied.
504
+ */
505
+ origin?: LineItem.Origin;
506
+
487
507
  /**
488
508
  * Only present for line items paying for a postpaid commit true-up.
489
509
  */
@@ -584,6 +604,21 @@ export namespace Invoice {
584
604
  type: 'PREPAID' | 'POSTPAID' | 'CREDIT';
585
605
  }
586
606
 
607
+ /**
608
+ * Account hierarchy M3 - Present on line items from invoices with type
609
+ * USAGE_CONSOLIDATED. Indicates the original customer, contract, invoice and line
610
+ * item from which this line item was copied.
611
+ */
612
+ export interface Origin {
613
+ contract_id: string;
614
+
615
+ customer_id: string;
616
+
617
+ invoice_id: string;
618
+
619
+ line_item_id: string;
620
+ }
621
+
587
622
  /**
588
623
  * Only present for line items paying for a postpaid commit true-up.
589
624
  */
@@ -667,6 +702,14 @@ export namespace Invoice {
667
702
  }
668
703
  }
669
704
 
705
+ export interface ConstituentInvoice {
706
+ contract_id: string;
707
+
708
+ customer_id: string;
709
+
710
+ invoice_id: string;
711
+ }
712
+
670
713
  export interface CorrectionRecord {
671
714
  corrected_invoice_id: string;
672
715
 
@@ -687,12 +730,24 @@ export namespace Invoice {
687
730
  | 'azure_marketplace'
688
731
  | 'quickbooks_online'
689
732
  | 'workday'
690
- | 'gcp_marketplace';
733
+ | 'gcp_marketplace'
734
+ | 'metronome';
735
+
736
+ /**
737
+ * Error message from the billing provider, if available.
738
+ */
739
+ billing_provider_error?: string;
740
+
741
+ /**
742
+ * The ID of the payment in the external system, if available.
743
+ */
744
+ external_payment_id?: string;
691
745
 
692
746
  external_status?:
693
747
  | 'DRAFT'
694
748
  | 'FINALIZED'
695
749
  | 'PAID'
750
+ | 'PARTIALLY_PAID'
696
751
  | 'UNCOLLECTIBLE'
697
752
  | 'VOID'
698
753
  | 'DELETED'
@@ -759,12 +814,24 @@ export namespace Invoice {
759
814
  | 'azure_marketplace'
760
815
  | 'quickbooks_online'
761
816
  | 'workday'
762
- | 'gcp_marketplace';
817
+ | 'gcp_marketplace'
818
+ | 'metronome';
819
+
820
+ /**
821
+ * Error message from the billing provider, if available.
822
+ */
823
+ billing_provider_error?: string;
824
+
825
+ /**
826
+ * The ID of the payment in the external system, if available.
827
+ */
828
+ external_payment_id?: string;
763
829
 
764
830
  external_status?:
765
831
  | 'DRAFT'
766
832
  | 'FINALIZED'
767
833
  | 'PAID'
834
+ | 'PARTIALLY_PAID'
768
835
  | 'UNCOLLECTIBLE'
769
836
  | 'VOID'
770
837
  | 'DELETED'
@@ -836,6 +903,16 @@ export namespace Invoice {
836
903
  credit_grant_id?: string;
837
904
  }
838
905
 
906
+ /**
907
+ * Account hierarchy M3 - Required for account hierarchy usage invoices. An object
908
+ * containing the contract and customer UUIDs that pay for this invoice.
909
+ */
910
+ export interface Payer {
911
+ contract_id: string;
912
+
913
+ customer_id: string;
914
+ }
915
+
839
916
  /**
840
917
  * Only present for contract invoices with reseller royalties.
841
918
  */
@@ -9,7 +9,8 @@ import { path } from '../../../internal/utils/path';
9
9
 
10
10
  export class Plans extends APIResource {
11
11
  /**
12
- * List the given customer's plans in reverse-chronological order.
12
+ * List the given customer's plans in reverse-chronological order. This is a Plans
13
+ * (deprecated) endpoint. New clients should implement using Contracts.
13
14
  *
14
15
  * @example
15
16
  * ```ts
@@ -35,7 +36,8 @@ export class Plans extends APIResource {
35
36
  /**
36
37
  * Associate an existing customer with a plan for a specified date range. See the
37
38
  * [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments)
38
- * for details on the price adjustments.
39
+ * for details on the price adjustments. This is a Plans (deprecated) endpoint. New
40
+ * clients should implement using Contracts.
39
41
  *
40
42
  * @example
41
43
  * ```ts
@@ -53,7 +55,8 @@ export class Plans extends APIResource {
53
55
  }
54
56
 
55
57
  /**
56
- * Change the end date of a customer's plan.
58
+ * Change the end date of a customer's plan. This is a Plans (deprecated) endpoint.
59
+ * New clients should implement using Contracts.
57
60
  *
58
61
  * @example
59
62
  * ```ts
@@ -75,7 +78,8 @@ export class Plans extends APIResource {
75
78
  /**
76
79
  * Lists a customer plans adjustments. See the
77
80
  * [price adjustments documentation](https://plans-docs.metronome.com/pricing/managing-plans/#price-adjustments)
78
- * for details.
81
+ * for details. This is a Plans (deprecated) endpoint. New clients should implement
82
+ * using Contracts.
79
83
  *
80
84
  * @example
81
85
  * ```ts
@@ -180,6 +184,8 @@ export namespace PlanListPriceAdjustmentsResponse {
180
184
  */
181
185
  adjustment_type: 'fixed' | 'quantity' | 'percentage' | 'override';
182
186
 
187
+ quantity?: number;
188
+
183
189
  /**
184
190
  * Used in pricing tiers. Indicates at what metric value the price applies.
185
191
  */
@@ -92,6 +92,7 @@ export {
92
92
  type CustomerListCostsResponse,
93
93
  type CustomerPreviewEventsResponse,
94
94
  type CustomerRetrieveBillingConfigurationsResponse,
95
+ type CustomerSetBillingConfigurationsResponse,
95
96
  type CustomerSetNameResponse,
96
97
  type CustomerCreateParams,
97
98
  type CustomerRetrieveParams,
@@ -154,6 +155,11 @@ export {
154
155
  type PricingUnitListResponsesCursorPage,
155
156
  } from './pricing-units';
156
157
  export { Services, type ServiceListResponse } from './services';
158
+ export {
159
+ Settings,
160
+ type SettingUpsertAvalaraCredentialsResponse,
161
+ type SettingUpsertAvalaraCredentialsParams,
162
+ } from './settings/index';
157
163
  export {
158
164
  Usage,
159
165
  type UsageListResponse,
@@ -112,6 +112,8 @@ export namespace Payment {
112
112
  payment_intent_id: string;
113
113
 
114
114
  error?: Stripe.Error;
115
+
116
+ payment_method_id?: string;
115
117
  }
116
118
 
117
119
  export namespace Stripe {
@@ -10,7 +10,8 @@ import { path } from '../../internal/utils/path';
10
10
 
11
11
  export class Plans extends APIResource {
12
12
  /**
13
- * List all available plans.
13
+ * List all available plans. This is a Plans (deprecated) endpoint. New clients
14
+ * should implement using Contracts.
14
15
  *
15
16
  * @example
16
17
  * ```ts
@@ -28,7 +29,8 @@ export class Plans extends APIResource {
28
29
  }
29
30
 
30
31
  /**
31
- * Fetch high level details of a specific plan.
32
+ * Fetch high level details of a specific plan. This is a Plans (deprecated)
33
+ * endpoint. New clients should implement using Contracts.
32
34
  *
33
35
  * @example
34
36
  * ```ts
@@ -43,7 +45,8 @@ export class Plans extends APIResource {
43
45
  }
44
46
 
45
47
  /**
46
- * Fetches a list of charges of a specific plan.
48
+ * Fetches a list of charges of a specific plan. This is a Plans (deprecated)
49
+ * endpoint. New clients should implement using Contracts.
47
50
  *
48
51
  * @example
49
52
  * ```ts
@@ -69,7 +72,8 @@ export class Plans extends APIResource {
69
72
 
70
73
  /**
71
74
  * Fetches a list of customers on a specific plan (by default, only currently
72
- * active plans are included)
75
+ * active plans are included). This is a Plans (deprecated) endpoint. New clients
76
+ * should implement using Contracts.
73
77
  *
74
78
  * @example
75
79
  * ```ts
@@ -0,0 +1,139 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import { APIPromise } from '../../../core/api-promise';
5
+ import { RequestOptions } from '../../../internal/request-options';
6
+
7
+ export class BillingProviders extends APIResource {
8
+ /**
9
+ * Set up account-level configuration for a billing provider. Once configured,
10
+ * individual contracts across customers can be mapped to this configuration using
11
+ * the returned delivery_method_id.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const billingProvider =
16
+ * await client.v1.settings.billingProviders.create({
17
+ * billing_provider: 'aws_marketplace',
18
+ * configuration: {
19
+ * aws_external_id:
20
+ * '47b4f6b7-e297-42e8-b175-331d933b402c',
21
+ * aws_iam_role_arn: 'arn:aws:iam::test',
22
+ * },
23
+ * delivery_method: 'direct_to_billing_provider',
24
+ * });
25
+ * ```
26
+ */
27
+ create(
28
+ body: BillingProviderCreateParams,
29
+ options?: RequestOptions,
30
+ ): APIPromise<BillingProviderCreateResponse> {
31
+ return this._client.post('/v1/setUpBillingProvider', { body, ...options });
32
+ }
33
+
34
+ /**
35
+ * Lists all configured billing providers and their delivery method configurations
36
+ * for your account. Returns provider details, delivery method IDs, and
37
+ * configuration settings needed for mapping individual customer contracts to
38
+ * billing integrations.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const billingProviders =
43
+ * await client.v1.settings.billingProviders.list({
44
+ * next_page: 'af26878a-de62-4a0d-9b77-3936f7c2b6d6',
45
+ * });
46
+ * ```
47
+ */
48
+ list(
49
+ body: BillingProviderListParams | null | undefined = {},
50
+ options?: RequestOptions,
51
+ ): APIPromise<BillingProviderListResponse> {
52
+ return this._client.post('/v1/listConfiguredBillingProviders', { body, ...options });
53
+ }
54
+ }
55
+
56
+ export interface BillingProviderCreateResponse {
57
+ data: BillingProviderCreateResponse.Data;
58
+ }
59
+
60
+ export namespace BillingProviderCreateResponse {
61
+ export interface Data {
62
+ delivery_method_id: string;
63
+ }
64
+ }
65
+
66
+ export interface BillingProviderListResponse {
67
+ data: Array<BillingProviderListResponse.Data>;
68
+
69
+ next_page?: string | null;
70
+ }
71
+
72
+ export namespace BillingProviderListResponse {
73
+ export interface Data {
74
+ /**
75
+ * The billing provider set for this configuration.
76
+ */
77
+ billing_provider:
78
+ | 'aws_marketplace'
79
+ | 'stripe'
80
+ | 'netsuite'
81
+ | 'custom'
82
+ | 'azure_marketplace'
83
+ | 'quickbooks_online'
84
+ | 'workday'
85
+ | 'gcp_marketplace'
86
+ | 'metronome';
87
+
88
+ /**
89
+ * The method to use for delivering invoices to this customer.
90
+ */
91
+ delivery_method: 'direct_to_billing_provider' | 'aws_sqs' | 'tackle' | 'aws_sns';
92
+
93
+ /**
94
+ * Configuration for the delivery method. The structure of this object is specific
95
+ * to the delivery method. Some configuration may be omitted for security reasons.
96
+ */
97
+ delivery_method_configuration: { [key: string]: unknown };
98
+
99
+ /**
100
+ * ID of the delivery method to use for this customer.
101
+ */
102
+ delivery_method_id: string;
103
+ }
104
+ }
105
+
106
+ export interface BillingProviderCreateParams {
107
+ /**
108
+ * The billing provider set for this configuration.
109
+ */
110
+ billing_provider: 'aws_marketplace' | 'azure_marketplace' | 'gcp_marketplace';
111
+
112
+ /**
113
+ * Account-level configuration for the billing provider. The structure of this
114
+ * object is specific to the billing provider and delivery provider combination.
115
+ * See examples below.
116
+ */
117
+ configuration: { [key: string]: unknown };
118
+
119
+ /**
120
+ * The method to use for delivering invoices for this configuration.
121
+ */
122
+ delivery_method: 'direct_to_billing_provider' | 'aws_sqs' | 'aws_sns';
123
+ }
124
+
125
+ export interface BillingProviderListParams {
126
+ /**
127
+ * The cursor to the next page of results
128
+ */
129
+ next_page?: string | null;
130
+ }
131
+
132
+ export declare namespace BillingProviders {
133
+ export {
134
+ type BillingProviderCreateResponse as BillingProviderCreateResponse,
135
+ type BillingProviderListResponse as BillingProviderListResponse,
136
+ type BillingProviderCreateParams as BillingProviderCreateParams,
137
+ type BillingProviderListParams as BillingProviderListParams,
138
+ };
139
+ }
@@ -0,0 +1,14 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ BillingProviders,
5
+ type BillingProviderCreateResponse,
6
+ type BillingProviderListResponse,
7
+ type BillingProviderCreateParams,
8
+ type BillingProviderListParams,
9
+ } from './billing-providers';
10
+ export {
11
+ Settings,
12
+ type SettingUpsertAvalaraCredentialsResponse,
13
+ type SettingUpsertAvalaraCredentialsParams,
14
+ } from './settings';