orb-billing 2.1.2 → 2.3.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 (93) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +29 -0
  3. package/index.d.mts +16 -5
  4. package/index.d.ts +16 -5
  5. package/index.d.ts.map +1 -1
  6. package/index.js +7 -6
  7. package/index.js.map +1 -1
  8. package/index.mjs +7 -6
  9. package/index.mjs.map +1 -1
  10. package/package.json +2 -3
  11. package/resources/coupons/coupons.d.ts +3 -22
  12. package/resources/coupons/coupons.d.ts.map +1 -1
  13. package/resources/coupons/coupons.js.map +1 -1
  14. package/resources/coupons/coupons.mjs.map +1 -1
  15. package/resources/customers/costs.d.ts +4 -4
  16. package/resources/customers/costs.d.ts.map +1 -1
  17. package/resources/customers/costs.js.map +1 -1
  18. package/resources/customers/costs.mjs.map +1 -1
  19. package/resources/customers/credits/credits.d.ts +6 -4
  20. package/resources/customers/credits/credits.d.ts.map +1 -1
  21. package/resources/customers/credits/credits.js.map +1 -1
  22. package/resources/customers/credits/credits.mjs.map +1 -1
  23. package/resources/customers/credits/ledger.d.ts +20 -10
  24. package/resources/customers/credits/ledger.d.ts.map +1 -1
  25. package/resources/customers/credits/ledger.js.map +1 -1
  26. package/resources/customers/credits/ledger.mjs.map +1 -1
  27. package/resources/customers/credits/top-ups.d.ts +38 -8
  28. package/resources/customers/credits/top-ups.d.ts.map +1 -1
  29. package/resources/customers/credits/top-ups.js.map +1 -1
  30. package/resources/customers/credits/top-ups.mjs.map +1 -1
  31. package/resources/customers/usage.d.ts +2 -2
  32. package/resources/customers/usage.d.ts.map +1 -1
  33. package/resources/customers/usage.js.map +1 -1
  34. package/resources/customers/usage.mjs.map +1 -1
  35. package/resources/index.d.ts +3 -3
  36. package/resources/index.d.ts.map +1 -1
  37. package/resources/index.js +6 -6
  38. package/resources/index.js.map +1 -1
  39. package/resources/index.mjs +2 -2
  40. package/resources/index.mjs.map +1 -1
  41. package/resources/invoices.d.ts +2 -0
  42. package/resources/invoices.d.ts.map +1 -1
  43. package/resources/invoices.js.map +1 -1
  44. package/resources/invoices.mjs.map +1 -1
  45. package/resources/plans/plans.d.ts +65 -0
  46. package/resources/plans/plans.d.ts.map +1 -1
  47. package/resources/plans/plans.js.map +1 -1
  48. package/resources/plans/plans.mjs.map +1 -1
  49. package/resources/prices/index.d.ts +1 -1
  50. package/resources/prices/index.d.ts.map +1 -1
  51. package/resources/prices/index.js +3 -3
  52. package/resources/prices/index.js.map +1 -1
  53. package/resources/prices/index.mjs +1 -1
  54. package/resources/prices/index.mjs.map +1 -1
  55. package/resources/prices/prices.d.ts +301 -2
  56. package/resources/prices/prices.d.ts.map +1 -1
  57. package/resources/prices/prices.js +26 -0
  58. package/resources/prices/prices.js.map +1 -1
  59. package/resources/prices/prices.mjs +26 -0
  60. package/resources/prices/prices.mjs.map +1 -1
  61. package/resources/shared.d.ts +5 -0
  62. package/resources/shared.d.ts.map +1 -1
  63. package/resources/subscriptions.d.ts +91 -17
  64. package/resources/subscriptions.d.ts.map +1 -1
  65. package/resources/subscriptions.js +6 -0
  66. package/resources/subscriptions.js.map +1 -1
  67. package/resources/subscriptions.mjs +6 -0
  68. package/resources/subscriptions.mjs.map +1 -1
  69. package/resources/webhooks.d.ts +24 -0
  70. package/resources/webhooks.d.ts.map +1 -0
  71. package/resources/webhooks.js +110 -0
  72. package/resources/webhooks.js.map +1 -0
  73. package/resources/webhooks.mjs +106 -0
  74. package/resources/webhooks.mjs.map +1 -0
  75. package/src/index.ts +20 -7
  76. package/src/resources/coupons/coupons.ts +3 -26
  77. package/src/resources/customers/costs.ts +6 -6
  78. package/src/resources/customers/credits/credits.ts +10 -6
  79. package/src/resources/customers/credits/ledger.ts +24 -12
  80. package/src/resources/customers/credits/top-ups.ts +46 -10
  81. package/src/resources/customers/usage.ts +2 -2
  82. package/src/resources/index.ts +12 -2
  83. package/src/resources/invoices.ts +4 -0
  84. package/src/resources/plans/plans.ts +78 -0
  85. package/src/resources/prices/index.ts +10 -1
  86. package/src/resources/prices/prices.ts +428 -0
  87. package/src/resources/shared.ts +8 -0
  88. package/src/resources/subscriptions.ts +122 -20
  89. package/src/resources/webhooks.ts +142 -0
  90. package/src/version.ts +1 -1
  91. package/version.d.ts +1 -1
  92. package/version.js +1 -1
  93. package/version.mjs +1 -1
