@metronome/sdk 0.1.0-beta.9 → 0.1.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 (286) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/README.md +30 -46
  3. package/_shims/index.d.ts +2 -0
  4. package/_shims/index.js +5 -1
  5. package/_shims/index.mjs +5 -1
  6. package/core.d.ts +19 -5
  7. package/core.d.ts.map +1 -1
  8. package/core.js +23 -14
  9. package/core.js.map +1 -1
  10. package/core.mjs +24 -15
  11. package/core.mjs.map +1 -1
  12. package/index.d.mts +3 -2
  13. package/index.d.ts +3 -2
  14. package/index.d.ts.map +1 -1
  15. package/index.js +6 -3
  16. package/index.js.map +1 -1
  17. package/index.mjs +6 -3
  18. package/index.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/pagination.d.ts +1 -0
  21. package/pagination.d.ts.map +1 -1
  22. package/pagination.js +3 -0
  23. package/pagination.js.map +1 -1
  24. package/pagination.mjs +3 -0
  25. package/pagination.mjs.map +1 -1
  26. package/resource.d.ts +1 -1
  27. package/resource.d.ts.map +1 -1
  28. package/resource.js.map +1 -1
  29. package/resource.mjs.map +1 -1
  30. package/resources/shared.d.ts +473 -37
  31. package/resources/shared.d.ts.map +1 -1
  32. package/resources/v1/alerts.d.ts +26 -2
  33. package/resources/v1/alerts.d.ts.map +1 -1
  34. package/resources/v1/alerts.js +19 -0
  35. package/resources/v1/alerts.js.map +1 -1
  36. package/resources/v1/alerts.mjs +19 -0
  37. package/resources/v1/alerts.mjs.map +1 -1
  38. package/resources/v1/audit-logs.d.ts +8 -0
  39. package/resources/v1/audit-logs.d.ts.map +1 -1
  40. package/resources/v1/audit-logs.js.map +1 -1
  41. package/resources/v1/audit-logs.mjs.map +1 -1
  42. package/resources/v1/billable-metrics.d.ts +58 -3
  43. package/resources/v1/billable-metrics.d.ts.map +1 -1
  44. package/resources/v1/billable-metrics.js +41 -0
  45. package/resources/v1/billable-metrics.js.map +1 -1
  46. package/resources/v1/billable-metrics.mjs +41 -0
  47. package/resources/v1/billable-metrics.mjs.map +1 -1
  48. package/resources/v1/contracts/contracts.d.ts +1478 -102
  49. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  50. package/resources/v1/contracts/contracts.js +180 -3
  51. package/resources/v1/contracts/contracts.js.map +1 -1
  52. package/resources/v1/contracts/contracts.mjs +180 -3
  53. package/resources/v1/contracts/contracts.mjs.map +1 -1
  54. package/resources/v1/contracts/index.d.ts +2 -2
  55. package/resources/v1/contracts/index.d.ts.map +1 -1
  56. package/resources/v1/contracts/index.js.map +1 -1
  57. package/resources/v1/contracts/index.mjs.map +1 -1
  58. package/resources/v1/contracts/named-schedules.d.ts +21 -0
  59. package/resources/v1/contracts/named-schedules.d.ts.map +1 -1
  60. package/resources/v1/contracts/named-schedules.js +21 -0
  61. package/resources/v1/contracts/named-schedules.js.map +1 -1
  62. package/resources/v1/contracts/named-schedules.mjs +21 -0
  63. package/resources/v1/contracts/named-schedules.mjs.map +1 -1
  64. package/resources/v1/contracts/products.d.ts +51 -3
  65. package/resources/v1/contracts/products.d.ts.map +1 -1
  66. package/resources/v1/contracts/products.js +33 -0
  67. package/resources/v1/contracts/products.js.map +1 -1
  68. package/resources/v1/contracts/products.mjs +33 -0
  69. package/resources/v1/contracts/products.mjs.map +1 -1
  70. package/resources/v1/contracts/rate-cards/index.d.ts +1 -1
  71. package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -1
  72. package/resources/v1/contracts/rate-cards/index.js.map +1 -1
  73. package/resources/v1/contracts/rate-cards/index.mjs.map +1 -1
  74. package/resources/v1/contracts/rate-cards/named-schedules.d.ts +25 -0
  75. package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -1
  76. package/resources/v1/contracts/rate-cards/named-schedules.js +25 -0
  77. package/resources/v1/contracts/rate-cards/named-schedules.js.map +1 -1
  78. package/resources/v1/contracts/rate-cards/named-schedules.mjs +25 -0
  79. package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -1
  80. package/resources/v1/contracts/rate-cards/product-orders.d.ts +30 -0
  81. package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -1
  82. package/resources/v1/contracts/rate-cards/product-orders.js +30 -0
  83. package/resources/v1/contracts/rate-cards/product-orders.js.map +1 -1
  84. package/resources/v1/contracts/rate-cards/product-orders.mjs +30 -0
  85. package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -1
  86. package/resources/v1/contracts/rate-cards/rate-cards.d.ts +107 -10
  87. package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -1
  88. package/resources/v1/contracts/rate-cards/rate-cards.js +71 -0
  89. package/resources/v1/contracts/rate-cards/rate-cards.js.map +1 -1
  90. package/resources/v1/contracts/rate-cards/rate-cards.mjs +71 -0
  91. package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -1
  92. package/resources/v1/contracts/rate-cards/rates.d.ts +102 -14
  93. package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -1
  94. package/resources/v1/contracts/rate-cards/rates.js +68 -0
  95. package/resources/v1/contracts/rate-cards/rates.js.map +1 -1
  96. package/resources/v1/contracts/rate-cards/rates.mjs +68 -0
  97. package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -1
  98. package/resources/v1/credit-grants.d.ts +77 -2
  99. package/resources/v1/credit-grants.d.ts.map +1 -1
  100. package/resources/v1/credit-grants.js +39 -2
  101. package/resources/v1/credit-grants.js.map +1 -1
  102. package/resources/v1/credit-grants.mjs +39 -2
  103. package/resources/v1/credit-grants.mjs.map +1 -1
  104. package/resources/v1/custom-fields.d.ts +51 -7
  105. package/resources/v1/custom-fields.d.ts.map +1 -1
  106. package/resources/v1/custom-fields.js +35 -0
  107. package/resources/v1/custom-fields.js.map +1 -1
  108. package/resources/v1/custom-fields.mjs +35 -0
  109. package/resources/v1/custom-fields.mjs.map +1 -1
  110. package/resources/v1/customers/alerts.d.ts +28 -0
  111. package/resources/v1/customers/alerts.d.ts.map +1 -1
  112. package/resources/v1/customers/alerts.js +23 -0
  113. package/resources/v1/customers/alerts.js.map +1 -1
  114. package/resources/v1/customers/alerts.mjs +23 -0
  115. package/resources/v1/customers/alerts.mjs.map +1 -1
  116. package/resources/v1/customers/billing-config.d.ts +31 -0
  117. package/resources/v1/customers/billing-config.d.ts.map +1 -1
  118. package/resources/v1/customers/billing-config.js +27 -0
  119. package/resources/v1/customers/billing-config.js.map +1 -1
  120. package/resources/v1/customers/billing-config.mjs +27 -0
  121. package/resources/v1/customers/billing-config.mjs.map +1 -1
  122. package/resources/v1/customers/commits.d.ts +94 -7
  123. package/resources/v1/customers/commits.d.ts.map +1 -1
  124. package/resources/v1/customers/commits.js +56 -1
  125. package/resources/v1/customers/commits.js.map +1 -1
  126. package/resources/v1/customers/commits.mjs +56 -1
  127. package/resources/v1/customers/commits.mjs.map +1 -1
  128. package/resources/v1/customers/credits.d.ts +73 -3
  129. package/resources/v1/customers/credits.d.ts.map +1 -1
  130. package/resources/v1/customers/credits.js +41 -1
  131. package/resources/v1/customers/credits.js.map +1 -1
  132. package/resources/v1/customers/credits.mjs +41 -1
  133. package/resources/v1/customers/credits.mjs.map +1 -1
  134. package/resources/v1/customers/customers.d.ts +186 -9
  135. package/resources/v1/customers/customers.d.ts.map +1 -1
  136. package/resources/v1/customers/customers.js +106 -1
  137. package/resources/v1/customers/customers.js.map +1 -1
  138. package/resources/v1/customers/customers.mjs +106 -1
  139. package/resources/v1/customers/customers.mjs.map +1 -1
  140. package/resources/v1/customers/index.d.ts +1 -1
  141. package/resources/v1/customers/index.d.ts.map +1 -1
  142. package/resources/v1/customers/index.js.map +1 -1
  143. package/resources/v1/customers/index.mjs.map +1 -1
  144. package/resources/v1/customers/invoices.d.ts +144 -52
  145. package/resources/v1/customers/invoices.d.ts.map +1 -1
  146. package/resources/v1/customers/invoices.js +49 -0
  147. package/resources/v1/customers/invoices.js.map +1 -1
  148. package/resources/v1/customers/invoices.mjs +49 -0
  149. package/resources/v1/customers/invoices.mjs.map +1 -1
  150. package/resources/v1/customers/named-schedules.d.ts +21 -0
  151. package/resources/v1/customers/named-schedules.d.ts.map +1 -1
  152. package/resources/v1/customers/named-schedules.js +21 -0
  153. package/resources/v1/customers/named-schedules.js.map +1 -1
  154. package/resources/v1/customers/named-schedules.mjs +21 -0
  155. package/resources/v1/customers/named-schedules.mjs.map +1 -1
  156. package/resources/v1/customers/plans.d.ts +46 -1
  157. package/resources/v1/customers/plans.d.ts.map +1 -1
  158. package/resources/v1/customers/plans.js +43 -0
  159. package/resources/v1/customers/plans.js.map +1 -1
  160. package/resources/v1/customers/plans.mjs +43 -0
  161. package/resources/v1/customers/plans.mjs.map +1 -1
  162. package/resources/v1/dashboards.d.ts +30 -2
  163. package/resources/v1/dashboards.d.ts.map +1 -1
  164. package/resources/v1/dashboards.js +26 -0
  165. package/resources/v1/dashboards.js.map +1 -1
  166. package/resources/v1/dashboards.mjs +26 -0
  167. package/resources/v1/dashboards.mjs.map +1 -1
  168. package/resources/v1/index.d.ts +3 -3
  169. package/resources/v1/index.d.ts.map +1 -1
  170. package/resources/v1/index.js.map +1 -1
  171. package/resources/v1/index.mjs.map +1 -1
  172. package/resources/v1/invoices.d.ts +14 -0
  173. package/resources/v1/invoices.d.ts.map +1 -1
  174. package/resources/v1/invoices.js +14 -0
  175. package/resources/v1/invoices.js.map +1 -1
  176. package/resources/v1/invoices.mjs +14 -0
  177. package/resources/v1/invoices.mjs.map +1 -1
  178. package/resources/v1/plans.d.ts +47 -4
  179. package/resources/v1/plans.d.ts.map +1 -1
  180. package/resources/v1/plans.js +27 -0
  181. package/resources/v1/plans.js.map +1 -1
  182. package/resources/v1/plans.mjs +27 -0
  183. package/resources/v1/plans.mjs.map +1 -1
  184. package/resources/v1/pricing-units.d.ts +8 -0
  185. package/resources/v1/pricing-units.d.ts.map +1 -1
  186. package/resources/v1/pricing-units.js.map +1 -1
  187. package/resources/v1/pricing-units.mjs.map +1 -1
  188. package/resources/v1/services.d.ts +5 -0
  189. package/resources/v1/services.d.ts.map +1 -1
  190. package/resources/v1/services.js +5 -0
  191. package/resources/v1/services.js.map +1 -1
  192. package/resources/v1/services.mjs +5 -0
  193. package/resources/v1/services.mjs.map +1 -1
  194. package/resources/v1/usage.d.ts +161 -3
  195. package/resources/v1/usage.d.ts.map +1 -1
  196. package/resources/v1/usage.js +46 -0
  197. package/resources/v1/usage.js.map +1 -1
  198. package/resources/v1/usage.mjs +46 -0
  199. package/resources/v1/usage.mjs.map +1 -1
  200. package/resources/v1/v1.d.ts +6 -6
  201. package/resources/v1/v1.d.ts.map +1 -1
  202. package/resources/v1/v1.js.map +1 -1
  203. package/resources/v1/v1.mjs.map +1 -1
  204. package/resources/v2/contracts.d.ts +2923 -207
  205. package/resources/v2/contracts.d.ts.map +1 -1
  206. package/resources/v2/contracts.js +90 -2
  207. package/resources/v2/contracts.js.map +1 -1
  208. package/resources/v2/contracts.mjs +90 -2
  209. package/resources/v2/contracts.mjs.map +1 -1
  210. package/resources/webhooks.js +5 -5
  211. package/resources/webhooks.js.map +1 -1
  212. package/resources/webhooks.mjs +5 -5
  213. package/resources/webhooks.mjs.map +1 -1
  214. package/src/_shims/auto/runtime-bun.ts +1 -1
  215. package/src/_shims/auto/runtime-node.ts +1 -1
  216. package/src/_shims/auto/runtime.ts +1 -1
  217. package/src/_shims/auto/types-node.ts +1 -1
  218. package/src/_shims/bun-runtime.ts +2 -2
  219. package/src/_shims/index.d.ts +5 -3
  220. package/src/_shims/index.js +5 -1
  221. package/src/_shims/index.mjs +6 -2
  222. package/src/_shims/node-runtime.ts +3 -3
  223. package/src/_shims/registry.ts +1 -1
  224. package/src/_shims/web-runtime.ts +3 -3
  225. package/src/core.ts +46 -18
  226. package/src/error.ts +1 -1
  227. package/src/index.ts +22 -16
  228. package/src/internal/qs/formats.ts +1 -1
  229. package/src/internal/qs/index.ts +3 -3
  230. package/src/internal/qs/stringify.ts +3 -3
  231. package/src/internal/qs/utils.ts +2 -2
  232. package/src/pagination.ts +5 -1
  233. package/src/resource.ts +2 -2
  234. package/src/resources/index.ts +4 -4
  235. package/src/resources/shared.ts +539 -40
  236. package/src/resources/v1/alerts.ts +29 -5
  237. package/src/resources/v1/audit-logs.ts +12 -4
  238. package/src/resources/v1/billable-metrics.ts +57 -8
  239. package/src/resources/v1/contracts/contracts.ts +1643 -124
  240. package/src/resources/v1/contracts/index.ts +8 -4
  241. package/src/resources/v1/contracts/named-schedules.ts +23 -2
  242. package/src/resources/v1/contracts/products.ts +53 -9
  243. package/src/resources/v1/contracts/rate-cards/index.ts +6 -4
  244. package/src/resources/v1/contracts/rate-cards/named-schedules.ts +27 -2
  245. package/src/resources/v1/contracts/rate-cards/product-orders.ts +33 -3
  246. package/src/resources/v1/contracts/rate-cards/rate-cards.ts +113 -20
  247. package/src/resources/v1/contracts/rate-cards/rates.ts +86 -18
  248. package/src/resources/v1/contracts/rate-cards.ts +1 -1
  249. package/src/resources/v1/contracts.ts +1 -1
  250. package/src/resources/v1/credit-grants.ts +82 -10
  251. package/src/resources/v1/custom-fields.ts +57 -9
  252. package/src/resources/v1/customers/alerts.ts +32 -3
  253. package/src/resources/v1/customers/billing-config.ts +34 -2
  254. package/src/resources/v1/customers/commits.ts +97 -10
  255. package/src/resources/v1/customers/credits.ts +76 -6
  256. package/src/resources/v1/customers/customers.ts +208 -27
  257. package/src/resources/v1/customers/index.ts +10 -8
  258. package/src/resources/v1/customers/invoices.ts +123 -57
  259. package/src/resources/v1/customers/named-schedules.ts +23 -2
  260. package/src/resources/v1/customers/plans.ts +48 -5
  261. package/src/resources/v1/customers.ts +1 -1
  262. package/src/resources/v1/dashboards.ts +30 -4
  263. package/src/resources/v1/index.ts +20 -14
  264. package/src/resources/v1/invoices.ts +16 -2
  265. package/src/resources/v1/plans.ts +45 -10
  266. package/src/resources/v1/pricing-units.ts +12 -4
  267. package/src/resources/v1/services.ts +7 -2
  268. package/src/resources/v1/usage.ts +187 -6
  269. package/src/resources/v1/v1.ts +39 -27
  270. package/src/resources/v1.ts +1 -1
  271. package/src/resources/v2/contracts.ts +3397 -235
  272. package/src/resources/v2/index.ts +2 -2
  273. package/src/resources/v2/v2.ts +3 -3
  274. package/src/resources/v2.ts +1 -1
  275. package/src/resources/webhooks.ts +7 -7
  276. package/src/resources.ts +1 -1
  277. package/src/shims/node.ts +3 -3
  278. package/src/shims/web.ts +3 -3
  279. package/src/uploads.ts +4 -4
  280. package/src/version.ts +1 -1
  281. package/version.d.ts +1 -1
  282. package/version.d.ts.map +1 -1
  283. package/version.js +1 -1
  284. package/version.js.map +1 -1
  285. package/version.mjs +1 -1
  286. package/version.mjs.map +1 -1
