orb-billing 5.43.0 → 5.45.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 (265) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/core.d.ts +1 -1
  3. package/core.d.ts.map +1 -1
  4. package/core.js +13 -17
  5. package/core.js.map +1 -1
  6. package/core.mjs +13 -17
  7. package/core.mjs.map +1 -1
  8. package/index.d.mts +91 -5
  9. package/index.d.ts +91 -5
  10. package/index.d.ts.map +1 -1
  11. package/index.js +90 -2
  12. package/index.js.map +1 -1
  13. package/index.mjs +91 -3
  14. package/index.mjs.map +1 -1
  15. package/internal/utils/query.d.ts +2 -0
  16. package/internal/utils/query.d.ts.map +1 -0
  17. package/internal/utils/query.js +33 -0
  18. package/internal/utils/query.js.map +1 -0
  19. package/internal/utils/query.mjs +6 -0
  20. package/internal/utils/query.mjs.map +1 -0
  21. package/package.json +1 -1
  22. package/resources/alerts.d.ts +32 -1
  23. package/resources/alerts.d.ts.map +1 -1
  24. package/resources/alerts.js +6 -0
  25. package/resources/alerts.js.map +1 -1
  26. package/resources/alerts.mjs +6 -0
  27. package/resources/alerts.mjs.map +1 -1
  28. package/resources/beta/beta.d.ts +8293 -140
  29. package/resources/beta/beta.d.ts.map +1 -1
  30. package/resources/beta/beta.js +5 -0
  31. package/resources/beta/beta.js.map +1 -1
  32. package/resources/beta/beta.mjs +5 -0
  33. package/resources/beta/beta.mjs.map +1 -1
  34. package/resources/beta/external-plan-id.d.ts +8293 -140
  35. package/resources/beta/external-plan-id.d.ts.map +1 -1
  36. package/resources/beta/external-plan-id.js +5 -0
  37. package/resources/beta/external-plan-id.js.map +1 -1
  38. package/resources/beta/external-plan-id.mjs +5 -0
  39. package/resources/beta/external-plan-id.mjs.map +1 -1
  40. package/resources/coupons/coupons.d.ts +3 -0
  41. package/resources/coupons/coupons.d.ts.map +1 -1
  42. package/resources/coupons/coupons.js +3 -0
  43. package/resources/coupons/coupons.js.map +1 -1
  44. package/resources/coupons/coupons.mjs +3 -0
  45. package/resources/coupons/coupons.mjs.map +1 -1
  46. package/resources/coupons/subscriptions.d.ts +3 -0
  47. package/resources/coupons/subscriptions.d.ts.map +1 -1
  48. package/resources/coupons/subscriptions.js +3 -0
  49. package/resources/coupons/subscriptions.js.map +1 -1
  50. package/resources/coupons/subscriptions.mjs +3 -0
  51. package/resources/coupons/subscriptions.mjs.map +1 -1
  52. package/resources/credit-blocks.d.ts +85 -1
  53. package/resources/credit-blocks.d.ts.map +1 -1
  54. package/resources/credit-blocks.js +22 -0
  55. package/resources/credit-blocks.js.map +1 -1
  56. package/resources/credit-blocks.mjs +22 -0
  57. package/resources/credit-blocks.mjs.map +1 -1
  58. package/resources/credit-notes.d.ts +4 -0
  59. package/resources/credit-notes.d.ts.map +1 -1
  60. package/resources/credit-notes.js +4 -0
  61. package/resources/credit-notes.js.map +1 -1
  62. package/resources/credit-notes.mjs +4 -0
  63. package/resources/credit-notes.mjs.map +1 -1
  64. package/resources/customers/balance-transactions.d.ts +16 -0
  65. package/resources/customers/balance-transactions.d.ts.map +1 -1
  66. package/resources/customers/balance-transactions.js +16 -0
  67. package/resources/customers/balance-transactions.js.map +1 -1
  68. package/resources/customers/balance-transactions.mjs +16 -0
  69. package/resources/customers/balance-transactions.mjs.map +1 -1
  70. package/resources/customers/costs.d.ts +16 -0
  71. package/resources/customers/costs.d.ts.map +1 -1
  72. package/resources/customers/costs.js +16 -0
  73. package/resources/customers/costs.js.map +1 -1
  74. package/resources/customers/costs.mjs +16 -0
  75. package/resources/customers/costs.mjs.map +1 -1
  76. package/resources/customers/credits/credits.d.ts +39 -0
  77. package/resources/customers/credits/credits.d.ts.map +1 -1
  78. package/resources/customers/credits/credits.js +3 -0
  79. package/resources/customers/credits/credits.js.map +1 -1
  80. package/resources/customers/credits/credits.mjs +3 -0
  81. package/resources/customers/credits/credits.mjs.map +1 -1
  82. package/resources/customers/credits/ledger.d.ts +31 -4
  83. package/resources/customers/credits/ledger.d.ts.map +1 -1
  84. package/resources/customers/credits/ledger.js +19 -2
  85. package/resources/customers/credits/ledger.js.map +1 -1
  86. package/resources/customers/credits/ledger.mjs +19 -2
  87. package/resources/customers/credits/ledger.mjs.map +1 -1
  88. package/resources/customers/credits/top-ups.d.ts +3 -0
  89. package/resources/customers/credits/top-ups.d.ts.map +1 -1
  90. package/resources/customers/credits/top-ups.js +3 -0
  91. package/resources/customers/credits/top-ups.js.map +1 -1
  92. package/resources/customers/credits/top-ups.mjs +3 -0
  93. package/resources/customers/credits/top-ups.mjs.map +1 -1
  94. package/resources/customers/customers.d.ts +33 -12
  95. package/resources/customers/customers.d.ts.map +1 -1
  96. package/resources/customers/customers.js +20 -3
  97. package/resources/customers/customers.js.map +1 -1
  98. package/resources/customers/customers.mjs +20 -3
  99. package/resources/customers/customers.mjs.map +1 -1
  100. package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts +1 -1
  101. package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts.map +1 -1
  102. package/resources/events/backfills.d.ts +5 -0
  103. package/resources/events/backfills.d.ts.map +1 -1
  104. package/resources/events/backfills.js +5 -0
  105. package/resources/events/backfills.js.map +1 -1
  106. package/resources/events/backfills.mjs +5 -0
  107. package/resources/events/backfills.mjs.map +1 -1
  108. package/resources/events/events.d.ts +5 -0
  109. package/resources/events/events.d.ts.map +1 -1
  110. package/resources/events/events.js +5 -0
  111. package/resources/events/events.js.map +1 -1
  112. package/resources/events/events.mjs +5 -0
  113. package/resources/events/events.mjs.map +1 -1
  114. package/resources/events/volume.d.ts +5 -0
  115. package/resources/events/volume.d.ts.map +1 -1
  116. package/resources/events/volume.js +5 -0
  117. package/resources/events/volume.js.map +1 -1
  118. package/resources/events/volume.mjs +5 -0
  119. package/resources/events/volume.mjs.map +1 -1
  120. package/resources/index.d.ts +4 -2
  121. package/resources/index.d.ts.map +1 -1
  122. package/resources/index.js +7 -1
  123. package/resources/index.js.map +1 -1
  124. package/resources/index.mjs +3 -1
  125. package/resources/index.mjs.map +1 -1
  126. package/resources/invoice-line-items.d.ts +6 -0
  127. package/resources/invoice-line-items.d.ts.map +1 -1
  128. package/resources/invoice-line-items.js +6 -0
  129. package/resources/invoice-line-items.js.map +1 -1
  130. package/resources/invoice-line-items.mjs +6 -0
  131. package/resources/invoice-line-items.mjs.map +1 -1
  132. package/resources/invoices.d.ts +432 -7
  133. package/resources/invoices.d.ts.map +1 -1
  134. package/resources/invoices.js +18 -5
  135. package/resources/invoices.js.map +1 -1
  136. package/resources/invoices.mjs +18 -5
  137. package/resources/invoices.mjs.map +1 -1
  138. package/resources/items.d.ts +6 -2
  139. package/resources/items.d.ts.map +1 -1
  140. package/resources/items.js +4 -0
  141. package/resources/items.js.map +1 -1
  142. package/resources/items.mjs +4 -0
  143. package/resources/items.mjs.map +1 -1
  144. package/resources/license-types.d.ts +113 -0
  145. package/resources/license-types.d.ts.map +1 -0
  146. package/resources/license-types.js +44 -0
  147. package/resources/license-types.js.map +1 -0
  148. package/resources/license-types.mjs +39 -0
  149. package/resources/license-types.mjs.map +1 -0
  150. package/resources/licenses/external-licenses.d.ts +114 -0
  151. package/resources/licenses/external-licenses.d.ts.map +1 -0
  152. package/resources/licenses/external-licenses.js +18 -0
  153. package/resources/licenses/external-licenses.js.map +1 -0
  154. package/resources/licenses/external-licenses.mjs +14 -0
  155. package/resources/licenses/external-licenses.mjs.map +1 -0
  156. package/resources/licenses/index.d.ts +4 -0
  157. package/resources/licenses/index.d.ts.map +1 -0
  158. package/resources/licenses/index.js +12 -0
  159. package/resources/licenses/index.js.map +1 -0
  160. package/resources/licenses/index.mjs +5 -0
  161. package/resources/licenses/index.mjs.map +1 -0
  162. package/resources/licenses/licenses.d.ts +133 -0
  163. package/resources/licenses/licenses.d.ts.map +1 -0
  164. package/resources/licenses/licenses.js +86 -0
  165. package/resources/licenses/licenses.js.map +1 -0
  166. package/resources/licenses/licenses.mjs +58 -0
  167. package/resources/licenses/licenses.mjs.map +1 -0
  168. package/resources/licenses/usage.d.ts +211 -0
  169. package/resources/licenses/usage.d.ts.map +1 -0
  170. package/resources/licenses/usage.js +25 -0
  171. package/resources/licenses/usage.js.map +1 -0
  172. package/resources/licenses/usage.mjs +21 -0
  173. package/resources/licenses/usage.mjs.map +1 -0
  174. package/resources/licenses.d.ts +2 -0
  175. package/resources/licenses.d.ts.map +1 -0
  176. package/resources/licenses.js +19 -0
  177. package/resources/licenses.js.map +1 -0
  178. package/resources/licenses.mjs +3 -0
  179. package/resources/licenses.mjs.map +1 -0
  180. package/resources/metrics.d.ts +7 -0
  181. package/resources/metrics.d.ts.map +1 -1
  182. package/resources/metrics.js +4 -0
  183. package/resources/metrics.js.map +1 -1
  184. package/resources/metrics.mjs +4 -0
  185. package/resources/metrics.mjs.map +1 -1
  186. package/resources/plans/external-plan-id.d.ts +5 -0
  187. package/resources/plans/external-plan-id.d.ts.map +1 -1
  188. package/resources/plans/external-plan-id.js +5 -0
  189. package/resources/plans/external-plan-id.js.map +1 -1
  190. package/resources/plans/external-plan-id.mjs +5 -0
  191. package/resources/plans/external-plan-id.mjs.map +1 -1
  192. package/resources/plans/migrations.d.ts +5 -0
  193. package/resources/plans/migrations.d.ts.map +1 -1
  194. package/resources/plans/migrations.js +5 -0
  195. package/resources/plans/migrations.js.map +1 -1
  196. package/resources/plans/migrations.mjs +5 -0
  197. package/resources/plans/migrations.mjs.map +1 -1
  198. package/resources/plans/plans.d.ts +4200 -121
  199. package/resources/plans/plans.d.ts.map +1 -1
  200. package/resources/plans/plans.js +5 -0
  201. package/resources/plans/plans.js.map +1 -1
  202. package/resources/plans/plans.mjs +5 -0
  203. package/resources/plans/plans.mjs.map +1 -1
  204. package/resources/prices/external-price-id.d.ts +9 -0
  205. package/resources/prices/external-price-id.d.ts.map +1 -1
  206. package/resources/prices/external-price-id.js +9 -0
  207. package/resources/prices/external-price-id.js.map +1 -1
  208. package/resources/prices/external-price-id.mjs +9 -0
  209. package/resources/prices/external-price-id.mjs.map +1 -1
  210. package/resources/prices/prices.d.ts +198 -0
  211. package/resources/prices/prices.d.ts.map +1 -1
  212. package/resources/prices/prices.js +9 -0
  213. package/resources/prices/prices.js.map +1 -1
  214. package/resources/prices/prices.mjs +9 -0
  215. package/resources/prices/prices.mjs.map +1 -1
  216. package/resources/shared.d.ts +1040 -6
  217. package/resources/shared.d.ts.map +1 -1
  218. package/resources/shared.js.map +1 -1
  219. package/resources/shared.mjs.map +1 -1
  220. package/resources/subscriptions.d.ts +262 -0
  221. package/resources/subscriptions.d.ts.map +1 -1
  222. package/resources/subscriptions.js.map +1 -1
  223. package/resources/subscriptions.mjs.map +1 -1
  224. package/src/core.ts +16 -21
  225. package/src/index.ts +149 -5
  226. package/src/internal/utils/query.ts +7 -0
  227. package/src/resources/alerts.ts +38 -1
  228. package/src/resources/beta/beta.ts +9945 -194
  229. package/src/resources/beta/external-plan-id.ts +9945 -194
  230. package/src/resources/coupons/coupons.ts +3 -0
  231. package/src/resources/coupons/subscriptions.ts +3 -0
  232. package/src/resources/credit-blocks.ts +110 -1
  233. package/src/resources/credit-notes.ts +4 -0
  234. package/src/resources/customers/balance-transactions.ts +16 -0
  235. package/src/resources/customers/costs.ts +16 -0
  236. package/src/resources/customers/credits/credits.ts +45 -0
  237. package/src/resources/customers/credits/ledger.ts +33 -4
  238. package/src/resources/customers/credits/top-ups.ts +3 -0
  239. package/src/resources/customers/customers.ts +61 -12
  240. package/src/resources/dimensional-price-groups/external-dimensional-price-group-id.ts +1 -1
  241. package/src/resources/events/backfills.ts +5 -0
  242. package/src/resources/events/events.ts +5 -0
  243. package/src/resources/events/volume.ts +5 -0
  244. package/src/resources/index.ts +29 -1
  245. package/src/resources/invoice-line-items.ts +6 -0
  246. package/src/resources/invoices.ts +523 -6
  247. package/src/resources/items.ts +8 -2
  248. package/src/resources/license-types.ts +163 -0
  249. package/src/resources/licenses/external-licenses.ts +147 -0
  250. package/src/resources/licenses/index.ts +27 -0
  251. package/src/resources/licenses/licenses.ts +248 -0
  252. package/src/resources/licenses/usage.ts +280 -0
  253. package/src/resources/licenses.ts +3 -0
  254. package/src/resources/metrics.ts +6 -0
  255. package/src/resources/plans/external-plan-id.ts +5 -0
  256. package/src/resources/plans/migrations.ts +5 -0
  257. package/src/resources/plans/plans.ts +5004 -126
  258. package/src/resources/prices/external-price-id.ts +9 -0
  259. package/src/resources/prices/prices.ts +237 -0
  260. package/src/resources/shared.ts +1213 -0
  261. package/src/resources/subscriptions.ts +311 -0
  262. package/src/version.ts +1 -1
  263. package/version.d.ts +1 -1
  264. package/version.js +1 -1
  265. package/version.mjs +1 -1