package/src/index.ts CHANGED
@@ -14,6 +14,11 @@ export interface ClientOptions {
14
14
  */
15
15
  apiKey?: string | undefined;
16
16
 
17
+ /**
18
+ * Defaults to process.env['ORB_WEBHOOK_SECRET'].
19
+ */
20
+ webhookSecret?: string | null | undefined;
21
+
17
22
  /**
18
23
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
19
24
  *
@@ -74,6 +79,7 @@ export interface ClientOptions {
74
79
  /** API Client for interfacing with the Orb API. */
75
80
  export class Orb extends Core.APIClient {
76
81
  apiKey: string;
82
+ webhookSecret: string | null;
77
83
 
78
84
  private _options: ClientOptions;
79
85
 
@@ -81,6 +87,7 @@ export class Orb extends Core.APIClient {
81
87
  * API Client for interfacing with the Orb API.
82
88
  *
83
89
  * @param {string | undefined} [opts.apiKey=process.env['ORB_API_KEY'] ?? undefined]
90
+ * @param {string | null | undefined} [opts.webhookSecret=process.env['ORB_WEBHOOK_SECRET'] ?? null]
84
91
  * @param {string} [opts.baseURL=process.env['ORB_BASE_URL'] ?? https://api.withorb.com/v1] - Override the default base URL for the API.
85
92
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
86
93
  * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
@@ -92,6 +99,7 @@ export class Orb extends Core.APIClient {
92
99
  constructor({
93
100
  baseURL = Core.readEnv('ORB_BASE_URL'),
94
101
  apiKey = Core.readEnv('ORB_API_KEY'),
102
+ webhookSecret = Core.readEnv('ORB_WEBHOOK_SECRET') ?? null,
95
103
  ...opts
96
104
  }: ClientOptions = {}) {
97
105
  if (apiKey === undefined) {
@@ -102,6 +110,7 @@ export class Orb extends Core.APIClient {
102
110
 
103
111
  const options: ClientOptions = {
104
112
  apiKey,
113
+ webhookSecret,
105
114
  ...opts,
106
115
  baseURL: baseURL || `https://api.withorb.com/v1`,
107
116
  };
@@ -117,6 +126,7 @@ export class Orb extends Core.APIClient {
117
126
  this.idempotencyHeader = 'Idempotency-Key';
118
127
 
119
128
  this.apiKey = apiKey;
129
+ this.webhookSecret = webhookSecret;
120
130
  }
121
131
 
122
132
  topLevel: API.TopLevel = new API.TopLevel(this);
@@ -131,7 +141,7 @@ export class Orb extends Core.APIClient {
131
141
  plans: API.Plans = new API.Plans(this);
132
142
  prices: API.Prices = new API.Prices(this);
133
143
  subscriptions: API.Subscriptions = new API.Subscriptions(this);
134
- beta: API.Beta = new API.Beta(this);
144
+ webhooks: API.Webhooks = new API.Webhooks(this);
135
145
 
136
146
  protected override defaultQuery(): Core.DefaultQuery | undefined {
137
147
  return this._options.defaultQuery;
@@ -179,6 +189,9 @@ export class Orb extends Core.APIClient {
179
189
  static OrbInternalServerError = Errors.OrbInternalServerError;
180
190
  static UnprocessableEntityError = Errors.UnprocessableEntityError;
181
191
  static DuplicateResourceCreation = Errors.DuplicateResourceCreation;
192
+
193
+ static toFile = Uploads.toFile;
194
+ static fileFromPath = Uploads.fileFromPath;
182
195
  }
183
196
 
184
197
  export const {
@@ -213,10 +226,6 @@ export import toFile = Uploads.toFile;
213
226
  export import fileFromPath = Uploads.fileFromPath;
214
227
 
215
228
  export namespace Orb {
216
- // Helper functions
217
- export import toFile = Uploads.toFile;
218
- export import fileFromPath = Uploads.fileFromPath;
219
-
220
229
  export import RequestOptions = Core.RequestOptions;
221
230
 
222
231
  export import Page = Pagination.Page;
@@ -289,10 +298,13 @@ export namespace Orb {
289
298
  export import PlanListParams = API.PlanListParams;
290
299
 
291
300
  export import Prices = API.Prices;
301
+ export import EvaluatePriceGroup = API.EvaluatePriceGroup;
292
302
  export import Price = API.Price;
303
+ export import PriceEvaluateResponse = API.PriceEvaluateResponse;
293
304
  export import PricesPage = API.PricesPage;
294
305
  export import PriceCreateParams = API.PriceCreateParams;
295
306
  export import PriceListParams = API.PriceListParams;
307
+ export import PriceEvaluateParams = API.PriceEvaluateParams;
296
308
 
297
309
  export import Subscriptions = API.Subscriptions;
298
310
  export import Subscription = API.Subscription;
@@ -302,6 +314,7 @@ export namespace Orb {
302
314
  export import SubscriptionsPage = API.SubscriptionsPage;
303
315
  export import SubscriptionFetchScheduleResponsesPage = API.SubscriptionFetchScheduleResponsesPage;
304
316
  export import SubscriptionCreateParams = API.SubscriptionCreateParams;
317
+ export import SubscriptionUpdateParams = API.SubscriptionUpdateParams;
305
318
  export import SubscriptionListParams = API.SubscriptionListParams;
306
319
  export import SubscriptionCancelParams = API.SubscriptionCancelParams;
307
320
  export import SubscriptionFetchCostsParams = API.SubscriptionFetchCostsParams;
@@ -313,9 +326,9 @@ export namespace Orb {
313
326
  export import SubscriptionUnscheduleFixedFeeQuantityUpdatesParams = API.SubscriptionUnscheduleFixedFeeQuantityUpdatesParams;
314
327
  export import SubscriptionUpdateFixedFeeQuantityParams = API.SubscriptionUpdateFixedFeeQuantityParams;
315
328
 
316
- export import Beta = API.Beta;
317
-
329
+ export import BillingCycleRelativeDate = API.BillingCycleRelativeDate;
318
330
  export import Discount = API.Discount;
331
+ export import PaginationMetadata = API.PaginationMetadata;
319
332
  }
320
333
 
321
334
  export default Orb;
@@ -144,7 +144,7 @@ export namespace Coupon {
144
144
  }
145
145
 
146
146
  export interface CouponCreateParams {
147
- discount: CouponCreateParams.PercentageDiscount | CouponCreateParams.AmountDiscount;
147
+ discount: CouponCreateParams.NewCouponPercentageDiscount | CouponCreateParams.NewCouponAmountDiscount;
148
148
 
149
149
  /**
150
150
  * This string can be used to redeem this coupon for a given subscription.
@@ -165,39 +165,16 @@ export interface CouponCreateParams {
165
165
  }
166
166
 
167
167
  export namespace CouponCreateParams {
168
- export interface PercentageDiscount {
169
- /**
170
- * List of price_ids that this discount applies to. For plan/plan phase discounts,
171
- * this can be a subset of prices.
172
- */
173
- applies_to_price_ids: Array<string>;
174
-
168
+ export interface NewCouponPercentageDiscount {
175
169
  discount_type: 'percentage';
176
170
 
177
- /**
178
- * Only available if discount_type is `percentage`. This is a number between 0
179
- * and 1.
180
- */
181
171
  percentage_discount: number;
182
-
183
- reason?: string | null;
184
172
  }
185
173
 
186
- export interface AmountDiscount {
187
- /**
188
- * Only available if discount_type is `amount`.
189
- */
174
+ export interface NewCouponAmountDiscount {
190
175
  amount_discount: string;
191
176
 
192
- /**
193
- * List of price_ids that this discount applies to. For plan/plan phase discounts,
194
- * this can be a subset of prices.
195
- */
196
- applies_to_price_ids: Array<string>;
197
-
198
177
  discount_type: 'amount';
199
-
200
- reason?: string | null;
201
178
  }
202
179
  }
203
180
 
@@ -144,13 +144,13 @@ export class Costs extends APIResource {
144
144
  * `grouping_value` and `secondary_grouping_value` available.
145
145
  */
146
146
  list(
147
- customerId: string | null,
147
+ customerId: string,
148
148
  query?: CostListParams,
149
149
  options?: Core.RequestOptions,
150
150
  ): Core.APIPromise<CostListResponse>;
151
- list(customerId: string | null, options?: Core.RequestOptions): Core.APIPromise<CostListResponse>;
151
+ list(customerId: string, options?: Core.RequestOptions): Core.APIPromise<CostListResponse>;
152
152
  list(
153
- customerId: string | null,
153
+ customerId: string,
154
154
  query: CostListParams | Core.RequestOptions = {},
155
155
  options?: Core.RequestOptions,
156
156
  ): Core.APIPromise<CostListResponse> {
@@ -297,16 +297,16 @@ export class Costs extends APIResource {
297
297
  * `grouping_value` and `secondary_grouping_value` available.
298
298
  */
299
299
  listByExternalId(
300
- externalCustomerId: string | null,
300
+ externalCustomerId: string,
301
301
  query?: CostListByExternalIDParams,
302
302
  options?: Core.RequestOptions,
303
303
  ): Core.APIPromise<CostListByExternalIDResponse>;
304
304
  listByExternalId(
305
- externalCustomerId: string | null,
305
+ externalCustomerId: string,
306
306
  options?: Core.RequestOptions,
307
307
  ): Core.APIPromise<CostListByExternalIDResponse>;
308
308
  listByExternalId(
309
- externalCustomerId: string | null,
309
+ externalCustomerId: string,
310
310
  query: CostListByExternalIDParams | Core.RequestOptions = {},
311
311
  options?: Core.RequestOptions,
312
312
  ): Core.APIPromise<CostListByExternalIDResponse> {
@@ -16,16 +16,16 @@ export class Credits extends APIResource {
16
16
  * Returns a paginated list of unexpired, non-zero credit blocks for a customer.
17
17
  */
18
18
  list(
19
- customerId: string | null,
19
+ customerId: string,
20
20
  query?: CreditListParams,
21
21
  options?: Core.RequestOptions,
22
22
  ): Core.PagePromise<CreditListResponsesPage, CreditListResponse>;
23
23
  list(
24
- customerId: string | null,
24
+ customerId: string,
25
25
  options?: Core.RequestOptions,
26
26
  ): Core.PagePromise<CreditListResponsesPage, CreditListResponse>;
27
27
  list(
28
- customerId: string | null,
28
+ customerId: string,
29
29
  query: CreditListParams | Core.RequestOptions = {},
30
30
  options?: Core.RequestOptions,
31
31
  ): Core.PagePromise<CreditListResponsesPage, CreditListResponse> {
@@ -42,16 +42,16 @@ export class Credits extends APIResource {
42
42
  * Returns a paginated list of unexpired, non-zero credit blocks for a customer.
43
43
  */
44
44
  listByExternalId(
45
- externalCustomerId: string | null,
45
+ externalCustomerId: string,
46
46
  query?: CreditListByExternalIDParams,
47
47
  options?: Core.RequestOptions,
48
48
  ): Core.PagePromise<CreditListByExternalIDResponsesPage, CreditListByExternalIDResponse>;
49
49
  listByExternalId(
50
- externalCustomerId: string | null,
50
+ externalCustomerId: string,
51
51
  options?: Core.RequestOptions,
52
52
  ): Core.PagePromise<CreditListByExternalIDResponsesPage, CreditListByExternalIDResponse>;
53
53
  listByExternalId(
54
- externalCustomerId: string | null,
54
+ externalCustomerId: string,
55
55
  query: CreditListByExternalIDParams | Core.RequestOptions = {},
56
56
  options?: Core.RequestOptions,
57
57
  ): Core.PagePromise<CreditListByExternalIDResponsesPage, CreditListByExternalIDResponse> {
@@ -75,6 +75,8 @@ export interface CreditListResponse {
75
75
 
76
76
  balance: number;
77
77
 
78
+ effective_date: string | null;
79
+
78
80
  expiry_date: string | null;
79
81
 
80
82
  per_unit_cost_basis: string | null;
@@ -87,6 +89,8 @@ export interface CreditListByExternalIDResponse {
87
89
 
88
90
  balance: number;
89
91
 
92
+ effective_date: string | null;
93
+
90
94
  expiry_date: string | null;
91
95
 
92
96
  per_unit_cost_basis: string | null;
@@ -91,16 +91,16 @@ export class Ledger extends APIResource {
91
91
  * entry will be added to the ledger to indicate the adjustment of credits.
92
92
  */
93
93
  list(
94
- customerId: string | null,
94
+ customerId: string,
95
95
  query?: LedgerListParams,
96
96
  options?: Core.RequestOptions,
97
97
  ): Core.PagePromise<LedgerListResponsesPage, LedgerListResponse>;
98
98
  list(
99
- customerId: string | null,
99
+ customerId: string,
100
100
  options?: Core.RequestOptions,
101
101
  ): Core.PagePromise<LedgerListResponsesPage, LedgerListResponse>;
102
102
  list(
103
- customerId: string | null,
103
+ customerId: string,
104
104
  query: LedgerListParams | Core.RequestOptions = {},
105
105
  options?: Core.RequestOptions,
106
106
  ): Core.PagePromise<LedgerListResponsesPage, LedgerListResponse> {
@@ -225,7 +225,7 @@ export class Ledger extends APIResource {
225
225
  * return to the customer, up to the block's initial balance.
226
226
  */
227
227
  createEntry(
228
- customerId: string | null,
228
+ customerId: string,
229
229
  body: LedgerCreateEntryParams,
230
230
  options?: Core.RequestOptions,
231
231
  ): Core.APIPromise<LedgerCreateEntryResponse> {
@@ -344,7 +344,7 @@ export class Ledger extends APIResource {
344
344
  * return to the customer, up to the block's initial balance.
345
345
  */
346
346
  createEntryByExternalId(
347
- externalCustomerId: string | null,
347
+ externalCustomerId: string,
348
348
  body: LedgerCreateEntryByExternalIDParams,
349
349
  options?: Core.RequestOptions,
350
350
  ): Core.APIPromise<LedgerCreateEntryByExternalIDResponse> {
@@ -438,16 +438,16 @@ export class Ledger extends APIResource {
438
438
  * entry will be added to the ledger to indicate the adjustment of credits.
439
439
  */
440
440
  listByExternalId(
441
- externalCustomerId: string | null,
441
+ externalCustomerId: string,
442
442
  query?: LedgerListByExternalIDParams,
443
443
  options?: Core.RequestOptions,
444
444
  ): Core.PagePromise<LedgerListByExternalIDResponsesPage, LedgerListByExternalIDResponse>;
445
445
  listByExternalId(
446
- externalCustomerId: string | null,
446
+ externalCustomerId: string,
447
447
  options?: Core.RequestOptions,
448
448
  ): Core.PagePromise<LedgerListByExternalIDResponsesPage, LedgerListByExternalIDResponse>;
449
449
  listByExternalId(
450
- externalCustomerId: string | null,
450
+ externalCustomerId: string,
451
451
  query: LedgerListByExternalIDParams | Core.RequestOptions = {},
452
452
  options?: Core.RequestOptions,
453
453
  ): Core.PagePromise<LedgerListByExternalIDResponsesPage, LedgerListByExternalIDResponse> {
@@ -2084,8 +2084,8 @@ export namespace LedgerCreateEntryParams {
2084
2084
  metadata?: Record<string, string | null> | null;
2085
2085
 
2086
2086
  /**
2087
- * Can only be specified when entry_type=increment. How much, in USD, a customer
2088
- * paid for a single credit in this block
2087
+ * Can only be specified when entry_type=increment. How much, in the customer's
2088
+ * currency, a customer paid for a single credit in this block
2089
2089
  */
2090
2090
  per_unit_cost_basis?: string | null;
2091
2091
  }
@@ -2115,6 +2115,12 @@ export namespace LedgerCreateEntryParams {
2115
2115
  * An optional memo to display on the invoice.
2116
2116
  */
2117
2117
  memo?: string | null;
2118
+
2119
+ /**
2120
+ * If true, the new credit block will require that the corresponding invoice is
2121
+ * paid before it can be drawn down from.
2122
+ */
2123
+ require_successful_payment?: boolean;
2118
2124
  }
2119
2125
  }
2120
2126
 
@@ -2329,8 +2335,8 @@ export namespace LedgerCreateEntryByExternalIDParams {
2329
2335
  metadata?: Record<string, string | null> | null;
2330
2336
 
2331
2337
  /**
2332
- * Can only be specified when entry_type=increment. How much, in USD, a customer
2333
- * paid for a single credit in this block
2338
+ * Can only be specified when entry_type=increment. How much, in the customer's
2339
+ * currency, a customer paid for a single credit in this block
2334
2340
  */
2335
2341
  per_unit_cost_basis?: string | null;
2336
2342
  }
@@ -2360,6 +2366,12 @@ export namespace LedgerCreateEntryByExternalIDParams {
2360
2366
  * An optional memo to display on the invoice.
2361
2367
  */
2362
2368
  memo?: string | null;
2369
+
2370
+ /**
2371
+ * If true, the new credit block will require that the corresponding invoice is
2372
+ * paid before it can be drawn down from.
2373
+ */
2374
+ require_successful_payment?: boolean;
2363
2375
  }
2364
2376
  }
2365
2377
 
@@ -17,7 +17,7 @@ export class TopUps extends APIResource {
17
17
  * top-up will be replaced.
18
18
  */
19
19
  create(
20
- customerId: string | null,
20
+ customerId: string,
21
21
  body: TopUpCreateParams,
22
22
  options?: Core.RequestOptions,
23
23
  ): Core.APIPromise<TopUpCreateResponse> {
@@ -28,16 +28,16 @@ export class TopUps extends APIResource {
28
28
  * List top-ups
29
29
  */
30
30
  list(
31
- customerId: string | null,
31
+ customerId: string,
32
32
  query?: TopUpListParams,
33
33
  options?: Core.RequestOptions,
34
34
  ): Core.PagePromise<TopUpListResponsesPage, TopUpListResponse>;
35
35
  list(
36
- customerId: string | null,
36
+ customerId: string,
37
37
  options?: Core.RequestOptions,
38
38
  ): Core.PagePromise<TopUpListResponsesPage, TopUpListResponse>;
39
39
  list(
40
- customerId: string | null,
40
+ customerId: string,
41
41
  query: TopUpListParams | Core.RequestOptions = {},
42
42
  options?: Core.RequestOptions,
43
43
  ): Core.PagePromise<TopUpListResponsesPage, TopUpListResponse> {
@@ -53,7 +53,7 @@ export class TopUps extends APIResource {
53
53
  /**
54
54
  * Delete top-up
55
55
  */
56
- delete(customerId: string | null, topUpId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
56
+ delete(customerId: string, topUpId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
57
57
  return this._client.delete(`/customers/${customerId}/credits/top_ups/${topUpId}`, {
58
58
  ...options,
59
59
  headers: { Accept: '*/*', ...options?.headers },
@@ -70,7 +70,7 @@ export class TopUps extends APIResource {
70
70
  * top-up will be replaced.
71
71
  */
72
72
  createByExternalId(
73
- externalCustomerId: string | null,
73
+ externalCustomerId: string,
74
74
  body: TopUpCreateByExternalIDParams,
75
75
  options?: Core.RequestOptions,
76
76
  ): Core.APIPromise<TopUpCreateByExternalIDResponse> {
@@ -84,7 +84,7 @@ export class TopUps extends APIResource {
84
84
  * Delete top-up by external ID
85
85
  */
86
86
  deleteByExternalId(
87
- externalCustomerId: string | null,
87
+ externalCustomerId: string,
88
88
  topUpId: string,
89
89
  options?: Core.RequestOptions,
90
90
  ): Core.APIPromise<void> {
@@ -98,16 +98,16 @@ export class TopUps extends APIResource {
98
98
  * List top-ups by external ID
99
99
  */
100
100
  listByExternalId(
101
- externalCustomerId: string | null,
101
+ externalCustomerId: string,
102
102
  query?: TopUpListByExternalIDParams,
103
103
  options?: Core.RequestOptions,
104
104
  ): Core.PagePromise<TopUpListByExternalIDResponsesPage, TopUpListByExternalIDResponse>;
105
105
  listByExternalId(
106
- externalCustomerId: string | null,
106
+ externalCustomerId: string,
107
107
  options?: Core.RequestOptions,
108
108
  ): Core.PagePromise<TopUpListByExternalIDResponsesPage, TopUpListByExternalIDResponse>;
109
109
  listByExternalId(
110
- externalCustomerId: string | null,
110
+ externalCustomerId: string,
111
111
  query: TopUpListByExternalIDParams | Core.RequestOptions = {},
112
112
  options?: Core.RequestOptions,
113
113
  ): Core.PagePromise<TopUpListByExternalIDResponsesPage, TopUpListByExternalIDResponse> {
@@ -190,6 +190,12 @@ export namespace TopUpCreateResponse {
190
190
  * An optional memo to display on the invoice.
191
191
  */
192
192
  memo?: string | null;
193
+
194
+ /**
195
+ * If true, new credit blocks created by this top-up will require that the
196
+ * corresponding invoice is paid before they can be drawn down from.
197
+ */
198
+ require_successful_payment?: boolean;
193
199
  }
194
200
  }
195
201
 
@@ -257,6 +263,12 @@ export namespace TopUpListResponse {
257
263
  * An optional memo to display on the invoice.
258
264
  */
259
265
  memo?: string | null;
266
+
267
+ /**
268
+ * If true, new credit blocks created by this top-up will require that the
269
+ * corresponding invoice is paid before they can be drawn down from.
270
+ */
271
+ require_successful_payment?: boolean;
260
272
  }
261
273
  }
262
274
 
@@ -324,6 +336,12 @@ export namespace TopUpCreateByExternalIDResponse {
324
336
  * An optional memo to display on the invoice.
325
337
  */
326
338
  memo?: string | null;
339
+
340
+ /**
341
+ * If true, new credit blocks created by this top-up will require that the
342
+ * corresponding invoice is paid before they can be drawn down from.
343
+ */
344
+ require_successful_payment?: boolean;
327
345
  }
328
346
  }
329
347
 
@@ -391,6 +409,12 @@ export namespace TopUpListByExternalIDResponse {
391
409
  * An optional memo to display on the invoice.
392
410
  */
393
411
  memo?: string | null;
412
+
413
+ /**
414
+ * If true, new credit blocks created by this top-up will require that the
415
+ * corresponding invoice is paid before they can be drawn down from.
416
+ */
417
+ require_successful_payment?: boolean;
394
418
  }
395
419
  }
396
420
 
@@ -456,6 +480,12 @@ export namespace TopUpCreateParams {
456
480
  * An optional memo to display on the invoice.
457
481
  */
458
482
  memo?: string | null;
483
+
484
+ /**
485
+ * If true, new credit blocks created by this top-up will require that the
486
+ * corresponding invoice is paid before they can be drawn down from.
487
+ */
488
+ require_successful_payment?: boolean;
459
489
  }
460
490
  }
461
491
 
@@ -523,6 +553,12 @@ export namespace TopUpCreateByExternalIDParams {
523
553
  * An optional memo to display on the invoice.
524
554
  */
525
555
  memo?: string | null;
556
+
557
+ /**
558
+ * If true, new credit blocks created by this top-up will require that the
559
+ * corresponding invoice is paid before they can be drawn down from.
560
+ */
561
+ require_successful_payment?: boolean;
526
562
  }
527
563
  }
528
564
 
@@ -104,7 +104,7 @@ export class Usage extends APIResource {
104
104
  * using multiple calls with small adjacent (e.g. every hour) timeframes.
105
105
  */
106
106
  update(
107
- id: string | null,
107
+ id: string,
108
108
  params: UsageUpdateParams,
109
109
  options?: Core.RequestOptions,
110
110
  ): Core.APIPromise<UsageUpdateResponse> {
@@ -215,7 +215,7 @@ export class Usage extends APIResource {
215
215
  * using multiple calls with small adjacent (e.g. every hour) timeframes.
216
216
  */
217
217
  updateByExternalId(
218
- id: string | null,
218
+ id: string,
219
219
  params: UsageUpdateByExternalIDParams,
220
220
  options?: Core.RequestOptions,
221
221
  ): Core.APIPromise<UsageUpdateByExternalIDResponse> {
@@ -1,7 +1,6 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  export * from './shared';
4
- export { Beta } from './beta/beta';
5
4
  export { Coupon, CouponCreateParams, CouponListParams, CouponsPage, Coupons } from './coupons/coupons';
6
5
  export { CreditNote, CreditNoteListParams, CreditNotesPage, CreditNotes } from './credit-notes';
7
6
  export {
@@ -13,6 +12,16 @@ export {
13
12
  CustomersPage,
14
13
  Customers,
15
14
  } from './customers/customers';
15
+ export {
16
+ EvaluatePriceGroup,
17
+ Price,
18
+ PriceEvaluateResponse,
19
+ PriceCreateParams,
20
+ PriceListParams,
21
+ PriceEvaluateParams,
22
+ PricesPage,
23
+ Prices,
24
+ } from './prices/prices';
16
25
  export {
17
26
  EventUpdateResponse,
18
27
  EventDeprecateResponse,
@@ -49,7 +58,6 @@ export {
49
58
  Metrics,
50
59
  } from './metrics';
51
60
  export { Plan, PlanCreateParams, PlanUpdateParams, PlanListParams, PlansPage, Plans } from './plans/plans';
52
- export { Price, PriceCreateParams, PriceListParams, PricesPage, Prices } from './prices/prices';
53
61
  export {
54
62
  Subscription,
55
63
  SubscriptionUsage,
@@ -57,6 +65,7 @@ export {
57
65
  SubscriptionFetchCostsResponse,
58
66
  SubscriptionFetchScheduleResponse,
59
67
  SubscriptionCreateParams,
68
+ SubscriptionUpdateParams,
60
69
  SubscriptionListParams,
61
70
  SubscriptionCancelParams,
62
71
  SubscriptionFetchCostsParams,
@@ -71,3 +80,4 @@ export {
71
80
  SubscriptionFetchScheduleResponsesPage,
72
81
  } from './subscriptions';
73
82
  export { TopLevelPingResponse, TopLevel } from './top-level';
83
+ export { Webhooks } from './webhooks';
@@ -273,6 +273,8 @@ export interface Invoice {
273
273
  */
274
274
  invoice_pdf: string | null;
275
275
 
276
+ invoice_source: 'subscription' | 'partial' | 'one_off';
277
+
276
278
  /**
277
279
  * If the invoice failed to issue, this will be the last time it failed to issue
278
280
  * (even if it is now in a different state.)
@@ -1353,6 +1355,8 @@ export interface InvoiceFetchUpcomingResponse {
1353
1355
  */
1354
1356
  invoice_pdf: string | null;
1355
1357
 
1358
+ invoice_source: 'subscription' | 'partial' | 'one_off';
1359
+
1356
1360
  /**
1357
1361
  * If the invoice failed to issue, this will be the last time it failed to issue
1358
1362
  * (even if it is now in a different state.)