@@ -7,58 +7,233 @@ import * as ProductsAPI from "./products.js";
7
7
  import { ProductArchiveParams, ProductArchiveResponse, ProductCreateParams, ProductCreateResponse, ProductListItemState, ProductListParams, ProductListResponse, ProductListResponsesCursorPage, ProductRetrieveParams, ProductRetrieveResponse, ProductUpdateParams, ProductUpdateResponse, Products, QuantityConversion, QuantityRounding } from "./products.js";
8
8
  import * as InvoicesAPI from "../customers/invoices.js";
9
9
  import * as RateCardsAPI from "./rate-cards/rate-cards.js";
10
- import { RateCardCreateParams, RateCardCreateResponse, RateCardListParams, RateCardListResponse, RateCardListResponsesCursorPage, RateCardRetrieveParams, RateCardRetrieveRateScheduleParams, RateCardRetrieveRateScheduleResponse, RateCardRetrieveResponse, RateCardUpdateParams, RateCardUpdateResponse, RateCards } from "./rate-cards/rate-cards.js";
10
+ import { RateCardArchiveParams, RateCardArchiveResponse, RateCardCreateParams, RateCardCreateResponse, RateCardListParams, RateCardListResponse, RateCardListResponsesCursorPage, RateCardRetrieveParams, RateCardRetrieveRateScheduleParams, RateCardRetrieveRateScheduleResponse, RateCardRetrieveResponse, RateCardUpdateParams, RateCardUpdateResponse, RateCards } from "./rate-cards/rate-cards.js";
11
11
  export declare class Contracts extends APIResource {
12
12
  products: ProductsAPI.Products;
13
13
  rateCards: RateCardsAPI.RateCards;
14
14
  namedSchedules: NamedSchedulesAPI.NamedSchedules;
15
15
  /**
16
16
  * Create a new contract
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const contract = await client.v1.contracts.create({
21
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
22
+ * starting_at: '2020-01-01T00:00:00.000Z',
23
+ * billing_provider_configuration: {
24
+ * billing_provider: 'stripe',
25
+ * delivery_method: 'direct_to_billing_provider',
26
+ * },
27
+ * rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
28
+ * });
29
+ * ```
17
30
  */
18
31
  create(body: ContractCreateParams, options?: Core.RequestOptions): Core.APIPromise<ContractCreateResponse>;
19
32
  /**
20
- * Get a specific contract
33
+ * This is the v1 endpoint to get a contract. New clients should implement using
34
+ * the v2 endpoint.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const contract = await client.v1.contracts.retrieve({
39
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
40
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
41
+ * });
42
+ * ```
21
43
  */
22
44
  retrieve(body: ContractRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<ContractRetrieveResponse>;
23
45
  /**
24
- * List all contracts for a customer
46
+ * This is the v1 endpoint to list all contracts for a customer. New clients should
47
+ * implement using the v2 endpoint.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const contracts = await client.v1.contracts.list({
52
+ * customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
53
+ * });
54
+ * ```
25
55
  */
26
56
  list(body: ContractListParams, options?: Core.RequestOptions): Core.APIPromise<ContractListResponse>;
27
57
  /**
28
58
  * Add a manual balance entry
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * await client.v1.contracts.addManualBalanceEntry({
63
+ * id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
64
+ * amount: -1000,
65
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
66
+ * reason: 'Reason for entry',
67
+ * segment_id: '66368e29-3f97-4d15-a6e9-120897f0070a',
68
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
69
+ * });
70
+ * ```
29
71
  */
30
72
  addManualBalanceEntry(body: ContractAddManualBalanceEntryParams, options?: Core.RequestOptions): Core.APIPromise<void>;
31
73
  /**
32
- * Amend a contract
74
+ * Amendments will be replaced by Contract editing. New clients should implement
75
+ * using the editContract endpoint. Read more about the migration to contract
76
+ * editing [here](https://docs.metronome.com/migrate-amendments-to-edits/) and
77
+ * reach out to your Metronome representative for more details. Once contract
78
+ * editing is enabled, access to this endpoint will be removed.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const response = await client.v1.contracts.amend({
83
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
84
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
85
+ * starting_at: '2020-01-01T00:00:00.000Z',
86
+ * });
87
+ * ```
33
88
  */
34
89
  amend(body: ContractAmendParams, options?: Core.RequestOptions): Core.APIPromise<ContractAmendResponse>;
35
90
  /**
36
91
  * Archive a contract
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * const response = await client.v1.contracts.archive({
96
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
97
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
98
+ * void_invoices: true,
99
+ * });
100
+ * ```
37
101
  */
38
102
  archive(body: ContractArchiveParams, options?: Core.RequestOptions): Core.APIPromise<ContractArchiveResponse>;
39
103
  /**
40
104
  * Creates historical usage invoices for a contract
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * const response =
109
+ * await client.v1.contracts.createHistoricalInvoices({
110
+ * invoices: [
111
+ * {
112
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
113
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
114
+ * credit_type_id:
115
+ * '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
116
+ * inclusive_start_date: '2020-01-01T00:00:00.000Z',
117
+ * exclusive_end_date: '2020-02-01T00:00:00.000Z',
118
+ * issue_date: '2020-02-01T00:00:00.000Z',
119
+ * usage_line_items: [
120
+ * {
121
+ * product_id:
122
+ * 'f14d6729-6a44-4b13-9908-9387f1918790',
123
+ * inclusive_start_date:
124
+ * '2020-01-01T00:00:00.000Z',
125
+ * exclusive_end_date: '2020-02-01T00:00:00.000Z',
126
+ * quantity: 100,
127
+ * },
128
+ * ],
129
+ * },
130
+ * ],
131
+ * preview: false,
132
+ * });
133
+ * ```
41
134
  */
42
135
  createHistoricalInvoices(body: ContractCreateHistoricalInvoicesParams, options?: Core.RequestOptions): Core.APIPromise<ContractCreateHistoricalInvoicesResponse>;
43
136
  /**
44
137
  * List balances (commits and credits).
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const response = await client.v1.contracts.listBalances({
142
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
143
+ * id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
144
+ * include_ledgers: true,
145
+ * });
146
+ * ```
45
147
  */
46
148
  listBalances(body: ContractListBalancesParams, options?: Core.RequestOptions): Core.APIPromise<ContractListBalancesResponse>;
47
149
  /**
48
150
  * Get the rate schedule for the rate card on a given contract.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * const response =
155
+ * await client.v1.contracts.retrieveRateSchedule({
156
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
157
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
158
+ * at: '2020-01-01T00:00:00.000Z',
159
+ * selectors: [
160
+ * {
161
+ * product_id: 'd6300dbb-882e-4d2d-8dec-5125d16b65d0',
162
+ * partial_pricing_group_values: {
163
+ * region: 'us-west-2',
164
+ * cloud: 'aws',
165
+ * },
166
+ * },
167
+ * ],
168
+ * });
169
+ * ```
49
170
  */
50
171
  retrieveRateSchedule(params: ContractRetrieveRateScheduleParams, options?: Core.RequestOptions): Core.APIPromise<ContractRetrieveRateScheduleResponse>;
172
+ /**
173
+ * Fetch the quantity and price for a subscription over time. End-point does not
174
+ * return future scheduled changes.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * const response =
179
+ * await client.v1.contracts.retrieveSubscriptionQuantityHistory(
180
+ * {
181
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
182
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
183
+ * subscription_id:
184
+ * '1a824d53-bde6-4d82-96d7-6347ff227d5c',
185
+ * },
186
+ * );
187
+ * ```
188
+ */
189
+ retrieveSubscriptionQuantityHistory(body: ContractRetrieveSubscriptionQuantityHistoryParams, options?: Core.RequestOptions): Core.APIPromise<ContractRetrieveSubscriptionQuantityHistoryResponse>;
51
190
  /**
52
191
  * Create a new scheduled invoice for Professional Services terms on a contract.
53
192
  * This endpoint's availability is dependent on your client's configuration.
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * const response =
197
+ * await client.v1.contracts.scheduleProServicesInvoice({
198
+ * contract_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
199
+ * customer_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
200
+ * issued_at: '2019-12-27T18:11:19.117Z',
201
+ * line_items: [
202
+ * {
203
+ * professional_service_id:
204
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
205
+ * },
206
+ * ],
207
+ * });
208
+ * ```
54
209
  */
55
210
  scheduleProServicesInvoice(body: ContractScheduleProServicesInvoiceParams, options?: Core.RequestOptions): Core.APIPromise<ContractScheduleProServicesInvoiceResponse>;
56
211
  /**
57
212
  * Set usage filter for a contract
213
+ *
214
+ * @example
215
+ * ```ts
216
+ * await client.v1.contracts.setUsageFilter({
217
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
218
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
219
+ * group_key: 'business_subscription_id',
220
+ * group_values: ['ID-1', 'ID-2'],
221
+ * starting_at: '2020-01-01T00:00:00.000Z',
222
+ * });
223
+ * ```
58
224
  */
59
225
  setUsageFilter(body: ContractSetUsageFilterParams, options?: Core.RequestOptions): Core.APIPromise<void>;
60
226
  /**
61
227
  * Update the end date of a contract
228
+ *
229
+ * @example
230
+ * ```ts
231
+ * const response = await client.v1.contracts.updateEndDate({
232
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
233
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
234
+ * ending_before: '2020-01-01T00:00:00.000Z',
235
+ * });
236
+ * ```
62
237
  */
63
238
  updateEndDate(body: ContractUpdateEndDateParams, options?: Core.RequestOptions): Core.APIPromise<ContractUpdateEndDateResponse>;
64
239
  }
@@ -80,11 +255,18 @@ export declare namespace ContractRetrieveResponse {
80
255
  * the contract is not archived.
81
256
  */
82
257
  archived_at?: string;
83
- custom_fields?: Record<string, string>;
258
+ custom_fields?: {
259
+ [key: string]: string;
260
+ };
84
261
  /**
85
262
  * The billing provider configuration associated with a contract.
86
263
  */
87
264
  customer_billing_provider_configuration?: Data.CustomerBillingProviderConfiguration;
265
+ prepaid_balance_threshold_configuration?: Data.PrepaidBalanceThresholdConfiguration;
266
+ /**
267
+ * Priority of the contract.
268
+ */
269
+ priority?: number;
88
270
  /**
89
271
  * Determines which scheduled and commit charges to consolidate onto the Contract's
90
272
  * usage invoice. The charge's `timestamp` must match the usage invoice's
@@ -93,6 +275,10 @@ export declare namespace ContractRetrieveResponse {
93
275
  * on a separate invoice from usage charges.
94
276
  */
95
277
  scheduled_charges_on_usage_invoices?: 'ALL';
278
+ spend_threshold_configuration?: Data.SpendThresholdConfiguration;
279
+ /**
280
+ * List of subscriptions on the contract.
281
+ */
96
282
  subscriptions?: Array<Data.Subscription>;
97
283
  /**
98
284
  * Prevents the creation of duplicates. If a request to create a record is made
@@ -158,16 +344,246 @@ export declare namespace ContractRetrieveResponse {
158
344
  * Configuration for the billing provider. The structure of this object is specific
159
345
  * to the billing provider.
160
346
  */
161
- configuration?: Record<string, unknown>;
347
+ configuration?: {
348
+ [key: string]: unknown;
349
+ };
350
+ }
351
+ interface PrepaidBalanceThresholdConfiguration {
352
+ commit: PrepaidBalanceThresholdConfiguration.Commit;
353
+ /**
354
+ * When set to false, the contract will not be evaluated against the
355
+ * threshold_amount. Toggling to true will result an immediate evaluation,
356
+ * regardless of prior state.
357
+ */
358
+ is_enabled: boolean;
359
+ payment_gate_config: PrepaidBalanceThresholdConfiguration.PaymentGateConfig;
360
+ /**
361
+ * Specify the amount the balance should be recharged to.
362
+ */
363
+ recharge_to_amount: number;
364
+ /**
365
+ * Specify the threshold amount for the contract. Each time the contract's prepaid
366
+ * balance lowers to this amount, a threshold charge will be initiated.
367
+ */
368
+ threshold_amount: number;
369
+ /**
370
+ * If provided, the threshold, recharge-to amount, and the resulting threshold
371
+ * commit amount will be in terms of this credit type instead of the fiat currency.
372
+ */
373
+ custom_credit_type_id?: string;
374
+ }
375
+ namespace PrepaidBalanceThresholdConfiguration {
376
+ interface Commit {
377
+ /**
378
+ * The commit product that will be used to generate the line item for commit
379
+ * payment.
380
+ */
381
+ product_id: string;
382
+ /**
383
+ * Which products the threshold commit applies to. If applicable_product_ids,
384
+ * applicable_product_tags or specifiers are not provided, the commit applies to
385
+ * all products.
386
+ */
387
+ applicable_product_ids?: Array<string>;
388
+ /**
389
+ * Which tags the threshold commit applies to. If applicable_product_ids,
390
+ * applicable_product_tags or specifiers are not provided, the commit applies to
391
+ * all products.
392
+ */
393
+ applicable_product_tags?: Array<string>;
394
+ description?: string;
395
+ /**
396
+ * Specify the name of the line item for the threshold charge. If left blank, it
397
+ * will default to the commit product name.
398
+ */
399
+ name?: string;
400
+ /**
401
+ * List of filters that determine what kind of customer usage draws down a commit
402
+ * or credit. A customer's usage needs to meet the condition of at least one of the
403
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
404
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
405
+ */
406
+ specifiers?: Array<Commit.Specifier>;
407
+ }
408
+ namespace Commit {
409
+ interface Specifier {
410
+ presentation_group_values?: {
411
+ [key: string]: string;
412
+ };
413
+ pricing_group_values?: {
414
+ [key: string]: string;
415
+ };
416
+ /**
417
+ * If provided, the specifier will only apply to the product with the specified ID.
418
+ */
419
+ product_id?: string;
420
+ /**
421
+ * If provided, the specifier will only apply to products with all the specified
422
+ * tags.
423
+ */
424
+ product_tags?: Array<string>;
425
+ }
426
+ }
427
+ interface PaymentGateConfig {
428
+ /**
429
+ * Gate access to the commit balance based on successful collection of payment.
430
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
431
+ * facilitate payment using your own payment integration. Select NONE if you do not
432
+ * wish to payment gate the commit balance.
433
+ */
434
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
435
+ /**
436
+ * Only applicable if using PRECALCULATED as your tax type.
437
+ */
438
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
439
+ /**
440
+ * Only applicable if using STRIPE as your payment gate type.
441
+ */
442
+ stripe_config?: PaymentGateConfig.StripeConfig;
443
+ /**
444
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
445
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
446
+ * will default to NONE.
447
+ */
448
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
449
+ }
450
+ namespace PaymentGateConfig {
451
+ /**
452
+ * Only applicable if using PRECALCULATED as your tax type.
453
+ */
454
+ interface PrecalculatedTaxConfig {
455
+ /**
456
+ * Amount of tax to be applied. This should be in the same currency and
457
+ * denomination as the commit's invoice schedule
458
+ */
459
+ tax_amount: number;
460
+ /**
461
+ * Name of the tax to be applied. This may be used in an invoice line item
462
+ * description.
463
+ */
464
+ tax_name?: string;
465
+ }
466
+ /**
467
+ * Only applicable if using STRIPE as your payment gate type.
468
+ */
469
+ interface StripeConfig {
470
+ /**
471
+ * If left blank, will default to INVOICE
472
+ */
473
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
474
+ /**
475
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
476
+ * your payment type.
477
+ */
478
+ invoice_metadata?: {
479
+ [key: string]: string;
480
+ };
481
+ }
482
+ }
483
+ }
484
+ interface SpendThresholdConfiguration {
485
+ commit: SpendThresholdConfiguration.Commit;
486
+ /**
487
+ * When set to false, the contract will not be evaluated against the
488
+ * threshold_amount. Toggling to true will result an immediate evaluation,
489
+ * regardless of prior state.
490
+ */
491
+ is_enabled: boolean;
492
+ payment_gate_config: SpendThresholdConfiguration.PaymentGateConfig;
493
+ /**
494
+ * Specify the threshold amount for the contract. Each time the contract's usage
495
+ * hits this amount, a threshold charge will be initiated.
496
+ */
497
+ threshold_amount: number;
498
+ }
499
+ namespace SpendThresholdConfiguration {
500
+ interface Commit {
501
+ /**
502
+ * The commit product that will be used to generate the line item for commit
503
+ * payment.
504
+ */
505
+ product_id: string;
506
+ description?: string;
507
+ /**
508
+ * Specify the name of the line item for the threshold charge. If left blank, it
509
+ * will default to the commit product name.
510
+ */
511
+ name?: string;
512
+ }
513
+ interface PaymentGateConfig {
514
+ /**
515
+ * Gate access to the commit balance based on successful collection of payment.
516
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
517
+ * facilitate payment using your own payment integration. Select NONE if you do not
518
+ * wish to payment gate the commit balance.
519
+ */
520
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
521
+ /**
522
+ * Only applicable if using PRECALCULATED as your tax type.
523
+ */
524
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
525
+ /**
526
+ * Only applicable if using STRIPE as your payment gate type.
527
+ */
528
+ stripe_config?: PaymentGateConfig.StripeConfig;
529
+ /**
530
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
531
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
532
+ * will default to NONE.
533
+ */
534
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
535
+ }
536
+ namespace PaymentGateConfig {
537
+ /**
538
+ * Only applicable if using PRECALCULATED as your tax type.
539
+ */
540
+ interface PrecalculatedTaxConfig {
541
+ /**
542
+ * Amount of tax to be applied. This should be in the same currency and
543
+ * denomination as the commit's invoice schedule
544
+ */
545
+ tax_amount: number;
546
+ /**
547
+ * Name of the tax to be applied. This may be used in an invoice line item
548
+ * description.
549
+ */
550
+ tax_name?: string;
551
+ }
552
+ /**
553
+ * Only applicable if using STRIPE as your payment gate type.
554
+ */
555
+ interface StripeConfig {
556
+ /**
557
+ * If left blank, will default to INVOICE
558
+ */
559
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
560
+ /**
561
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
562
+ * your payment type.
563
+ */
564
+ invoice_metadata?: {
565
+ [key: string]: string;
566
+ };
567
+ }
568
+ }
162
569
  }
163
570
  interface Subscription {
164
571
  collection_schedule: 'ADVANCE' | 'ARREARS';
165
572
  proration: Subscription.Proration;
573
+ /**
574
+ * List of quantity schedule items for the subscription. Only includes the current
575
+ * quantity and future quantity changes.
576
+ */
166
577
  quantity_schedule: Array<Subscription.QuantitySchedule>;
167
578
  starting_at: string;
168
579
  subscription_rate: Subscription.SubscriptionRate;
580
+ id?: string;
581
+ custom_fields?: {
582
+ [key: string]: string;
583
+ };
169
584
  description?: string;
170
585
  ending_before?: string;
586
+ fiat_credit_type_id?: string;
171
587
  name?: string;
172
588
  }
173
589
  namespace Subscription {
@@ -181,7 +597,7 @@ export declare namespace ContractRetrieveResponse {
181
597
  ending_before?: string;
182
598
  }
183
599
  interface SubscriptionRate {
184
- billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
600
+ billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
185
601
  product: SubscriptionRate.Product;
186
602
  }
187
603
  namespace SubscriptionRate {
@@ -208,11 +624,18 @@ export declare namespace ContractListResponse {
208
624
  * the contract is not archived.
209
625
  */
210
626
  archived_at?: string;
211
- custom_fields?: Record<string, string>;
627
+ custom_fields?: {
628
+ [key: string]: string;
629
+ };
212
630
  /**
213
631
  * The billing provider configuration associated with a contract.
214
632
  */
215
633
  customer_billing_provider_configuration?: Data.CustomerBillingProviderConfiguration;
634
+ prepaid_balance_threshold_configuration?: Data.PrepaidBalanceThresholdConfiguration;
635
+ /**
636
+ * Priority of the contract.
637
+ */
638
+ priority?: number;
216
639
  /**
217
640
  * Determines which scheduled and commit charges to consolidate onto the Contract's
218
641
  * usage invoice. The charge's `timestamp` must match the usage invoice's
@@ -221,6 +644,10 @@ export declare namespace ContractListResponse {
221
644
  * on a separate invoice from usage charges.
222
645
  */
223
646
  scheduled_charges_on_usage_invoices?: 'ALL';
647
+ spend_threshold_configuration?: Data.SpendThresholdConfiguration;
648
+ /**
649
+ * List of subscriptions on the contract.
650
+ */
224
651
  subscriptions?: Array<Data.Subscription>;
225
652
  /**
226
653
  * Prevents the creation of duplicates. If a request to create a record is made
@@ -286,16 +713,246 @@ export declare namespace ContractListResponse {
286
713
  * Configuration for the billing provider. The structure of this object is specific
287
714
  * to the billing provider.
288
715
  */
289
- configuration?: Record<string, unknown>;
716
+ configuration?: {
717
+ [key: string]: unknown;
718
+ };
719
+ }
720
+ interface PrepaidBalanceThresholdConfiguration {
721
+ commit: PrepaidBalanceThresholdConfiguration.Commit;
722
+ /**
723
+ * When set to false, the contract will not be evaluated against the
724
+ * threshold_amount. Toggling to true will result an immediate evaluation,
725
+ * regardless of prior state.
726
+ */
727
+ is_enabled: boolean;
728
+ payment_gate_config: PrepaidBalanceThresholdConfiguration.PaymentGateConfig;
729
+ /**
730
+ * Specify the amount the balance should be recharged to.
731
+ */
732
+ recharge_to_amount: number;
733
+ /**
734
+ * Specify the threshold amount for the contract. Each time the contract's prepaid
735
+ * balance lowers to this amount, a threshold charge will be initiated.
736
+ */
737
+ threshold_amount: number;
738
+ /**
739
+ * If provided, the threshold, recharge-to amount, and the resulting threshold
740
+ * commit amount will be in terms of this credit type instead of the fiat currency.
741
+ */
742
+ custom_credit_type_id?: string;
743
+ }
744
+ namespace PrepaidBalanceThresholdConfiguration {
745
+ interface Commit {
746
+ /**
747
+ * The commit product that will be used to generate the line item for commit
748
+ * payment.
749
+ */
750
+ product_id: string;
751
+ /**
752
+ * Which products the threshold commit applies to. If applicable_product_ids,
753
+ * applicable_product_tags or specifiers are not provided, the commit applies to
754
+ * all products.
755
+ */
756
+ applicable_product_ids?: Array<string>;
757
+ /**
758
+ * Which tags the threshold commit applies to. If applicable_product_ids,
759
+ * applicable_product_tags or specifiers are not provided, the commit applies to
760
+ * all products.
761
+ */
762
+ applicable_product_tags?: Array<string>;
763
+ description?: string;
764
+ /**
765
+ * Specify the name of the line item for the threshold charge. If left blank, it
766
+ * will default to the commit product name.
767
+ */
768
+ name?: string;
769
+ /**
770
+ * List of filters that determine what kind of customer usage draws down a commit
771
+ * or credit. A customer's usage needs to meet the condition of at least one of the
772
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
773
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
774
+ */
775
+ specifiers?: Array<Commit.Specifier>;
776
+ }
777
+ namespace Commit {
778
+ interface Specifier {
779
+ presentation_group_values?: {
780
+ [key: string]: string;
781
+ };
782
+ pricing_group_values?: {
783
+ [key: string]: string;
784
+ };
785
+ /**
786
+ * If provided, the specifier will only apply to the product with the specified ID.
787
+ */
788
+ product_id?: string;
789
+ /**
790
+ * If provided, the specifier will only apply to products with all the specified
791
+ * tags.
792
+ */
793
+ product_tags?: Array<string>;
794
+ }
795
+ }
796
+ interface PaymentGateConfig {
797
+ /**
798
+ * Gate access to the commit balance based on successful collection of payment.
799
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
800
+ * facilitate payment using your own payment integration. Select NONE if you do not
801
+ * wish to payment gate the commit balance.
802
+ */
803
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
804
+ /**
805
+ * Only applicable if using PRECALCULATED as your tax type.
806
+ */
807
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
808
+ /**
809
+ * Only applicable if using STRIPE as your payment gate type.
810
+ */
811
+ stripe_config?: PaymentGateConfig.StripeConfig;
812
+ /**
813
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
814
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
815
+ * will default to NONE.
816
+ */
817
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
818
+ }
819
+ namespace PaymentGateConfig {
820
+ /**
821
+ * Only applicable if using PRECALCULATED as your tax type.
822
+ */
823
+ interface PrecalculatedTaxConfig {
824
+ /**
825
+ * Amount of tax to be applied. This should be in the same currency and
826
+ * denomination as the commit's invoice schedule
827
+ */
828
+ tax_amount: number;
829
+ /**
830
+ * Name of the tax to be applied. This may be used in an invoice line item
831
+ * description.
832
+ */
833
+ tax_name?: string;
834
+ }
835
+ /**
836
+ * Only applicable if using STRIPE as your payment gate type.
837
+ */
838
+ interface StripeConfig {
839
+ /**
840
+ * If left blank, will default to INVOICE
841
+ */
842
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
843
+ /**
844
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
845
+ * your payment type.
846
+ */
847
+ invoice_metadata?: {
848
+ [key: string]: string;
849
+ };
850
+ }
851
+ }
852
+ }
853
+ interface SpendThresholdConfiguration {
854
+ commit: SpendThresholdConfiguration.Commit;
855
+ /**
856
+ * When set to false, the contract will not be evaluated against the
857
+ * threshold_amount. Toggling to true will result an immediate evaluation,
858
+ * regardless of prior state.
859
+ */
860
+ is_enabled: boolean;
861
+ payment_gate_config: SpendThresholdConfiguration.PaymentGateConfig;
862
+ /**
863
+ * Specify the threshold amount for the contract. Each time the contract's usage
864
+ * hits this amount, a threshold charge will be initiated.
865
+ */
866
+ threshold_amount: number;
867
+ }
868
+ namespace SpendThresholdConfiguration {
869
+ interface Commit {
870
+ /**
871
+ * The commit product that will be used to generate the line item for commit
872
+ * payment.
873
+ */
874
+ product_id: string;
875
+ description?: string;
876
+ /**
877
+ * Specify the name of the line item for the threshold charge. If left blank, it
878
+ * will default to the commit product name.
879
+ */
880
+ name?: string;
881
+ }
882
+ interface PaymentGateConfig {
883
+ /**
884
+ * Gate access to the commit balance based on successful collection of payment.
885
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
886
+ * facilitate payment using your own payment integration. Select NONE if you do not
887
+ * wish to payment gate the commit balance.
888
+ */
889
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
890
+ /**
891
+ * Only applicable if using PRECALCULATED as your tax type.
892
+ */
893
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
894
+ /**
895
+ * Only applicable if using STRIPE as your payment gate type.
896
+ */
897
+ stripe_config?: PaymentGateConfig.StripeConfig;
898
+ /**
899
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
900
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
901
+ * will default to NONE.
902
+ */
903
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
904
+ }
905
+ namespace PaymentGateConfig {
906
+ /**
907
+ * Only applicable if using PRECALCULATED as your tax type.
908
+ */
909
+ interface PrecalculatedTaxConfig {
910
+ /**
911
+ * Amount of tax to be applied. This should be in the same currency and
912
+ * denomination as the commit's invoice schedule
913
+ */
914
+ tax_amount: number;
915
+ /**
916
+ * Name of the tax to be applied. This may be used in an invoice line item
917
+ * description.
918
+ */
919
+ tax_name?: string;
920
+ }
921
+ /**
922
+ * Only applicable if using STRIPE as your payment gate type.
923
+ */
924
+ interface StripeConfig {
925
+ /**
926
+ * If left blank, will default to INVOICE
927
+ */
928
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
929
+ /**
930
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
931
+ * your payment type.
932
+ */
933
+ invoice_metadata?: {
934
+ [key: string]: string;
935
+ };
936
+ }
937
+ }
290
938
  }
291
939
  interface Subscription {
292
940
  collection_schedule: 'ADVANCE' | 'ARREARS';
293
941
  proration: Subscription.Proration;
942
+ /**
943
+ * List of quantity schedule items for the subscription. Only includes the current
944
+ * quantity and future quantity changes.
945
+ */
294
946
  quantity_schedule: Array<Subscription.QuantitySchedule>;
295
947
  starting_at: string;
296
948
  subscription_rate: Subscription.SubscriptionRate;
949
+ id?: string;
950
+ custom_fields?: {
951
+ [key: string]: string;
952
+ };
297
953
  description?: string;
298
954
  ending_before?: string;
955
+ fiat_credit_type_id?: string;
299
956
  name?: string;
300
957
  }
301
958
  namespace Subscription {
@@ -309,7 +966,7 @@ export declare namespace ContractListResponse {
309
966
  ending_before?: string;
310
967
  }
311
968
  interface SubscriptionRate {
312
- billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
969
+ billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
313
970
  product: SubscriptionRate.Product;
314
971
  }
315
972
  namespace SubscriptionRate {
@@ -342,13 +999,15 @@ export declare namespace ContractRetrieveRateScheduleResponse {
342
999
  interface Data {
343
1000
  entitled: boolean;
344
1001
  list_rate: Shared.Rate;
345
- product_custom_fields: Record<string, string>;
1002
+ product_custom_fields: {
1003
+ [key: string]: string;
1004
+ };
346
1005
  product_id: string;
347
1006
  product_name: string;
348
1007
  product_tags: Array<string>;
349
1008
  rate_card_id: string;
350
1009
  starting_at: string;
351
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
1010
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
352
1011
  /**
353
1012
  * A distinct rate on the rate card. You can choose to use this rate rather than
354
1013
  * list rate when consuming a credit or commit.
@@ -356,7 +1015,9 @@ export declare namespace ContractRetrieveRateScheduleResponse {
356
1015
  commit_rate?: Data.CommitRate;
357
1016
  ending_before?: string;
358
1017
  override_rate?: Shared.Rate;
359
- pricing_group_values?: Record<string, string>;
1018
+ pricing_group_values?: {
1019
+ [key: string]: string;
1020
+ };
360
1021
  }
361
1022
  namespace Data {
362
1023
  /**
@@ -376,6 +1037,29 @@ export declare namespace ContractRetrieveRateScheduleResponse {
376
1037
  }
377
1038
  }
378
1039
  }
1040
+ export interface ContractRetrieveSubscriptionQuantityHistoryResponse {
1041
+ data: ContractRetrieveSubscriptionQuantityHistoryResponse.Data;
1042
+ }
1043
+ export declare namespace ContractRetrieveSubscriptionQuantityHistoryResponse {
1044
+ interface Data {
1045
+ fiat_credit_type_id?: string;
1046
+ history?: Array<Data.History>;
1047
+ subscription_id?: string;
1048
+ }
1049
+ namespace Data {
1050
+ interface History {
1051
+ data: Array<History.Data>;
1052
+ starting_at: string;
1053
+ }
1054
+ namespace History {
1055
+ interface Data {
1056
+ quantity: number;
1057
+ total: number;
1058
+ unit_price: number;
1059
+ }
1060
+ }
1061
+ }
1062
+ }
379
1063
  export interface ContractScheduleProServicesInvoiceResponse {
380
1064
  data: Array<InvoicesAPI.Invoice>;
381
1065
  }
@@ -389,12 +1073,15 @@ export interface ContractCreateParams {
389
1073
  */
390
1074
  starting_at: string;
391
1075
  /**
392
- * The billing provider configuration associated with a contract.
1076
+ * The billing provider configuration associated with a contract. Provide either an
1077
+ * ID or the provider and delivery method.
393
1078
  */
394
1079
  billing_provider_configuration?: ContractCreateParams.BillingProviderConfiguration;
395
1080
  commits?: Array<ContractCreateParams.Commit>;
396
1081
  credits?: Array<ContractCreateParams.Credit>;
397
- custom_fields?: Record<string, string>;
1082
+ custom_fields?: {
1083
+ [key: string]: string;
1084
+ };
398
1085
  /**
399
1086
  * This field's availability is dependent on your client's configuration.
400
1087
  */
@@ -403,6 +1090,7 @@ export interface ContractCreateParams {
403
1090
  * exclusive contract end time
404
1091
  */
405
1092
  ending_before?: string;
1093
+ hierarchy_configuration?: ContractCreateParams.HierarchyConfiguration;
406
1094
  /**
407
1095
  * Defaults to LOWEST_MULTIPLIER, which applies the greatest discount to list
408
1096
  * prices automatically. EXPLICIT prioritization requires specifying priorities for
@@ -417,6 +1105,11 @@ export interface ContractCreateParams {
417
1105
  */
418
1106
  netsuite_sales_order_id?: string;
419
1107
  overrides?: Array<ContractCreateParams.Override>;
1108
+ prepaid_balance_threshold_configuration?: ContractCreateParams.PrepaidBalanceThresholdConfiguration;
1109
+ /**
1110
+ * Priority of the contract.
1111
+ */
1112
+ priority?: number;
420
1113
  /**
421
1114
  * This field's availability is dependent on your client's configuration.
422
1115
  */
@@ -446,8 +1139,13 @@ export interface ContractCreateParams {
446
1139
  * on a separate invoice from usage charges.
447
1140
  */
448
1141
  scheduled_charges_on_usage_invoices?: 'ALL';
1142
+ spend_threshold_configuration?: ContractCreateParams.SpendThresholdConfiguration;
1143
+ /**
1144
+ * Optional list of
1145
+ * [subscriptions](https://docs.metronome.com/manage-product-access/create-subscription/)
1146
+ * to add to the contract.
1147
+ */
449
1148
  subscriptions?: Array<ContractCreateParams.Subscription>;
450
- threshold_billing_configuration?: ContractCreateParams.ThresholdBillingConfiguration;
451
1149
  /**
452
1150
  * This field's availability is dependent on your client's configuration.
453
1151
  */
@@ -464,14 +1162,23 @@ export interface ContractCreateParams {
464
1162
  }
465
1163
  export declare namespace ContractCreateParams {
466
1164
  /**
467
- * The billing provider configuration associated with a contract.
1165
+ * The billing provider configuration associated with a contract. Provide either an
1166
+ * ID or the provider and delivery method.
468
1167
  */
469
1168
  interface BillingProviderConfiguration {
1169
+ /**
1170
+ * Do not specify if using billing_provider_configuration_id.
1171
+ */
470
1172
  billing_provider?: 'aws_marketplace' | 'azure_marketplace' | 'gcp_marketplace' | 'stripe' | 'netsuite';
471
1173
  /**
472
- * The Metronome ID of the billing provider configuration
1174
+ * The Metronome ID of the billing provider configuration. Use when a customer has
1175
+ * multiple configurations with the same billing provider and delivery method.
1176
+ * Otherwise, specify the billing_provider and delivery_method.
473
1177
  */
474
1178
  billing_provider_configuration_id?: string;
1179
+ /**
1180
+ * Do not specify if using billing_provider_configuration_id.
1181
+ */
475
1182
  delivery_method?: 'direct_to_billing_provider' | 'aws_sqs' | 'tackle' | 'aws_sns';
476
1183
  }
477
1184
  interface Commit {
@@ -488,20 +1195,28 @@ export declare namespace ContractCreateParams {
488
1195
  */
489
1196
  amount?: number;
490
1197
  /**
491
- * Which products the commit applies to. If both applicable_product_ids and
492
- * applicable_product_tags are not provided, the commit applies to all products.
1198
+ * Which products the commit applies to. If applicable_product_ids,
1199
+ * applicable_product_tags or specifiers are not provided, the commit applies to
1200
+ * all products.
493
1201
  */
494
1202
  applicable_product_ids?: Array<string>;
495
1203
  /**
496
- * Which tags the commit applies to. If both applicable_product_ids and
497
- * applicable_product_tags are not provided, the commit applies to all products.
1204
+ * Which tags the commit applies to. If applicable_product_ids,
1205
+ * applicable_product_tags or specifiers are not provided, the commit applies to
1206
+ * all products.
498
1207
  */
499
1208
  applicable_product_tags?: Array<string>;
500
- custom_fields?: Record<string, string>;
1209
+ custom_fields?: {
1210
+ [key: string]: string;
1211
+ };
501
1212
  /**
502
1213
  * Used only in UI/API. It is not exposed to end customers.
503
1214
  */
504
1215
  description?: string;
1216
+ /**
1217
+ * Optional configuration for commit hierarchy access control
1218
+ */
1219
+ hierarchy_configuration?: Commit.HierarchyConfiguration;
505
1220
  /**
506
1221
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
507
1222
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -517,6 +1232,10 @@ export declare namespace ContractCreateParams {
517
1232
  * This field's availability is dependent on your client's configuration.
518
1233
  */
519
1234
  netsuite_sales_order_id?: string;
1235
+ /**
1236
+ * optionally payment gate this commit
1237
+ */
1238
+ payment_gate_config?: Commit.PaymentGateConfig;
520
1239
  /**
521
1240
  * If multiple commits are applicable, the one with the lower priority will apply
522
1241
  * first.
@@ -527,6 +1246,13 @@ export declare namespace ContractCreateParams {
527
1246
  * Fraction of unused segments that will be rolled over. Must be between 0 and 1.
528
1247
  */
529
1248
  rollover_fraction?: number;
1249
+ /**
1250
+ * List of filters that determine what kind of customer usage draws down a commit
1251
+ * or credit. A customer's usage needs to meet the condition of at least one of the
1252
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
1253
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
1254
+ */
1255
+ specifiers?: Array<Commit.Specifier>;
530
1256
  /**
531
1257
  * A temporary ID for the commit that can be used to reference the commit for
532
1258
  * commit specific overrides.
@@ -559,6 +1285,24 @@ export declare namespace ContractCreateParams {
559
1285
  starting_at: string;
560
1286
  }
561
1287
  }
1288
+ /**
1289
+ * Optional configuration for commit hierarchy access control
1290
+ */
1291
+ interface HierarchyConfiguration {
1292
+ child_access: HierarchyConfiguration.CommitHierarchyChildAccessAll | HierarchyConfiguration.CommitHierarchyChildAccessNone | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
1293
+ }
1294
+ namespace HierarchyConfiguration {
1295
+ interface CommitHierarchyChildAccessAll {
1296
+ type: 'ALL';
1297
+ }
1298
+ interface CommitHierarchyChildAccessNone {
1299
+ type: 'NONE';
1300
+ }
1301
+ interface CommitHierarchyChildAccessContractIDs {
1302
+ contract_ids: Array<string>;
1303
+ type: 'CONTRACT_IDS';
1304
+ }
1305
+ }
562
1306
  /**
563
1307
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
564
1308
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -642,6 +1386,82 @@ export declare namespace ContractCreateParams {
642
1386
  unit_price?: number;
643
1387
  }
644
1388
  }
1389
+ /**
1390
+ * optionally payment gate this commit
1391
+ */
1392
+ interface PaymentGateConfig {
1393
+ /**
1394
+ * Gate access to the commit balance based on successful collection of payment.
1395
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
1396
+ * facilitate payment using your own payment integration. Select NONE if you do not
1397
+ * wish to payment gate the commit balance.
1398
+ */
1399
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
1400
+ /**
1401
+ * Only applicable if using PRECALCULATED as your tax type.
1402
+ */
1403
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
1404
+ /**
1405
+ * Only applicable if using STRIPE as your payment gate type.
1406
+ */
1407
+ stripe_config?: PaymentGateConfig.StripeConfig;
1408
+ /**
1409
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
1410
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
1411
+ * will default to NONE.
1412
+ */
1413
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
1414
+ }
1415
+ namespace PaymentGateConfig {
1416
+ /**
1417
+ * Only applicable if using PRECALCULATED as your tax type.
1418
+ */
1419
+ interface PrecalculatedTaxConfig {
1420
+ /**
1421
+ * Amount of tax to be applied. This should be in the same currency and
1422
+ * denomination as the commit's invoice schedule
1423
+ */
1424
+ tax_amount: number;
1425
+ /**
1426
+ * Name of the tax to be applied. This may be used in an invoice line item
1427
+ * description.
1428
+ */
1429
+ tax_name?: string;
1430
+ }
1431
+ /**
1432
+ * Only applicable if using STRIPE as your payment gate type.
1433
+ */
1434
+ interface StripeConfig {
1435
+ /**
1436
+ * If left blank, will default to INVOICE
1437
+ */
1438
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
1439
+ /**
1440
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
1441
+ * your payment type.
1442
+ */
1443
+ invoice_metadata?: {
1444
+ [key: string]: string;
1445
+ };
1446
+ }
1447
+ }
1448
+ interface Specifier {
1449
+ presentation_group_values?: {
1450
+ [key: string]: string;
1451
+ };
1452
+ pricing_group_values?: {
1453
+ [key: string]: string;
1454
+ };
1455
+ /**
1456
+ * If provided, the specifier will only apply to the product with the specified ID.
1457
+ */
1458
+ product_id?: string;
1459
+ /**
1460
+ * If provided, the specifier will only apply to products with all the specified
1461
+ * tags.
1462
+ */
1463
+ product_tags?: Array<string>;
1464
+ }
645
1465
  }
646
1466
  interface Credit {
647
1467
  /**
@@ -659,11 +1479,17 @@ export declare namespace ContractCreateParams {
659
1479
  * applicable_product_tags are not provided, the credit applies to all products.
660
1480
  */
661
1481
  applicable_product_tags?: Array<string>;
662
- custom_fields?: Record<string, string>;
1482
+ custom_fields?: {
1483
+ [key: string]: string;
1484
+ };
663
1485
  /**
664
1486
  * Used only in UI/API. It is not exposed to end customers.
665
1487
  */
666
1488
  description?: string;
1489
+ /**
1490
+ * Optional configuration for credit hierarchy access control
1491
+ */
1492
+ hierarchy_configuration?: Credit.HierarchyConfiguration;
667
1493
  /**
668
1494
  * displayed on invoices
669
1495
  */
@@ -678,6 +1504,13 @@ export declare namespace ContractCreateParams {
678
1504
  */
679
1505
  priority?: number;
680
1506
  rate_type?: 'COMMIT_RATE' | 'LIST_RATE';
1507
+ /**
1508
+ * List of filters that determine what kind of customer usage draws down a commit
1509
+ * or credit. A customer's usage needs to meet the condition of at least one of the
1510
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
1511
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
1512
+ */
1513
+ specifiers?: Array<Credit.Specifier>;
681
1514
  }
682
1515
  namespace Credit {
683
1516
  /**
@@ -703,6 +1536,41 @@ export declare namespace ContractCreateParams {
703
1536
  starting_at: string;
704
1537
  }
705
1538
  }
1539
+ /**
1540
+ * Optional configuration for credit hierarchy access control
1541
+ */
1542
+ interface HierarchyConfiguration {
1543
+ child_access: HierarchyConfiguration.CommitHierarchyChildAccessAll | HierarchyConfiguration.CommitHierarchyChildAccessNone | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
1544
+ }
1545
+ namespace HierarchyConfiguration {
1546
+ interface CommitHierarchyChildAccessAll {
1547
+ type: 'ALL';
1548
+ }
1549
+ interface CommitHierarchyChildAccessNone {
1550
+ type: 'NONE';
1551
+ }
1552
+ interface CommitHierarchyChildAccessContractIDs {
1553
+ contract_ids: Array<string>;
1554
+ type: 'CONTRACT_IDS';
1555
+ }
1556
+ }
1557
+ interface Specifier {
1558
+ presentation_group_values?: {
1559
+ [key: string]: string;
1560
+ };
1561
+ pricing_group_values?: {
1562
+ [key: string]: string;
1563
+ };
1564
+ /**
1565
+ * If provided, the specifier will only apply to the product with the specified ID.
1566
+ */
1567
+ product_id?: string;
1568
+ /**
1569
+ * If provided, the specifier will only apply to products with all the specified
1570
+ * tags.
1571
+ */
1572
+ product_tags?: Array<string>;
1573
+ }
706
1574
  }
707
1575
  interface Discount {
708
1576
  product_id: string;
@@ -710,7 +1578,9 @@ export declare namespace ContractCreateParams {
710
1578
  * Must provide either schedule_items or recurring_schedule.
711
1579
  */
712
1580
  schedule: Discount.Schedule;
713
- custom_fields?: Record<string, string>;
1581
+ custom_fields?: {
1582
+ [key: string]: string;
1583
+ };
714
1584
  /**
715
1585
  * displayed on invoices
716
1586
  */
@@ -802,6 +1672,15 @@ export declare namespace ContractCreateParams {
802
1672
  }
803
1673
  }
804
1674
  }
1675
+ interface HierarchyConfiguration {
1676
+ parent: HierarchyConfiguration.Parent;
1677
+ }
1678
+ namespace HierarchyConfiguration {
1679
+ interface Parent {
1680
+ contract_id: string;
1681
+ customer_id: string;
1682
+ }
1683
+ }
805
1684
  interface Override {
806
1685
  /**
807
1686
  * RFC 3339 timestamp indicating when the override will start applying (inclusive)
@@ -866,7 +1745,7 @@ export declare namespace ContractCreateParams {
866
1745
  }
867
1746
  namespace Override {
868
1747
  interface OverrideSpecifier {
869
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
1748
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
870
1749
  /**
871
1750
  * Can only be used for commit specific overrides. Must be used in conjunction with
872
1751
  * one of product_id, product_tags, pricing_group_values, or
@@ -878,12 +1757,16 @@ export declare namespace ContractCreateParams {
878
1757
  * A map of group names to values. The override will only apply to line items with
879
1758
  * the specified presentation group values.
880
1759
  */
881
- presentation_group_values?: Record<string, string>;
1760
+ presentation_group_values?: {
1761
+ [key: string]: string;
1762
+ };
882
1763
  /**
883
1764
  * A map of pricing group names to values. The override will only apply to products
884
1765
  * with the specified pricing group values.
885
1766
  */
886
- pricing_group_values?: Record<string, string>;
1767
+ pricing_group_values?: {
1768
+ [key: string]: string;
1769
+ };
887
1770
  /**
888
1771
  * If provided, the override will only apply to the product with the specified ID.
889
1772
  */
@@ -918,7 +1801,9 @@ export declare namespace ContractCreateParams {
918
1801
  * Only set for CUSTOM rate_type. This field is interpreted by custom rate
919
1802
  * processors.
920
1803
  */
921
- custom_rate?: Record<string, unknown>;
1804
+ custom_rate?: {
1805
+ [key: string]: unknown;
1806
+ };
922
1807
  /**
923
1808
  * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
924
1809
  * set to true.
@@ -943,6 +1828,139 @@ export declare namespace ContractCreateParams {
943
1828
  size?: number;
944
1829
  }
945
1830
  }
1831
+ interface PrepaidBalanceThresholdConfiguration {
1832
+ commit: PrepaidBalanceThresholdConfiguration.Commit;
1833
+ /**
1834
+ * When set to false, the contract will not be evaluated against the
1835
+ * threshold_amount. Toggling to true will result an immediate evaluation,
1836
+ * regardless of prior state.
1837
+ */
1838
+ is_enabled: boolean;
1839
+ payment_gate_config: PrepaidBalanceThresholdConfiguration.PaymentGateConfig;
1840
+ /**
1841
+ * Specify the amount the balance should be recharged to.
1842
+ */
1843
+ recharge_to_amount: number;
1844
+ /**
1845
+ * Specify the threshold amount for the contract. Each time the contract's prepaid
1846
+ * balance lowers to this amount, a threshold charge will be initiated.
1847
+ */
1848
+ threshold_amount: number;
1849
+ /**
1850
+ * If provided, the threshold, recharge-to amount, and the resulting threshold
1851
+ * commit amount will be in terms of this credit type instead of the fiat currency.
1852
+ */
1853
+ custom_credit_type_id?: string;
1854
+ }
1855
+ namespace PrepaidBalanceThresholdConfiguration {
1856
+ interface Commit {
1857
+ /**
1858
+ * The commit product that will be used to generate the line item for commit
1859
+ * payment.
1860
+ */
1861
+ product_id: string;
1862
+ /**
1863
+ * Which products the threshold commit applies to. If applicable_product_ids,
1864
+ * applicable_product_tags or specifiers are not provided, the commit applies to
1865
+ * all products.
1866
+ */
1867
+ applicable_product_ids?: Array<string>;
1868
+ /**
1869
+ * Which tags the threshold commit applies to. If applicable_product_ids,
1870
+ * applicable_product_tags or specifiers are not provided, the commit applies to
1871
+ * all products.
1872
+ */
1873
+ applicable_product_tags?: Array<string>;
1874
+ description?: string;
1875
+ /**
1876
+ * Specify the name of the line item for the threshold charge. If left blank, it
1877
+ * will default to the commit product name.
1878
+ */
1879
+ name?: string;
1880
+ /**
1881
+ * List of filters that determine what kind of customer usage draws down a commit
1882
+ * or credit. A customer's usage needs to meet the condition of at least one of the
1883
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
1884
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
1885
+ */
1886
+ specifiers?: Array<Commit.Specifier>;
1887
+ }
1888
+ namespace Commit {
1889
+ interface Specifier {
1890
+ presentation_group_values?: {
1891
+ [key: string]: string;
1892
+ };
1893
+ pricing_group_values?: {
1894
+ [key: string]: string;
1895
+ };
1896
+ /**
1897
+ * If provided, the specifier will only apply to the product with the specified ID.
1898
+ */
1899
+ product_id?: string;
1900
+ /**
1901
+ * If provided, the specifier will only apply to products with all the specified
1902
+ * tags.
1903
+ */
1904
+ product_tags?: Array<string>;
1905
+ }
1906
+ }
1907
+ interface PaymentGateConfig {
1908
+ /**
1909
+ * Gate access to the commit balance based on successful collection of payment.
1910
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
1911
+ * facilitate payment using your own payment integration. Select NONE if you do not
1912
+ * wish to payment gate the commit balance.
1913
+ */
1914
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
1915
+ /**
1916
+ * Only applicable if using PRECALCULATED as your tax type.
1917
+ */
1918
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
1919
+ /**
1920
+ * Only applicable if using STRIPE as your payment gate type.
1921
+ */
1922
+ stripe_config?: PaymentGateConfig.StripeConfig;
1923
+ /**
1924
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
1925
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
1926
+ * will default to NONE.
1927
+ */
1928
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
1929
+ }
1930
+ namespace PaymentGateConfig {
1931
+ /**
1932
+ * Only applicable if using PRECALCULATED as your tax type.
1933
+ */
1934
+ interface PrecalculatedTaxConfig {
1935
+ /**
1936
+ * Amount of tax to be applied. This should be in the same currency and
1937
+ * denomination as the commit's invoice schedule
1938
+ */
1939
+ tax_amount: number;
1940
+ /**
1941
+ * Name of the tax to be applied. This may be used in an invoice line item
1942
+ * description.
1943
+ */
1944
+ tax_name?: string;
1945
+ }
1946
+ /**
1947
+ * Only applicable if using STRIPE as your payment gate type.
1948
+ */
1949
+ interface StripeConfig {
1950
+ /**
1951
+ * If left blank, will default to INVOICE
1952
+ */
1953
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
1954
+ /**
1955
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
1956
+ * your payment type.
1957
+ */
1958
+ invoice_metadata?: {
1959
+ [key: string]: string;
1960
+ };
1961
+ }
1962
+ }
1963
+ }
946
1964
  interface ProfessionalService {
947
1965
  /**
948
1966
  * Maximum amount for the term.
@@ -959,7 +1977,9 @@ export declare namespace ContractCreateParams {
959
1977
  * amount and must be specified.
960
1978
  */
961
1979
  unit_price: number;
962
- custom_fields?: Record<string, string>;
1980
+ custom_fields?: {
1981
+ [key: string]: string;
1982
+ };
963
1983
  description?: string;
964
1984
  /**
965
1985
  * This field's availability is dependent on your client's configuration.
@@ -972,7 +1992,9 @@ export declare namespace ContractCreateParams {
972
1992
  */
973
1993
  access_amount: RecurringCommit.AccessAmount;
974
1994
  /**
975
- * The amount of time the created commits will be valid for.
1995
+ * Defines the length of the access schedule for each created commit/credit. The
1996
+ * value represents the number of units. Unit defaults to "PERIODS", where the
1997
+ * length of a period is determined by the recurrence_frequency.
976
1998
  */
977
1999
  commit_duration: RecurringCommit.CommitDuration;
978
2000
  /**
@@ -1000,6 +2022,10 @@ export declare namespace ContractCreateParams {
1000
2022
  * Determines when the contract will stop creating recurring commits. optional
1001
2023
  */
1002
2024
  ending_before?: string;
2025
+ /**
2026
+ * Optional configuration for recurring commit/credit hierarchy access control
2027
+ */
2028
+ hierarchy_configuration?: RecurringCommit.HierarchyConfiguration;
1003
2029
  /**
1004
2030
  * The amount the customer should be billed for the commit. Not required.
1005
2031
  */
@@ -1025,16 +2051,23 @@ export declare namespace ContractCreateParams {
1025
2051
  * The frequency at which the recurring commits will be created. If not provided: -
1026
2052
  * The commits will be created on the usage invoice frequency. If provided: - The
1027
2053
  * period defined in the duration will correspond to this frequency. - Commits will
1028
- * be created aligned with the recurring commit's start_date rather than the usage
2054
+ * be created aligned with the recurring commit's starting_at rather than the usage
1029
2055
  * invoice dates.
1030
2056
  */
1031
- recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
2057
+ recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1032
2058
  /**
1033
2059
  * Will be passed down to the individual commits. This controls how much of an
1034
2060
  * individual unexpired commit will roll over upon contract transition. Must be
1035
2061
  * between 0 and 1.
1036
2062
  */
1037
2063
  rollover_fraction?: number;
2064
+ /**
2065
+ * List of filters that determine what kind of customer usage draws down a commit
2066
+ * or credit. A customer's usage needs to meet the condition of at least one of the
2067
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
2068
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
2069
+ */
2070
+ specifiers?: Array<RecurringCommit.Specifier>;
1038
2071
  /**
1039
2072
  * A temporary ID that can be used to reference the recurring commit for commit
1040
2073
  * specific overrides.
@@ -1047,15 +2080,39 @@ export declare namespace ContractCreateParams {
1047
2080
  */
1048
2081
  interface AccessAmount {
1049
2082
  credit_type_id: string;
1050
- quantity: number;
1051
2083
  unit_price: number;
2084
+ /**
2085
+ * This field is currently required. Upcoming recurring commit/credit configuration
2086
+ * options will allow it to be optional.
2087
+ */
2088
+ quantity?: number;
1052
2089
  }
1053
2090
  /**
1054
- * The amount of time the created commits will be valid for.
2091
+ * Defines the length of the access schedule for each created commit/credit. The
2092
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2093
+ * length of a period is determined by the recurrence_frequency.
1055
2094
  */
1056
2095
  interface CommitDuration {
1057
- unit: 'PERIODS';
1058
2096
  value: number;
2097
+ unit?: 'PERIODS';
2098
+ }
2099
+ /**
2100
+ * Optional configuration for recurring commit/credit hierarchy access control
2101
+ */
2102
+ interface HierarchyConfiguration {
2103
+ child_access: HierarchyConfiguration.CommitHierarchyChildAccessAll | HierarchyConfiguration.CommitHierarchyChildAccessNone | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
2104
+ }
2105
+ namespace HierarchyConfiguration {
2106
+ interface CommitHierarchyChildAccessAll {
2107
+ type: 'ALL';
2108
+ }
2109
+ interface CommitHierarchyChildAccessNone {
2110
+ type: 'NONE';
2111
+ }
2112
+ interface CommitHierarchyChildAccessContractIDs {
2113
+ contract_ids: Array<string>;
2114
+ type: 'CONTRACT_IDS';
2115
+ }
1059
2116
  }
1060
2117
  /**
1061
2118
  * The amount the customer should be billed for the commit. Not required.
@@ -1065,6 +2122,23 @@ export declare namespace ContractCreateParams {
1065
2122
  quantity: number;
1066
2123
  unit_price: number;
1067
2124
  }
2125
+ interface Specifier {
2126
+ presentation_group_values?: {
2127
+ [key: string]: string;
2128
+ };
2129
+ pricing_group_values?: {
2130
+ [key: string]: string;
2131
+ };
2132
+ /**
2133
+ * If provided, the specifier will only apply to the product with the specified ID.
2134
+ */
2135
+ product_id?: string;
2136
+ /**
2137
+ * If provided, the specifier will only apply to products with all the specified
2138
+ * tags.
2139
+ */
2140
+ product_tags?: Array<string>;
2141
+ }
1068
2142
  }
1069
2143
  interface RecurringCredit {
1070
2144
  /**
@@ -1072,7 +2146,9 @@ export declare namespace ContractCreateParams {
1072
2146
  */
1073
2147
  access_amount: RecurringCredit.AccessAmount;
1074
2148
  /**
1075
- * The amount of time the created commits will be valid for.
2149
+ * Defines the length of the access schedule for each created commit/credit. The
2150
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2151
+ * length of a period is determined by the recurrence_frequency.
1076
2152
  */
1077
2153
  commit_duration: RecurringCredit.CommitDuration;
1078
2154
  /**
@@ -1100,6 +2176,10 @@ export declare namespace ContractCreateParams {
1100
2176
  * Determines when the contract will stop creating recurring commits. optional
1101
2177
  */
1102
2178
  ending_before?: string;
2179
+ /**
2180
+ * Optional configuration for recurring commit/credit hierarchy access control
2181
+ */
2182
+ hierarchy_configuration?: RecurringCredit.HierarchyConfiguration;
1103
2183
  /**
1104
2184
  * displayed on invoices. will be passed through to the individual commits
1105
2185
  */
@@ -1121,16 +2201,23 @@ export declare namespace ContractCreateParams {
1121
2201
  * The frequency at which the recurring commits will be created. If not provided: -
1122
2202
  * The commits will be created on the usage invoice frequency. If provided: - The
1123
2203
  * period defined in the duration will correspond to this frequency. - Commits will
1124
- * be created aligned with the recurring commit's start_date rather than the usage
2204
+ * be created aligned with the recurring commit's starting_at rather than the usage
1125
2205
  * invoice dates.
1126
2206
  */
1127
- recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
2207
+ recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1128
2208
  /**
1129
2209
  * Will be passed down to the individual commits. This controls how much of an
1130
2210
  * individual unexpired commit will roll over upon contract transition. Must be
1131
2211
  * between 0 and 1.
1132
2212
  */
1133
2213
  rollover_fraction?: number;
2214
+ /**
2215
+ * List of filters that determine what kind of customer usage draws down a commit
2216
+ * or credit. A customer's usage needs to meet the condition of at least one of the
2217
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
2218
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
2219
+ */
2220
+ specifiers?: Array<RecurringCredit.Specifier>;
1134
2221
  /**
1135
2222
  * A temporary ID that can be used to reference the recurring commit for commit
1136
2223
  * specific overrides.
@@ -1143,15 +2230,56 @@ export declare namespace ContractCreateParams {
1143
2230
  */
1144
2231
  interface AccessAmount {
1145
2232
  credit_type_id: string;
1146
- quantity: number;
1147
2233
  unit_price: number;
2234
+ /**
2235
+ * This field is currently required. Upcoming recurring commit/credit configuration
2236
+ * options will allow it to be optional.
2237
+ */
2238
+ quantity?: number;
1148
2239
  }
1149
2240
  /**
1150
- * The amount of time the created commits will be valid for.
2241
+ * Defines the length of the access schedule for each created commit/credit. The
2242
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2243
+ * length of a period is determined by the recurrence_frequency.
1151
2244
  */
1152
2245
  interface CommitDuration {
1153
- unit: 'PERIODS';
1154
2246
  value: number;
2247
+ unit?: 'PERIODS';
2248
+ }
2249
+ /**
2250
+ * Optional configuration for recurring commit/credit hierarchy access control
2251
+ */
2252
+ interface HierarchyConfiguration {
2253
+ child_access: HierarchyConfiguration.CommitHierarchyChildAccessAll | HierarchyConfiguration.CommitHierarchyChildAccessNone | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
2254
+ }
2255
+ namespace HierarchyConfiguration {
2256
+ interface CommitHierarchyChildAccessAll {
2257
+ type: 'ALL';
2258
+ }
2259
+ interface CommitHierarchyChildAccessNone {
2260
+ type: 'NONE';
2261
+ }
2262
+ interface CommitHierarchyChildAccessContractIDs {
2263
+ contract_ids: Array<string>;
2264
+ type: 'CONTRACT_IDS';
2265
+ }
2266
+ }
2267
+ interface Specifier {
2268
+ presentation_group_values?: {
2269
+ [key: string]: string;
2270
+ };
2271
+ pricing_group_values?: {
2272
+ [key: string]: string;
2273
+ };
2274
+ /**
2275
+ * If provided, the specifier will only apply to the product with the specified ID.
2276
+ */
2277
+ product_id?: string;
2278
+ /**
2279
+ * If provided, the specifier will only apply to products with all the specified
2280
+ * tags.
2281
+ */
2282
+ product_tags?: Array<string>;
1155
2283
  }
1156
2284
  }
1157
2285
  interface ResellerRoyalty {
@@ -1280,11 +2408,103 @@ export declare namespace ContractCreateParams {
1280
2408
  }
1281
2409
  }
1282
2410
  }
2411
+ interface SpendThresholdConfiguration {
2412
+ commit: SpendThresholdConfiguration.Commit;
2413
+ /**
2414
+ * When set to false, the contract will not be evaluated against the
2415
+ * threshold_amount. Toggling to true will result an immediate evaluation,
2416
+ * regardless of prior state.
2417
+ */
2418
+ is_enabled: boolean;
2419
+ payment_gate_config: SpendThresholdConfiguration.PaymentGateConfig;
2420
+ /**
2421
+ * Specify the threshold amount for the contract. Each time the contract's usage
2422
+ * hits this amount, a threshold charge will be initiated.
2423
+ */
2424
+ threshold_amount: number;
2425
+ }
2426
+ namespace SpendThresholdConfiguration {
2427
+ interface Commit {
2428
+ /**
2429
+ * The commit product that will be used to generate the line item for commit
2430
+ * payment.
2431
+ */
2432
+ product_id: string;
2433
+ description?: string;
2434
+ /**
2435
+ * Specify the name of the line item for the threshold charge. If left blank, it
2436
+ * will default to the commit product name.
2437
+ */
2438
+ name?: string;
2439
+ }
2440
+ interface PaymentGateConfig {
2441
+ /**
2442
+ * Gate access to the commit balance based on successful collection of payment.
2443
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
2444
+ * facilitate payment using your own payment integration. Select NONE if you do not
2445
+ * wish to payment gate the commit balance.
2446
+ */
2447
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
2448
+ /**
2449
+ * Only applicable if using PRECALCULATED as your tax type.
2450
+ */
2451
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
2452
+ /**
2453
+ * Only applicable if using STRIPE as your payment gate type.
2454
+ */
2455
+ stripe_config?: PaymentGateConfig.StripeConfig;
2456
+ /**
2457
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
2458
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
2459
+ * will default to NONE.
2460
+ */
2461
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
2462
+ }
2463
+ namespace PaymentGateConfig {
2464
+ /**
2465
+ * Only applicable if using PRECALCULATED as your tax type.
2466
+ */
2467
+ interface PrecalculatedTaxConfig {
2468
+ /**
2469
+ * Amount of tax to be applied. This should be in the same currency and
2470
+ * denomination as the commit's invoice schedule
2471
+ */
2472
+ tax_amount: number;
2473
+ /**
2474
+ * Name of the tax to be applied. This may be used in an invoice line item
2475
+ * description.
2476
+ */
2477
+ tax_name?: string;
2478
+ }
2479
+ /**
2480
+ * Only applicable if using STRIPE as your payment gate type.
2481
+ */
2482
+ interface StripeConfig {
2483
+ /**
2484
+ * If left blank, will default to INVOICE
2485
+ */
2486
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
2487
+ /**
2488
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
2489
+ * your payment type.
2490
+ */
2491
+ invoice_metadata?: {
2492
+ [key: string]: string;
2493
+ };
2494
+ }
2495
+ }
2496
+ }
1283
2497
  interface Subscription {
1284
2498
  collection_schedule: 'ADVANCE' | 'ARREARS';
2499
+ /**
2500
+ * The initial quantity for the subscription. It must be non-negative value.
2501
+ */
1285
2502
  initial_quantity: number;
1286
2503
  proration: Subscription.Proration;
1287
2504
  subscription_rate: Subscription.SubscriptionRate;
2505
+ custom_fields?: {
2506
+ [key: string]: string;
2507
+ };
1288
2508
  description?: string;
1289
2509
  /**
1290
2510
  * Exclusive end time for the subscription. If not provided, subscription inherits
@@ -1317,49 +2537,13 @@ export declare namespace ContractCreateParams {
1317
2537
  * Frequency to bill subscription with. Together with product_id, must match
1318
2538
  * existing rate on the rate card.
1319
2539
  */
1320
- billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
2540
+ billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1321
2541
  /**
1322
2542
  * Must be subscription type product
1323
2543
  */
1324
2544
  product_id: string;
1325
2545
  }
1326
2546
  }
1327
- interface ThresholdBillingConfiguration {
1328
- commit: ThresholdBillingConfiguration.Commit;
1329
- /**
1330
- * When set to false, the contract will not be evaluated against the
1331
- * threshold_amount. Toggling to true will result an immediate evaluation,
1332
- * regardless of prior state
1333
- */
1334
- is_enabled: boolean;
1335
- /**
1336
- * Specify the threshold amount for the contract. Each time the contract's usage
1337
- * hits this amount, a threshold charge will be initiated.
1338
- */
1339
- threshold_amount: number;
1340
- }
1341
- namespace ThresholdBillingConfiguration {
1342
- interface Commit {
1343
- product_id: string;
1344
- /**
1345
- * Which products the threshold commit applies to. If both applicable_product_ids
1346
- * and applicable_product_tags are not provided, the commit applies to all
1347
- * products.
1348
- */
1349
- applicable_product_ids?: Array<string>;
1350
- /**
1351
- * Which tags the threshold commit applies to. If both applicable_product_ids and
1352
- * applicable_product_tags are not provided, the commit applies to all products.
1353
- */
1354
- applicable_product_tags?: Array<string>;
1355
- description?: string;
1356
- /**
1357
- * Specify the name of the line item for the threshold charge. If left blank, it
1358
- * will default to the commit product name.
1359
- */
1360
- name?: string;
1361
- }
1362
- }
1363
2547
  interface Transition {
1364
2548
  from_contract_id: string;
1365
2549
  /**
@@ -1378,7 +2562,7 @@ export declare namespace ContractCreateParams {
1378
2562
  }
1379
2563
  }
1380
2564
  interface UsageStatementSchedule {
1381
- frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
2565
+ frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1382
2566
  /**
1383
2567
  * Required when using CUSTOM_DATE. This option lets you set a historical billing
1384
2568
  * anchor date, aligning future billing cycles with a chosen cadence. For example,
@@ -1489,7 +2673,9 @@ export interface ContractAmendParams {
1489
2673
  starting_at: string;
1490
2674
  commits?: Array<ContractAmendParams.Commit>;
1491
2675
  credits?: Array<ContractAmendParams.Credit>;
1492
- custom_fields?: Record<string, string>;
2676
+ custom_fields?: {
2677
+ [key: string]: string;
2678
+ };
1493
2679
  /**
1494
2680
  * This field's availability is dependent on your client's configuration.
1495
2681
  */
@@ -1532,20 +2718,28 @@ export declare namespace ContractAmendParams {
1532
2718
  */
1533
2719
  amount?: number;
1534
2720
  /**
1535
- * Which products the commit applies to. If both applicable_product_ids and
1536
- * applicable_product_tags are not provided, the commit applies to all products.
2721
+ * Which products the commit applies to. If applicable_product_ids,
2722
+ * applicable_product_tags or specifiers are not provided, the commit applies to
2723
+ * all products.
1537
2724
  */
1538
2725
  applicable_product_ids?: Array<string>;
1539
2726
  /**
1540
- * Which tags the commit applies to. If both applicable_product_ids and
1541
- * applicable_product_tags are not provided, the commit applies to all products.
2727
+ * Which tags the commit applies to. If applicable_product_ids,
2728
+ * applicable_product_tags or specifiers are not provided, the commit applies to
2729
+ * all products.
1542
2730
  */
1543
2731
  applicable_product_tags?: Array<string>;
1544
- custom_fields?: Record<string, string>;
2732
+ custom_fields?: {
2733
+ [key: string]: string;
2734
+ };
1545
2735
  /**
1546
2736
  * Used only in UI/API. It is not exposed to end customers.
1547
2737
  */
1548
2738
  description?: string;
2739
+ /**
2740
+ * Optional configuration for commit hierarchy access control
2741
+ */
2742
+ hierarchy_configuration?: Commit.HierarchyConfiguration;
1549
2743
  /**
1550
2744
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
1551
2745
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -1561,6 +2755,10 @@ export declare namespace ContractAmendParams {
1561
2755
  * This field's availability is dependent on your client's configuration.
1562
2756
  */
1563
2757
  netsuite_sales_order_id?: string;
2758
+ /**
2759
+ * optionally payment gate this commit
2760
+ */
2761
+ payment_gate_config?: Commit.PaymentGateConfig;
1564
2762
  /**
1565
2763
  * If multiple commits are applicable, the one with the lower priority will apply
1566
2764
  * first.
@@ -1571,6 +2769,13 @@ export declare namespace ContractAmendParams {
1571
2769
  * Fraction of unused segments that will be rolled over. Must be between 0 and 1.
1572
2770
  */
1573
2771
  rollover_fraction?: number;
2772
+ /**
2773
+ * List of filters that determine what kind of customer usage draws down a commit
2774
+ * or credit. A customer's usage needs to meet the condition of at least one of the
2775
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
2776
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
2777
+ */
2778
+ specifiers?: Array<Commit.Specifier>;
1574
2779
  /**
1575
2780
  * A temporary ID for the commit that can be used to reference the commit for
1576
2781
  * commit specific overrides.
@@ -1603,6 +2808,24 @@ export declare namespace ContractAmendParams {
1603
2808
  starting_at: string;
1604
2809
  }
1605
2810
  }
2811
+ /**
2812
+ * Optional configuration for commit hierarchy access control
2813
+ */
2814
+ interface HierarchyConfiguration {
2815
+ child_access: HierarchyConfiguration.CommitHierarchyChildAccessAll | HierarchyConfiguration.CommitHierarchyChildAccessNone | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
2816
+ }
2817
+ namespace HierarchyConfiguration {
2818
+ interface CommitHierarchyChildAccessAll {
2819
+ type: 'ALL';
2820
+ }
2821
+ interface CommitHierarchyChildAccessNone {
2822
+ type: 'NONE';
2823
+ }
2824
+ interface CommitHierarchyChildAccessContractIDs {
2825
+ contract_ids: Array<string>;
2826
+ type: 'CONTRACT_IDS';
2827
+ }
2828
+ }
1606
2829
  /**
1607
2830
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
1608
2831
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -1686,6 +2909,82 @@ export declare namespace ContractAmendParams {
1686
2909
  unit_price?: number;
1687
2910
  }
1688
2911
  }
2912
+ /**
2913
+ * optionally payment gate this commit
2914
+ */
2915
+ interface PaymentGateConfig {
2916
+ /**
2917
+ * Gate access to the commit balance based on successful collection of payment.
2918
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
2919
+ * facilitate payment using your own payment integration. Select NONE if you do not
2920
+ * wish to payment gate the commit balance.
2921
+ */
2922
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
2923
+ /**
2924
+ * Only applicable if using PRECALCULATED as your tax type.
2925
+ */
2926
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
2927
+ /**
2928
+ * Only applicable if using STRIPE as your payment gate type.
2929
+ */
2930
+ stripe_config?: PaymentGateConfig.StripeConfig;
2931
+ /**
2932
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
2933
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
2934
+ * will default to NONE.
2935
+ */
2936
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
2937
+ }
2938
+ namespace PaymentGateConfig {
2939
+ /**
2940
+ * Only applicable if using PRECALCULATED as your tax type.
2941
+ */
2942
+ interface PrecalculatedTaxConfig {
2943
+ /**
2944
+ * Amount of tax to be applied. This should be in the same currency and
2945
+ * denomination as the commit's invoice schedule
2946
+ */
2947
+ tax_amount: number;
2948
+ /**
2949
+ * Name of the tax to be applied. This may be used in an invoice line item
2950
+ * description.
2951
+ */
2952
+ tax_name?: string;
2953
+ }
2954
+ /**
2955
+ * Only applicable if using STRIPE as your payment gate type.
2956
+ */
2957
+ interface StripeConfig {
2958
+ /**
2959
+ * If left blank, will default to INVOICE
2960
+ */
2961
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
2962
+ /**
2963
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
2964
+ * your payment type.
2965
+ */
2966
+ invoice_metadata?: {
2967
+ [key: string]: string;
2968
+ };
2969
+ }
2970
+ }
2971
+ interface Specifier {
2972
+ presentation_group_values?: {
2973
+ [key: string]: string;
2974
+ };
2975
+ pricing_group_values?: {
2976
+ [key: string]: string;
2977
+ };
2978
+ /**
2979
+ * If provided, the specifier will only apply to the product with the specified ID.
2980
+ */
2981
+ product_id?: string;
2982
+ /**
2983
+ * If provided, the specifier will only apply to products with all the specified
2984
+ * tags.
2985
+ */
2986
+ product_tags?: Array<string>;
2987
+ }
1689
2988
  }
1690
2989
  interface Credit {
1691
2990
  /**
@@ -1703,11 +3002,17 @@ export declare namespace ContractAmendParams {
1703
3002
  * applicable_product_tags are not provided, the credit applies to all products.
1704
3003
  */
1705
3004
  applicable_product_tags?: Array<string>;
1706
- custom_fields?: Record<string, string>;
3005
+ custom_fields?: {
3006
+ [key: string]: string;
3007
+ };
1707
3008
  /**
1708
3009
  * Used only in UI/API. It is not exposed to end customers.
1709
3010
  */
1710
3011
  description?: string;
3012
+ /**
3013
+ * Optional configuration for credit hierarchy access control
3014
+ */
3015
+ hierarchy_configuration?: Credit.HierarchyConfiguration;
1711
3016
  /**
1712
3017
  * displayed on invoices
1713
3018
  */
@@ -1722,6 +3027,13 @@ export declare namespace ContractAmendParams {
1722
3027
  */
1723
3028
  priority?: number;
1724
3029
  rate_type?: 'COMMIT_RATE' | 'LIST_RATE';
3030
+ /**
3031
+ * List of filters that determine what kind of customer usage draws down a commit
3032
+ * or credit. A customer's usage needs to meet the condition of at least one of the
3033
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
3034
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
3035
+ */
3036
+ specifiers?: Array<Credit.Specifier>;
1725
3037
  }
1726
3038
  namespace Credit {
1727
3039
  /**
@@ -1747,6 +3059,41 @@ export declare namespace ContractAmendParams {
1747
3059
  starting_at: string;
1748
3060
  }
1749
3061
  }
3062
+ /**
3063
+ * Optional configuration for credit hierarchy access control
3064
+ */
3065
+ interface HierarchyConfiguration {
3066
+ child_access: HierarchyConfiguration.CommitHierarchyChildAccessAll | HierarchyConfiguration.CommitHierarchyChildAccessNone | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
3067
+ }
3068
+ namespace HierarchyConfiguration {
3069
+ interface CommitHierarchyChildAccessAll {
3070
+ type: 'ALL';
3071
+ }
3072
+ interface CommitHierarchyChildAccessNone {
3073
+ type: 'NONE';
3074
+ }
3075
+ interface CommitHierarchyChildAccessContractIDs {
3076
+ contract_ids: Array<string>;
3077
+ type: 'CONTRACT_IDS';
3078
+ }
3079
+ }
3080
+ interface Specifier {
3081
+ presentation_group_values?: {
3082
+ [key: string]: string;
3083
+ };
3084
+ pricing_group_values?: {
3085
+ [key: string]: string;
3086
+ };
3087
+ /**
3088
+ * If provided, the specifier will only apply to the product with the specified ID.
3089
+ */
3090
+ product_id?: string;
3091
+ /**
3092
+ * If provided, the specifier will only apply to products with all the specified
3093
+ * tags.
3094
+ */
3095
+ product_tags?: Array<string>;
3096
+ }
1750
3097
  }
1751
3098
  interface Discount {
1752
3099
  product_id: string;
@@ -1754,7 +3101,9 @@ export declare namespace ContractAmendParams {
1754
3101
  * Must provide either schedule_items or recurring_schedule.
1755
3102
  */
1756
3103
  schedule: Discount.Schedule;
1757
- custom_fields?: Record<string, string>;
3104
+ custom_fields?: {
3105
+ [key: string]: string;
3106
+ };
1758
3107
  /**
1759
3108
  * displayed on invoices
1760
3109
  */
@@ -1910,7 +3259,7 @@ export declare namespace ContractAmendParams {
1910
3259
  }
1911
3260
  namespace Override {
1912
3261
  interface OverrideSpecifier {
1913
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
3262
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1914
3263
  /**
1915
3264
  * Can only be used for commit specific overrides. Must be used in conjunction with
1916
3265
  * one of product_id, product_tags, pricing_group_values, or
@@ -1922,12 +3271,16 @@ export declare namespace ContractAmendParams {
1922
3271
  * A map of group names to values. The override will only apply to line items with
1923
3272
  * the specified presentation group values.
1924
3273
  */
1925
- presentation_group_values?: Record<string, string>;
3274
+ presentation_group_values?: {
3275
+ [key: string]: string;
3276
+ };
1926
3277
  /**
1927
3278
  * A map of pricing group names to values. The override will only apply to products
1928
3279
  * with the specified pricing group values.
1929
3280
  */
1930
- pricing_group_values?: Record<string, string>;
3281
+ pricing_group_values?: {
3282
+ [key: string]: string;
3283
+ };
1931
3284
  /**
1932
3285
  * If provided, the override will only apply to the product with the specified ID.
1933
3286
  */
@@ -1962,7 +3315,9 @@ export declare namespace ContractAmendParams {
1962
3315
  * Only set for CUSTOM rate_type. This field is interpreted by custom rate
1963
3316
  * processors.
1964
3317
  */
1965
- custom_rate?: Record<string, unknown>;
3318
+ custom_rate?: {
3319
+ [key: string]: unknown;
3320
+ };
1966
3321
  /**
1967
3322
  * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
1968
3323
  * set to true.
@@ -2003,7 +3358,9 @@ export declare namespace ContractAmendParams {
2003
3358
  * amount and must be specified.
2004
3359
  */
2005
3360
  unit_price: number;
2006
- custom_fields?: Record<string, string>;
3361
+ custom_fields?: {
3362
+ [key: string]: string;
3363
+ };
2007
3364
  description?: string;
2008
3365
  /**
2009
3366
  * This field's availability is dependent on your client's configuration.
@@ -2173,15 +3530,21 @@ export declare namespace ContractCreateHistoricalInvoicesParams {
2173
3530
  */
2174
3531
  billable_status?: 'billable' | 'unbillable';
2175
3532
  breakdown_granularity?: 'HOUR' | 'DAY';
2176
- custom_fields?: Record<string, string>;
3533
+ custom_fields?: {
3534
+ [key: string]: string;
3535
+ };
2177
3536
  }
2178
3537
  namespace Invoice {
2179
3538
  interface UsageLineItem {
2180
3539
  exclusive_end_date: string;
2181
3540
  inclusive_start_date: string;
2182
3541
  product_id: string;
2183
- presentation_group_values?: Record<string, string>;
2184
- pricing_group_values?: Record<string, string>;
3542
+ presentation_group_values?: {
3543
+ [key: string]: string;
3544
+ };
3545
+ pricing_group_values?: {
3546
+ [key: string]: string;
3547
+ };
2185
3548
  quantity?: number;
2186
3549
  subtotals_with_quantity?: Array<UsageLineItem.SubtotalsWithQuantity>;
2187
3550
  }
@@ -2206,7 +3569,7 @@ export interface ContractListBalancesParams {
2206
3569
  */
2207
3570
  effective_before?: string;
2208
3571
  /**
2209
- * Include credits from archived contracts.
3572
+ * Include archived credits and credits from archived contracts.
2210
3573
  */
2211
3574
  include_archived?: boolean;
2212
3575
  /**
@@ -2223,6 +3586,10 @@ export interface ContractListBalancesParams {
2223
3586
  * slower.
2224
3587
  */
2225
3588
  include_ledgers?: boolean;
3589
+ /**
3590
+ * The maximum number of commits to return. Defaults to 25.
3591
+ */
3592
+ limit?: number;
2226
3593
  /**
2227
3594
  * The next page token from a previous response.
2228
3595
  */
@@ -2267,17 +3634,21 @@ export declare namespace ContractRetrieveRateScheduleParams {
2267
3634
  * Subscription rates matching the billing frequency will be included in the
2268
3635
  * response.
2269
3636
  */
2270
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
3637
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
2271
3638
  /**
2272
3639
  * List of pricing group key value pairs, rates containing the matching key / value
2273
3640
  * pairs will be included in the response.
2274
3641
  */
2275
- partial_pricing_group_values?: Record<string, string>;
3642
+ partial_pricing_group_values?: {
3643
+ [key: string]: string;
3644
+ };
2276
3645
  /**
2277
3646
  * List of pricing group key value pairs, rates matching all of the key / value
2278
3647
  * pairs will be included in the response.
2279
3648
  */
2280
- pricing_group_values?: Record<string, string>;
3649
+ pricing_group_values?: {
3650
+ [key: string]: string;
3651
+ };
2281
3652
  /**
2282
3653
  * Rates matching the product id will be included in the response.
2283
3654
  */
@@ -2289,6 +3660,11 @@ export declare namespace ContractRetrieveRateScheduleParams {
2289
3660
  product_tags?: Array<string>;
2290
3661
  }
2291
3662
  }
3663
+ export interface ContractRetrieveSubscriptionQuantityHistoryParams {
3664
+ contract_id: string;
3665
+ customer_id: string;
3666
+ subscription_id: string;
3667
+ }
2292
3668
  export interface ContractScheduleProServicesInvoiceParams {
2293
3669
  contract_id: string;
2294
3670
  customer_id: string;
@@ -2377,9 +3753,9 @@ export interface ContractUpdateEndDateParams {
2377
3753
  ending_before?: string;
2378
3754
  }
2379
3755
  export declare namespace Contracts {
2380
- export { type ContractCreateResponse as ContractCreateResponse, type ContractRetrieveResponse as ContractRetrieveResponse, type ContractListResponse as ContractListResponse, type ContractAmendResponse as ContractAmendResponse, type ContractArchiveResponse as ContractArchiveResponse, type ContractCreateHistoricalInvoicesResponse as ContractCreateHistoricalInvoicesResponse, type ContractListBalancesResponse as ContractListBalancesResponse, type ContractRetrieveRateScheduleResponse as ContractRetrieveRateScheduleResponse, type ContractScheduleProServicesInvoiceResponse as ContractScheduleProServicesInvoiceResponse, type ContractUpdateEndDateResponse as ContractUpdateEndDateResponse, type ContractCreateParams as ContractCreateParams, type ContractRetrieveParams as ContractRetrieveParams, type ContractListParams as ContractListParams, type ContractAddManualBalanceEntryParams as ContractAddManualBalanceEntryParams, type ContractAmendParams as ContractAmendParams, type ContractArchiveParams as ContractArchiveParams, type ContractCreateHistoricalInvoicesParams as ContractCreateHistoricalInvoicesParams, type ContractListBalancesParams as ContractListBalancesParams, type ContractRetrieveRateScheduleParams as ContractRetrieveRateScheduleParams, type ContractScheduleProServicesInvoiceParams as ContractScheduleProServicesInvoiceParams, type ContractSetUsageFilterParams as ContractSetUsageFilterParams, type ContractUpdateEndDateParams as ContractUpdateEndDateParams, };
3756
+ export { type ContractCreateResponse as ContractCreateResponse, type ContractRetrieveResponse as ContractRetrieveResponse, type ContractListResponse as ContractListResponse, type ContractAmendResponse as ContractAmendResponse, type ContractArchiveResponse as ContractArchiveResponse, type ContractCreateHistoricalInvoicesResponse as ContractCreateHistoricalInvoicesResponse, type ContractListBalancesResponse as ContractListBalancesResponse, type ContractRetrieveRateScheduleResponse as ContractRetrieveRateScheduleResponse, type ContractRetrieveSubscriptionQuantityHistoryResponse as ContractRetrieveSubscriptionQuantityHistoryResponse, type ContractScheduleProServicesInvoiceResponse as ContractScheduleProServicesInvoiceResponse, type ContractUpdateEndDateResponse as ContractUpdateEndDateResponse, type ContractCreateParams as ContractCreateParams, type ContractRetrieveParams as ContractRetrieveParams, type ContractListParams as ContractListParams, type ContractAddManualBalanceEntryParams as ContractAddManualBalanceEntryParams, type ContractAmendParams as ContractAmendParams, type ContractArchiveParams as ContractArchiveParams, type ContractCreateHistoricalInvoicesParams as ContractCreateHistoricalInvoicesParams, type ContractListBalancesParams as ContractListBalancesParams, type ContractRetrieveRateScheduleParams as ContractRetrieveRateScheduleParams, type ContractRetrieveSubscriptionQuantityHistoryParams as ContractRetrieveSubscriptionQuantityHistoryParams, type ContractScheduleProServicesInvoiceParams as ContractScheduleProServicesInvoiceParams, type ContractSetUsageFilterParams as ContractSetUsageFilterParams, type ContractUpdateEndDateParams as ContractUpdateEndDateParams, };
2381
3757
  export { Products as Products, type ProductListItemState as ProductListItemState, type QuantityConversion as QuantityConversion, type QuantityRounding as QuantityRounding, type ProductCreateResponse as ProductCreateResponse, type ProductRetrieveResponse as ProductRetrieveResponse, type ProductUpdateResponse as ProductUpdateResponse, type ProductListResponse as ProductListResponse, type ProductArchiveResponse as ProductArchiveResponse, ProductListResponsesCursorPage as ProductListResponsesCursorPage, type ProductCreateParams as ProductCreateParams, type ProductRetrieveParams as ProductRetrieveParams, type ProductUpdateParams as ProductUpdateParams, type ProductListParams as ProductListParams, type ProductArchiveParams as ProductArchiveParams, };
2382
- export { RateCards as RateCards, type RateCardCreateResponse as RateCardCreateResponse, type RateCardRetrieveResponse as RateCardRetrieveResponse, type RateCardUpdateResponse as RateCardUpdateResponse, type RateCardListResponse as RateCardListResponse, type RateCardRetrieveRateScheduleResponse as RateCardRetrieveRateScheduleResponse, RateCardListResponsesCursorPage as RateCardListResponsesCursorPage, type RateCardCreateParams as RateCardCreateParams, type RateCardRetrieveParams as RateCardRetrieveParams, type RateCardUpdateParams as RateCardUpdateParams, type RateCardListParams as RateCardListParams, type RateCardRetrieveRateScheduleParams as RateCardRetrieveRateScheduleParams, };
3758
+ export { RateCards as RateCards, type RateCardCreateResponse as RateCardCreateResponse, type RateCardRetrieveResponse as RateCardRetrieveResponse, type RateCardUpdateResponse as RateCardUpdateResponse, type RateCardListResponse as RateCardListResponse, type RateCardArchiveResponse as RateCardArchiveResponse, type RateCardRetrieveRateScheduleResponse as RateCardRetrieveRateScheduleResponse, RateCardListResponsesCursorPage as RateCardListResponsesCursorPage, type RateCardCreateParams as RateCardCreateParams, type RateCardRetrieveParams as RateCardRetrieveParams, type RateCardUpdateParams as RateCardUpdateParams, type RateCardListParams as RateCardListParams, type RateCardArchiveParams as RateCardArchiveParams, type RateCardRetrieveRateScheduleParams as RateCardRetrieveRateScheduleParams, };
2383
3759
  export { NamedSchedules as NamedSchedules, type NamedScheduleRetrieveResponse as NamedScheduleRetrieveResponse, type NamedScheduleRetrieveParams as NamedScheduleRetrieveParams, type NamedScheduleUpdateParams as NamedScheduleUpdateParams, };
2384
3760
  }
2385
3761
  //# sourceMappingURL=contracts.d.ts.map