@@ -8,6 +8,9 @@ import * as SubscriptionsAPI from './subscriptions';
8
8
  import { SubscriptionListParams, Subscriptions } from './subscriptions';
9
9
  import { Page, type PageParams } from '../../pagination';
10
10
 
11
+ /**
12
+ * A coupon represents a reusable discount configuration that can be applied either as a fixed or percentage amount to an invoice or subscription. Coupons are activated using a redemption code, which applies the discount to a subscription or invoice. The duration of a coupon determines how long it remains available for use by end users.
13
+ */
11
14
  export class Coupons extends APIResource {
12
15
  subscriptions: SubscriptionsAPI.Subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
13
16
 
@@ -7,6 +7,9 @@ import * as SubscriptionsAPI from '../subscriptions';
7
7
  import { SubscriptionsPage } from '../subscriptions';
8
8
  import { type PageParams } from '../../pagination';
9
9
 
10
+ /**
11
+ * A coupon represents a reusable discount configuration that can be applied either as a fixed or percentage amount to an invoice or subscription. Coupons are activated using a redemption code, which applies the discount to a subscription or invoice. The duration of a coupon determines how long it remains available for use by end users.
12
+ */
10
13
  export class Subscriptions extends APIResource {
11
14
  /**
12
15
  * This endpoint returns a list of all subscriptions that have redeemed a given
@@ -2,7 +2,11 @@
2
2
 
3
3
  import { APIResource } from '../resource';
4
4
  import * as Core from '../core';
5
+ import * as Shared from './shared';
5
6
 
7
+ /**
8
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits within Orb.
9
+ */
6
10
  export class CreditBlocks extends APIResource {
7
11
  /**
8
12
  * This endpoint returns a credit block identified by its block_id.
@@ -34,6 +38,29 @@ export class CreditBlocks extends APIResource {
34
38
  headers: { Accept: '*/*', ...options?.headers },
35
39
  });
36
40
  }
41
+
42
+ /**
43
+ * This endpoint returns the credit block and its associated purchasing invoices.
44
+ *
45
+ * If a credit block was purchased (as opposed to being manually added or allocated
46
+ * from a subscription), this endpoint returns the invoices that were created to
47
+ * charge the customer for the credit block. For credit blocks with payment
48
+ * schedules spanning multiple periods (e.g., monthly payments over 12 months),
49
+ * multiple invoices will be returned.
50
+ *
51
+ * If the credit block was not purchased (e.g., manual increment, allocation), an
52
+ * empty invoices list is returned.
53
+ *
54
+ * **Note: This endpoint is currently experimental and its interface may change in
55
+ * future releases. Please contact support before building production integrations
56
+ * against this endpoint.**
57
+ */
58
+ listInvoices(
59
+ blockId: string,
60
+ options?: Core.RequestOptions,
61
+ ): Core.APIPromise<CreditBlockListInvoicesResponse> {
62
+ return this._client.get(`/credit_blocks/${blockId}/invoices`, options);
63
+ }
37
64
  }
38
65
 
39
66
  /**
@@ -52,6 +79,14 @@ export interface CreditBlockRetrieveResponse {
52
79
 
53
80
  maximum_initial_balance: number | null;
54
81
 
82
+ /**
83
+ * User specified key-value pairs for the resource. If not present, this defaults
84
+ * to an empty dictionary. Individual keys can be removed by setting the value to
85
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
86
+ * `null`.
87
+ */
88
+ metadata: { [key: string]: string };
89
+
55
90
  per_unit_cost_basis: string | null;
56
91
 
57
92
  status: 'active' | 'pending_payment';
@@ -76,6 +111,80 @@ export namespace CreditBlockRetrieveResponse {
76
111
  }
77
112
  }
78
113
 
114
+ export interface CreditBlockListInvoicesResponse {
115
+ /**
116
+ * The Credit Block resource models prepaid credits within Orb.
117
+ */
118
+ block: CreditBlockListInvoicesResponse.Block;
119
+
120
+ invoices: Array<CreditBlockListInvoicesResponse.Invoice>;
121
+ }
122
+
123
+ export namespace CreditBlockListInvoicesResponse {
124
+ /**
125
+ * The Credit Block resource models prepaid credits within Orb.
126
+ */
127
+ export interface Block {
128
+ id: string;
129
+
130
+ balance: number;
131
+
132
+ effective_date: string | null;
133
+
134
+ expiry_date: string | null;
135
+
136
+ filters: Array<Block.Filter>;
137
+
138
+ maximum_initial_balance: number | null;
139
+
140
+ /**
141
+ * User specified key-value pairs for the resource. If not present, this defaults
142
+ * to an empty dictionary. Individual keys can be removed by setting the value to
143
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
144
+ * `null`.
145
+ */
146
+ metadata: { [key: string]: string };
147
+
148
+ per_unit_cost_basis: string | null;
149
+
150
+ status: 'active' | 'pending_payment';
151
+ }
152
+
153
+ export namespace Block {
154
+ export interface Filter {
155
+ /**
156
+ * The property of the price to filter on.
157
+ */
158
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
159
+
160
+ /**
161
+ * Should prices that match the filter be included or excluded.
162
+ */
163
+ operator: 'includes' | 'excludes';
164
+
165
+ /**
166
+ * The IDs or values that match this filter.
167
+ */
168
+ values: Array<string>;
169
+ }
170
+ }
171
+
172
+ export interface Invoice {
173
+ id: string;
174
+
175
+ customer: Shared.CustomerMinified;
176
+
177
+ invoice_number: string;
178
+
179
+ status: 'issued' | 'paid' | 'synced' | 'void' | 'draft';
180
+
181
+ subscription: Shared.SubscriptionMinified | null;
182
+ }
183
+ }
184
+
79
185
  export declare namespace CreditBlocks {
80
- export { type CreditBlockRetrieveResponse as CreditBlockRetrieveResponse };
186
+ export {
187
+ type CreditBlockRetrieveResponse as CreditBlockRetrieveResponse,
188
+ type CreditBlockListInvoicesResponse as CreditBlockListInvoicesResponse,
189
+ };
81
190
  }
@@ -7,6 +7,10 @@ import * as Shared from './shared';
7
7
  import { CreditNotesPage } from './shared';
8
8
  import { type PageParams } from '../pagination';
9
9
 
10
+ /**
11
+ * The [Credit Note](/invoicing/credit-notes) resource represents a credit that has been applied to a
12
+ * particular invoice.
13
+ */
10
14
  export class CreditNotes extends APIResource {
11
15
  /**
12
16
  * This endpoint is used to create a single
@@ -6,6 +6,22 @@ import * as Core from '../../core';
6
6
  import * as Shared from '../shared';
7
7
  import { Page, type PageParams } from '../../pagination';
8
8
 
9
+ /**
10
+ * A customer is a buyer of your products, and the other party to the billing relationship.
11
+ *
12
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often desirable to have these
13
+ * match existing identifiers in your system. To avoid having to denormalize Orb ID information, you can pass in an
14
+ * `external_customer_id` with your own identifier. See
15
+ * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further information about how these
16
+ * aliases work in Orb.
17
+ *
18
+ * In addition to having an identifier in your system, a customer may exist in a payment provider solution like
19
+ * Stripe. Use the `payment_provider_id` and the `payment_provider` enum field to express this mapping.
20
+ *
21
+ * A customer also has a timezone (from the standard [IANA timezone database](https://www.iana.org/time-zones)), which
22
+ * defaults to your account's timezone. See [Timezone localization](/essentials/timezones) for
23
+ * information on what this timezone parameter influences within Orb.
24
+ */
9
25
  export class BalanceTransactions extends APIResource {
10
26
  /**
11
27
  * Creates an immutable balance transaction that updates the customer's balance and
@@ -5,6 +5,22 @@ import { isRequestOptions } from '../../core';
5
5
  import * as Core from '../../core';
6
6
  import * as Shared from '../shared';
7
7
 
8
+ /**
9
+ * A customer is a buyer of your products, and the other party to the billing relationship.
10
+ *
11
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often desirable to have these
12
+ * match existing identifiers in your system. To avoid having to denormalize Orb ID information, you can pass in an
13
+ * `external_customer_id` with your own identifier. See
14
+ * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further information about how these
15
+ * aliases work in Orb.
16
+ *
17
+ * In addition to having an identifier in your system, a customer may exist in a payment provider solution like
18
+ * Stripe. Use the `payment_provider_id` and the `payment_provider` enum field to express this mapping.
19
+ *
20
+ * A customer also has a timezone (from the standard [IANA timezone database](https://www.iana.org/time-zones)), which
21
+ * defaults to your account's timezone. See [Timezone localization](/essentials/timezones) for
22
+ * information on what this timezone parameter influences within Orb.
23
+ */
8
24
  export class Costs extends APIResource {
9
25
  /**
10
26
  * This endpoint is used to fetch a day-by-day snapshot of a customer's costs in
@@ -42,6 +42,9 @@ import {
42
42
  } from './top-ups';
43
43
  import { Page, type PageParams } from '../../../pagination';
44
44
 
45
+ /**
46
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits within Orb.
47
+ */
45
48
  export class Credits extends APIResource {
46
49
  ledger: LedgerAPI.Ledger = new LedgerAPI.Ledger(this._client);
47
50
  topUps: TopUpsAPI.TopUps = new TopUpsAPI.TopUps(this._client);
@@ -54,6 +57,11 @@ export class Credits extends APIResource {
54
57
  *
55
58
  * Note that `currency` defaults to credits if not specified. To use a real world
56
59
  * currency, set `currency` to an ISO 4217 string.
60
+ *
61
+ * Results can be filtered by the block's `effective_date` using the
62
+ * `effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and
63
+ * `effective_date[lte]` query parameters. This filters on when the credit block
64
+ * becomes effective, which may differ from creation time for backdated credits.
57
65
  */
58
66
  list(
59
67
  customerId: string,
@@ -86,6 +94,11 @@ export class Credits extends APIResource {
86
94
  *
87
95
  * Note that `currency` defaults to credits if not specified. To use a real world
88
96
  * currency, set `currency` to an ISO 4217 string.
97
+ *
98
+ * Results can be filtered by the block's `effective_date` using the
99
+ * `effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and
100
+ * `effective_date[lte]` query parameters. This filters on when the credit block
101
+ * becomes effective, which may differ from creation time for backdated credits.
89
102
  */
90
103
  listByExternalId(
91
104
  externalCustomerId: string,
@@ -129,6 +142,14 @@ export interface CreditListResponse {
129
142
 
130
143
  maximum_initial_balance: number | null;
131
144
 
145
+ /**
146
+ * User specified key-value pairs for the resource. If not present, this defaults
147
+ * to an empty dictionary. Individual keys can be removed by setting the value to
148
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
149
+ * `null`.
150
+ */
151
+ metadata: { [key: string]: string };
152
+
132
153
  per_unit_cost_basis: string | null;
133
154
 
134
155
  status: 'active' | 'pending_payment';
@@ -169,6 +190,14 @@ export interface CreditListByExternalIDResponse {
169
190
 
170
191
  maximum_initial_balance: number | null;
171
192
 
193
+ /**
194
+ * User specified key-value pairs for the resource. If not present, this defaults
195
+ * to an empty dictionary. Individual keys can be removed by setting the value to
196
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
197
+ * `null`.
198
+ */
199
+ metadata: { [key: string]: string };
200
+
172
201
  per_unit_cost_basis: string | null;
173
202
 
174
203
  status: 'active' | 'pending_payment';
@@ -202,6 +231,14 @@ export interface CreditListParams extends PageParams {
202
231
  */
203
232
  currency?: string | null;
204
233
 
234
+ 'effective_date[gt]'?: string | null;
235
+
236
+ 'effective_date[gte]'?: string | null;
237
+
238
+ 'effective_date[lt]'?: string | null;
239
+
240
+ 'effective_date[lte]'?: string | null;
241
+
205
242
  /**
206
243
  * If set to True, all expired and depleted blocks, as well as active block will be
207
244
  * returned.
@@ -215,6 +252,14 @@ export interface CreditListByExternalIDParams extends PageParams {
215
252
  */
216
253
  currency?: string | null;
217
254
 
255
+ 'effective_date[gt]'?: string | null;
256
+
257
+ 'effective_date[gte]'?: string | null;
258
+
259
+ 'effective_date[lt]'?: string | null;
260
+
261
+ 'effective_date[lte]'?: string | null;
262
+
218
263
  /**
219
264
  * If set to True, all expired and depleted blocks, as well as active block will be
220
265
  * returned.
@@ -6,6 +6,9 @@ import * as Core from '../../../core';
6
6
  import * as Shared from '../../shared';
7
7
  import { Page, type PageParams } from '../../../pagination';
8
8
 
9
+ /**
10
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits within Orb.
11
+ */
9
12
  export class Ledger extends APIResource {
10
13
  /**
11
14
  * The credits ledger provides _auditing_ functionality over Orb's credits system
@@ -162,7 +165,14 @@ export class Ledger extends APIResource {
162
165
  * also generate a one-off invoice for the customer for the credits pre-purchase.
163
166
  * Note that you _must_ provide the `per_unit_cost_basis`, since the total charges
164
167
  * on the invoice are calculated by multiplying the cost basis with the number of
165
- * credit units added.
168
+ * credit units added. If you invoice or handle payment of credits outside of Orb
169
+ * (i.e. marketplace customers), set `mark_as_paid` in the `invoice_settings` to
170
+ * `true` to prevent duplicate invoicing effects.
171
+ *
172
+ * - if `per_unit_cost_basis` is greater than zero, an invoice will be generated
173
+ * and `invoice_settings` must be included
174
+ * - if `invoice_settings` is passed, one of either `custom_due_date` or
175
+ * `net_terms` is required to determine the due date
166
176
  *
167
177
  * ## Deducting Credits
168
178
  *
@@ -282,7 +292,14 @@ export class Ledger extends APIResource {
282
292
  * also generate a one-off invoice for the customer for the credits pre-purchase.
283
293
  * Note that you _must_ provide the `per_unit_cost_basis`, since the total charges
284
294
  * on the invoice are calculated by multiplying the cost basis with the number of
285
- * credit units added.
295
+ * credit units added. If you invoice or handle payment of credits outside of Orb
296
+ * (i.e. marketplace customers), set `mark_as_paid` in the `invoice_settings` to
297
+ * `true` to prevent duplicate invoicing effects.
298
+ *
299
+ * - if `per_unit_cost_basis` is greater than zero, an invoice will be generated
300
+ * and `invoice_settings` must be included
301
+ * - if `invoice_settings` is passed, one of either `custom_due_date` or
302
+ * `net_terms` is required to determine the due date
286
303
  *
287
304
  * ## Deducting Credits
288
305
  *
@@ -957,6 +974,11 @@ export declare namespace LedgerCreateEntryParams {
957
974
  */
958
975
  item_id?: string | null;
959
976
 
977
+ /**
978
+ * If true, the new credits purchase invoice will be marked as paid.
979
+ */
980
+ mark_as_paid?: boolean;
981
+
960
982
  /**
961
983
  * An optional memo to display on the invoice.
962
984
  */
@@ -967,7 +989,8 @@ export declare namespace LedgerCreateEntryParams {
967
989
  * based on the invoice or issuance date, depending on the account's configured due
968
990
  * date calculation method. A value of '0' here represents that the invoice is due
969
991
  * on issue, whereas a value of '30' represents that the customer has 30 days to
970
- * pay the invoice. Do not set this field if you want to set a custom due date.
992
+ * pay the invoice. You must set either `net_terms` or `custom_due_date`, but not
993
+ * both.
971
994
  */
972
995
  net_terms?: number | null;
973
996
 
@@ -1255,6 +1278,11 @@ export declare namespace LedgerCreateEntryByExternalIDParams {
1255
1278
  */
1256
1279
  item_id?: string | null;
1257
1280
 
1281
+ /**
1282
+ * If true, the new credits purchase invoice will be marked as paid.
1283
+ */
1284
+ mark_as_paid?: boolean;
1285
+
1258
1286
  /**
1259
1287
  * An optional memo to display on the invoice.
1260
1288
  */
@@ -1265,7 +1293,8 @@ export declare namespace LedgerCreateEntryByExternalIDParams {
1265
1293
  * based on the invoice or issuance date, depending on the account's configured due
1266
1294
  * date calculation method. A value of '0' here represents that the invoice is due
1267
1295
  * on issue, whereas a value of '30' represents that the customer has 30 days to
1268
- * pay the invoice. Do not set this field if you want to set a custom due date.
1296
+ * pay the invoice. You must set either `net_terms` or `custom_due_date`, but not
1297
+ * both.
1269
1298
  */
1270
1299
  net_terms?: number | null;
1271
1300
 
@@ -5,6 +5,9 @@ import { isRequestOptions } from '../../../core';
5
5
  import * as Core from '../../../core';
6
6
  import { Page, type PageParams } from '../../../pagination';
7
7
 
8
+ /**
9
+ * The [Credit Ledger Entry resource](/product-catalog/prepurchase) models prepaid credits within Orb.
10
+ */
8
11
  export class TopUps extends APIResource {
9
12
  /**
10
13
  * This endpoint allows you to create a new top-up for a specified customer's
@@ -33,6 +33,22 @@ import {
33
33
  } from './credits/credits';
34
34
  import { Page, type PageParams } from '../../pagination';
35
35
 
36
+ /**
37
+ * A customer is a buyer of your products, and the other party to the billing relationship.
38
+ *
39
+ * In Orb, customers are assigned system generated identifiers automatically, but it's often desirable to have these
40
+ * match existing identifiers in your system. To avoid having to denormalize Orb ID information, you can pass in an
41
+ * `external_customer_id` with your own identifier. See
42
+ * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further information about how these
43
+ * aliases work in Orb.
44
+ *
45
+ * In addition to having an identifier in your system, a customer may exist in a payment provider solution like
46
+ * Stripe. Use the `payment_provider_id` and the `payment_provider` enum field to express this mapping.
47
+ *
48
+ * A customer also has a timezone (from the standard [IANA timezone database](https://www.iana.org/time-zones)), which
49
+ * defaults to your account's timezone. See [Timezone localization](/essentials/timezones) for
50
+ * information on what this timezone parameter influences within Orb.
51
+ */
36
52
  export class Customers extends APIResource {
37
53
  costs: CostsAPI.Costs = new CostsAPI.Costs(this._client);
38
54
  credits: CreditsAPI.Credits = new CreditsAPI.Credits(this._client);
@@ -60,9 +76,10 @@ export class Customers extends APIResource {
60
76
  /**
61
77
  * This endpoint can be used to update the `payment_provider`,
62
78
  * `payment_provider_id`, `name`, `email`, `email_delivery`, `tax_id`,
63
- * `auto_collection`, `metadata`, `shipping_address`, `billing_address`, and
64
- * `additional_emails` of an existing customer. Other fields on a customer are
65
- * currently immutable.
79
+ * `auto_collection`, `metadata`, `shipping_address`, `billing_address`,
80
+ * `additional_emails`, and `currency` of an existing customer. `currency` can only
81
+ * be set if it has not already been set on the customer. Other fields on a
82
+ * customer are currently immutable.
66
83
  */
67
84
  update(
68
85
  customerId: string,
@@ -292,7 +309,14 @@ export interface Customer {
292
309
  * When not in test mode, the connection must first be configured in the Orb
293
310
  * webapp.
294
311
  */
295
- payment_provider: 'quickbooks' | 'bill.com' | 'stripe_charge' | 'stripe_invoice' | 'netsuite' | null;
312
+ payment_provider:
313
+ | 'quickbooks'
314
+ | 'bill.com'
315
+ | 'stripe_charge'
316
+ | 'stripe_invoice'
317
+ | 'netsuite'
318
+ | 'netsuite_ampersand'
319
+ | null;
296
320
 
297
321
  /**
298
322
  * The ID of this customer in an external payments solution, such as Stripe. This
@@ -497,7 +521,7 @@ export namespace Customer {
497
521
  export interface AccountingProvider {
498
522
  external_provider_id: string | null;
499
523
 
500
- provider_type: 'quickbooks' | 'netsuite';
524
+ provider_type: 'quickbooks' | 'netsuite' | 'netsuite_ampersand';
501
525
  }
502
526
  }
503
527
 
@@ -674,7 +698,14 @@ export interface CustomerCreateParams {
674
698
  * When not in test mode, the connection must first be configured in the Orb
675
699
  * webapp.
676
700
  */
677
- payment_provider?: 'quickbooks' | 'bill.com' | 'stripe_charge' | 'stripe_invoice' | 'netsuite' | null;
701
+ payment_provider?:
702
+ | 'quickbooks'
703
+ | 'bill.com'
704
+ | 'stripe_charge'
705
+ | 'stripe_invoice'
706
+ | 'netsuite'
707
+ | 'netsuite_ampersand'
708
+ | null;
678
709
 
679
710
  /**
680
711
  * The ID of this customer in an external payments solution, such as Stripe. This
@@ -947,8 +978,10 @@ export interface CustomerUpdateParams {
947
978
  billing_address?: AddressInput | null;
948
979
 
949
980
  /**
950
- * An ISO 4217 currency string used for the customer's invoices and balance. If not
951
- * set at creation time, will be set at subscription creation time.
981
+ * An ISO 4217 currency string used for the customer's invoices and balance. This
982
+ * can only be set if the customer does not already have a currency configured. If
983
+ * not set at creation or update time, it will be set at subscription creation
984
+ * time.
952
985
  */
953
986
  currency?: string | null;
954
987
 
@@ -1000,7 +1033,14 @@ export interface CustomerUpdateParams {
1000
1033
  * `bill.com`, `netsuite`), any product mappings must first be configured with
1001
1034
  * the Orb team.
1002
1035
  */
1003
- payment_provider?: 'quickbooks' | 'bill.com' | 'stripe_charge' | 'stripe_invoice' | 'netsuite' | null;
1036
+ payment_provider?:
1037
+ | 'quickbooks'
1038
+ | 'bill.com'
1039
+ | 'stripe_charge'
1040
+ | 'stripe_invoice'
1041
+ | 'netsuite'
1042
+ | 'netsuite_ampersand'
1043
+ | null;
1004
1044
 
1005
1045
  /**
1006
1046
  * The ID of this customer in an external payments solution, such as Stripe. This
@@ -1276,8 +1316,10 @@ export interface CustomerUpdateByExternalIDParams {
1276
1316
  billing_address?: AddressInput | null;
1277
1317
 
1278
1318
  /**
1279
- * An ISO 4217 currency string used for the customer's invoices and balance. If not
1280
- * set at creation time, will be set at subscription creation time.
1319
+ * An ISO 4217 currency string used for the customer's invoices and balance. This
1320
+ * can only be set if the customer does not already have a currency configured. If
1321
+ * not set at creation or update time, it will be set at subscription creation
1322
+ * time.
1281
1323
  */
1282
1324
  currency?: string | null;
1283
1325
 
@@ -1329,7 +1371,14 @@ export interface CustomerUpdateByExternalIDParams {
1329
1371
  * `bill.com`, `netsuite`), any product mappings must first be configured with
1330
1372
  * the Orb team.
1331
1373
  */
1332
- payment_provider?: 'quickbooks' | 'bill.com' | 'stripe_charge' | 'stripe_invoice' | 'netsuite' | null;
1374
+ payment_provider?:
1375
+ | 'quickbooks'
1376
+ | 'bill.com'
1377
+ | 'stripe_charge'
1378
+ | 'stripe_invoice'
1379
+ | 'netsuite'
1380
+ | 'netsuite_ampersand'
1381
+ | null;
1333
1382
 
1334
1383
  /**
1335
1384
  * The ID of this customer in an external payments solution, such as Stripe. This
@@ -42,7 +42,7 @@ export interface ExternalDimensionalPriceGroupIDUpdateParams {
42
42
  * field to identify a dimensional price group by an existing identifier in your
43
43
  * system.
44
44
  */
45
- body_external_dimensional_price_group_id?: string | null;
45
+ external_dimensional_price_group_id?: string | null;
46
46
 
47
47
  /**
48
48
  * User-specified key/value pairs for the resource. Individual keys can be removed
@@ -5,6 +5,11 @@ import { isRequestOptions } from '../../core';
5
5
  import * as Core from '../../core';
6
6
  import { Page, type PageParams } from '../../pagination';
7
7
 
8
+ /**
9
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created for a
10
+ * customer. Events are the core of Orb's usage-based billing model, and are used to calculate the usage charges for
11
+ * a given billing period.
12
+ */
8
13
  export class Backfills extends APIResource {
9
14
  /**
10
15
  * Creating the backfill enables adding or replacing past events, even those that
@@ -17,6 +17,11 @@ import {
17
17
  import * as VolumeAPI from './volume';
18
18
  import { EventVolumes, Volume, VolumeListParams } from './volume';
19
19
 
20
+ /**
21
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created for a
22
+ * customer. Events are the core of Orb's usage-based billing model, and are used to calculate the usage charges for
23
+ * a given billing period.
24
+ */
20
25
  export class Events extends APIResource {
21
26
  backfills: BackfillsAPI.Backfills = new BackfillsAPI.Backfills(this._client);
22
27
  volume: VolumeAPI.Volume = new VolumeAPI.Volume(this._client);
@@ -3,6 +3,11 @@
3
3
  import { APIResource } from '../../resource';
4
4
  import * as Core from '../../core';
5
5
 
6
+ /**
7
+ * The [Event](/core-concepts#event) resource represents a usage event that has been created for a
8
+ * customer. Events are the core of Orb's usage-based billing model, and are used to calculate the usage charges for
9
+ * a given billing period.
10
+ */
6
11
  export class Volume extends APIResource {
7
12
  /**
8
13
  * This endpoint returns the event volume for an account in a
@@ -36,7 +36,11 @@ export {
36
36
  type CouponCreateParams,
37
37
  type CouponListParams,
38
38
  } from './coupons/coupons';
39
- export { CreditBlocks, type CreditBlockRetrieveResponse } from './credit-blocks';
39
+ export {
40
+ CreditBlocks,
41
+ type CreditBlockRetrieveResponse,
42
+ type CreditBlockListInvoicesResponse,
43
+ } from './credit-blocks';
40
44
  export { CreditNotes, type CreditNoteCreateParams, type CreditNoteListParams } from './credit-notes';
41
45
  export {
42
46
  CustomersPage,
@@ -82,12 +86,14 @@ export {
82
86
  InvoiceListSummaryResponsesPage,
83
87
  Invoices,
84
88
  type InvoiceFetchUpcomingResponse,
89
+ type InvoiceIssueSummaryResponse,
85
90
  type InvoiceListSummaryResponse,
86
91
  type InvoiceCreateParams,
87
92
  type InvoiceUpdateParams,
88
93
  type InvoiceListParams,
89
94
  type InvoiceFetchUpcomingParams,
90
95
  type InvoiceIssueParams,
96
+ type InvoiceIssueSummaryParams,
91
97
  type InvoiceListSummaryParams,
92
98
  type InvoiceMarkPaidParams,
93
99
  } from './invoices';
@@ -99,6 +105,28 @@ export {
99
105
  type ItemUpdateParams,
100
106
  type ItemListParams,
101
107
  } from './items';
108
+ export {
109
+ LicenseListResponsesPage,
110
+ Licenses,
111
+ type LicenseCreateResponse,
112
+ type LicenseRetrieveResponse,
113
+ type LicenseListResponse,
114
+ type LicenseDeactivateResponse,
115
+ type LicenseRetrieveByExternalIDResponse,
116
+ type LicenseCreateParams,
117
+ type LicenseListParams,
118
+ type LicenseDeactivateParams,
119
+ type LicenseRetrieveByExternalIDParams,
120
+ } from './licenses/licenses';
121
+ export {
122
+ LicenseTypeListResponsesPage,
123
+ LicenseTypes,
124
+ type LicenseTypeCreateResponse,
125
+ type LicenseTypeRetrieveResponse,
126
+ type LicenseTypeListResponse,
127
+ type LicenseTypeCreateParams,
128
+ type LicenseTypeListParams,
129
+ } from './license-types';
102
130
  export {
103
131
  PlansPage,
104
132
  Plans,
@@ -4,6 +4,12 @@ import { APIResource } from '../resource';
4
4
  import * as Core from '../core';
5
5
  import * as Shared from './shared';
6
6
 
7
+ /**
8
+ * An [`Invoice`](/core-concepts#invoice) is a fundamental billing entity, representing the request for payment for
9
+ * a single subscription. This includes a set of line items, which correspond to prices in the subscription's plan and
10
+ * can represent fixed recurring fees or usage-based fees. They are generated at the end of a billing period, or as
11
+ * the result of an action, such as a cancellation.
12
+ */
7
13
  export class InvoiceLineItems extends APIResource {
8
14
  /**
9
15
  * This creates a one-off fixed fee invoice line item on an Invoice. This can only