chargebee 2.26.0 → 2.27.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.
- package/CHANGELOG.md +24 -0
- package/lib/chargebee.js +1 -1
- package/lib/resources/api_endpoints.js +8 -1
- package/package.json +1 -1
- package/types/core.d.ts +1 -0
- package/types/resources/Address.d.ts +235 -5
- package/types/resources/AdvanceInvoiceSchedule.d.ts +78 -2
- package/types/resources/AttachedItem.d.ts +285 -13
- package/types/resources/Card.d.ts +375 -13
- package/types/resources/Comment.d.ts +160 -11
- package/types/resources/Contact.d.ts +54 -0
- package/types/resources/ContractTerm.d.ts +83 -0
- package/types/resources/Coupon.d.ts +628 -20
- package/types/resources/CouponCode.d.ts +46 -5
- package/types/resources/CouponSet.d.ts +194 -17
- package/types/resources/CreditNote.d.ts +1100 -44
- package/types/resources/CreditNoteEstimate.d.ts +75 -6
- package/types/resources/Customer.d.ts +1819 -73
- package/types/resources/DifferentialPrice.d.ts +246 -15
- package/types/resources/Discount.d.ts +107 -0
- package/types/resources/Download.d.ts +18 -0
- package/types/resources/EntitlementOverride.d.ts +101 -7
- package/types/resources/Estimate.d.ts +1021 -27
- package/types/resources/Event.d.ts +138 -8
- package/types/resources/Export.d.ts +622 -32
- package/types/resources/Feature.d.ts +287 -22
- package/types/resources/Gift.d.ts +296 -24
- package/types/resources/Hierarchy.d.ts +30 -0
- package/types/resources/HostedPage.d.ts +1046 -37
- package/types/resources/ImpactedItem.d.ts +41 -1
- package/types/resources/ImpactedSubscription.d.ts +36 -1
- package/types/resources/InAppSubscription.d.ts +369 -9
- package/types/resources/Invoice.d.ts +1942 -92
- package/types/resources/InvoiceEstimate.d.ts +75 -6
- package/types/resources/Item.d.ts +522 -16
- package/types/resources/ItemEntitlement.d.ts +162 -13
- package/types/resources/ItemFamily.d.ts +153 -15
- package/types/resources/ItemPrice.d.ts +951 -26
- package/types/resources/Media.d.ts +24 -0
- package/types/resources/NonSubscription.d.ts +46 -3
- package/types/resources/Order.d.ts +1172 -32
- package/types/resources/PaymentIntent.d.ts +293 -8
- package/types/resources/PaymentReferenceNumber.d.ts +24 -0
- package/types/resources/PaymentSource.d.ts +984 -55
- package/types/resources/PaymentVoucher.d.ts +252 -14
- package/types/resources/PortalSession.d.ts +154 -10
- package/types/resources/PromotionalCredit.d.ts +300 -16
- package/types/resources/Purchase.d.ts +206 -5
- package/types/resources/Quote.d.ts +1430 -62
- package/types/resources/QuoteLineGroup.d.ts +134 -5
- package/types/resources/QuotedCharge.d.ts +63 -5
- package/types/resources/QuotedSubscription.d.ts +192 -5
- package/types/resources/ResourceMigration.d.ts +68 -3
- package/types/resources/SiteMigrationDetail.d.ts +98 -5
- package/types/resources/Subscription.d.ts +2564 -137
- package/types/resources/SubscriptionEntitlement.d.ts +116 -8
- package/types/resources/SubscriptionEstimate.d.ts +36 -2
- package/types/resources/TaxWithheld.d.ts +32 -0
- package/types/resources/ThirdPartyPaymentMethod.d.ts +24 -0
- package/types/resources/TimeMachine.d.ts +82 -7
- package/types/resources/Token.d.ts +164 -7
- package/types/resources/Transaction.d.ts +567 -25
- package/types/resources/UnbilledCharge.d.ts +309 -14
- package/types/resources/Usage.d.ts +237 -13
- package/types/resources/VirtualBankAccount.d.ts +220 -17
|
@@ -1,87 +1,382 @@
|
|
|
1
1
|
///<reference path='./../core.d.ts'/>
|
|
2
2
|
declare module 'chargebee' {
|
|
3
3
|
export interface UnbilledCharge {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description Uniquely identifies an unbilled charge.
|
|
7
|
+
|
|
8
|
+
*/
|
|
9
|
+
|
|
4
10
|
id?:string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description A unique identifier for the customer being charged.
|
|
14
|
+
|
|
15
|
+
*/
|
|
16
|
+
|
|
5
17
|
customer_id?:string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @description A unique identifier for the subscription this charge belongs to.
|
|
21
|
+
|
|
22
|
+
*/
|
|
23
|
+
|
|
6
24
|
subscription_id?:string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description Start date of this charge.
|
|
28
|
+
|
|
29
|
+
*/
|
|
30
|
+
|
|
7
31
|
date_from?:number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @description End date of this charge.
|
|
35
|
+
|
|
36
|
+
*/
|
|
37
|
+
|
|
8
38
|
date_to?:number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @description Unit amount of the charge item.
|
|
42
|
+
|
|
43
|
+
*/
|
|
44
|
+
|
|
9
45
|
unit_amount?:number;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @description The pricing scheme for this line item. \* tiered - The per unit price is based on the tier that the total quantity falls in. \* volume - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. \* per_unit - A fixed price per unit quantity. \* flat_fee - A fixed price that is not quantity-based. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in.
|
|
49
|
+
|
|
50
|
+
*/
|
|
51
|
+
|
|
10
52
|
pricing_model?:PricingModel;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @description Quantity of the item which is represented by this charge.
|
|
56
|
+
|
|
57
|
+
*/
|
|
58
|
+
|
|
11
59
|
quantity?:number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @description Total amount of this charge. Typically equals to unit amount x quantity.
|
|
63
|
+
|
|
64
|
+
*/
|
|
65
|
+
|
|
12
66
|
amount?:number;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @description The currency code (ISO 4217 format) for the charge.
|
|
70
|
+
|
|
71
|
+
*/
|
|
72
|
+
|
|
13
73
|
currency_code:string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @description Total discounts for this charge.
|
|
77
|
+
|
|
78
|
+
*/
|
|
79
|
+
|
|
14
80
|
discount_amount?:number;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @description Detailed description about this charge.
|
|
84
|
+
|
|
85
|
+
*/
|
|
86
|
+
|
|
15
87
|
description?:string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @description Specifies the modelled entity this line item is based on. \* plan_setup - Indicates that this lineitem is based on 'Plan Setup' charge. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* charge_item_price - Indicates that this line item is based on charge Item Price \* plan - Indicates that this lineitem is based on 'Plan' entity. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* addon_item_price - Indicates that this line item is based on addon Item Price \* plan_item_price - Indicates that this line item is based on plan Item Price \* adhoc - Indicates that this lineitem is not modelled. i.e created adhoc. So the 'entity_id' attribute will be null in this case \* addon - Indicates that this lineitem is based on 'Addon' entity. The 'entity_id' attribute specifies the [addon](/docs/api/addons#addon_attributes) id
|
|
91
|
+
|
|
92
|
+
*/
|
|
93
|
+
|
|
16
94
|
entity_type:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc';
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @description The identifier of the modelled entity this charge is based on. Will be null for 'adhoc' entity type.
|
|
98
|
+
|
|
99
|
+
*/
|
|
100
|
+
|
|
17
101
|
entity_id?:string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @description Will be true if the charge has been voided. Usually the unbilled charge will be voided and revised to different charges(s) during proration.
|
|
105
|
+
|
|
106
|
+
*/
|
|
107
|
+
|
|
18
108
|
is_voided:boolean;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @description Timestamp indicating the date and time this charge got voided.
|
|
112
|
+
|
|
113
|
+
*/
|
|
114
|
+
|
|
19
115
|
voided_at?:number;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @description The decimal representation of the unit amount for the entity. The value is in major units of the currency. Returned when the entity is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled.
|
|
119
|
+
|
|
120
|
+
*/
|
|
121
|
+
|
|
20
122
|
unit_amount_in_decimal?:string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @description The decimal representation of the quantity of this entity. Returned when the entity is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled.
|
|
126
|
+
|
|
127
|
+
*/
|
|
128
|
+
|
|
21
129
|
quantity_in_decimal?:string;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @description The decimal representation of the amount for the charge, in major units of the currency. Typically equals to `unit_amount_in_decimal` x `quantity_in_decimal`. Returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled.
|
|
133
|
+
|
|
134
|
+
*/
|
|
135
|
+
|
|
22
136
|
amount_in_decimal?:string;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @description Timestamp indicating when the unbilled charge was last updated
|
|
140
|
+
|
|
141
|
+
*/
|
|
142
|
+
|
|
23
143
|
updated_at:number;
|
|
144
|
+
|
|
24
145
|
is_advance_charge?:boolean;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @description Indicates that this resource has been deleted.
|
|
149
|
+
|
|
150
|
+
*/
|
|
151
|
+
|
|
25
152
|
deleted:boolean;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @description The list of tiers applicable for this line item
|
|
156
|
+
|
|
157
|
+
*/
|
|
158
|
+
|
|
26
159
|
tiers?:UnbilledCharge.LineItemTier[];
|
|
27
160
|
}
|
|
28
161
|
export namespace UnbilledCharge {
|
|
29
|
-
export class UnbilledChargeResource {
|
|
162
|
+
export class UnbilledChargeResource {
|
|
163
|
+
/**
|
|
164
|
+
* @description Use this API to delete an unbilled charge by specifying the id of the charge.
|
|
165
|
+
|
|
166
|
+
*/
|
|
167
|
+
|
|
30
168
|
delete(unbilled_charge_id:string):ChargebeeRequest<DeleteResponse>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @description This is similar to the "Create an invoice for unbilled charges" API but no invoice will be created, only an estimate for this operation is created.
|
|
172
|
+
|
|
173
|
+
In the estimate response,
|
|
174
|
+
|
|
175
|
+
* **estimate.invoice_estimates** is an array of **estimate.invoice_estimate**. This has the details of the invoices that will be generated now.
|
|
176
|
+
|
|
177
|
+
**Note:**
|
|
178
|
+
|
|
179
|
+
* This API when invoked does not perform the actual operation. It just generates an estimate.
|
|
180
|
+
* Both *subscription_id* and *customer_id* parameters should not be given at the same time.
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
*/
|
|
186
|
+
|
|
31
187
|
invoice_now_estimate(input?:InvoiceNowEstimateInputParam):ChargebeeRequest<InvoiceNowEstimateResponse>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @description Use this API to bill the [unbilled charges](https://www.chargebee.com/docs/unbilled-charges.html). Available Credits and Excess Payments will automatically be applied while creating the invoice.
|
|
191
|
+
|
|
192
|
+
If the *Auto Collection* is turned on for the particular customer, the invoice will be created in payment_due state and the payment collection will be scheduled immediately.
|
|
193
|
+
|
|
194
|
+
During invoice creation, the PO number for the line items will be filled from the subscription's current PO number, if available.
|
|
195
|
+
|
|
196
|
+
If no recurring item is present in the created invoice, the invoice will be marked as recurring=false.
|
|
197
|
+
|
|
198
|
+
If consolidated invoicing is enabled and the parameter 'customer_id' is passed, multiple invoices can be created based on the following factors.
|
|
199
|
+
|
|
200
|
+
* Currency
|
|
201
|
+
* PO number if 'Group by PO number' is enabled
|
|
202
|
+
* Shipping address
|
|
203
|
+
* Auto Collection
|
|
204
|
+
* Payment method
|
|
205
|
+
|
|
206
|
+
*/
|
|
207
|
+
|
|
32
208
|
invoice_unbilled_charges(input?:InvoiceUnbilledChargesInputParam):ChargebeeRequest<InvoiceUnbilledChargesResponse>;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @description This endpoint lists all the unbilled charges.
|
|
212
|
+
|
|
213
|
+
*/
|
|
214
|
+
|
|
33
215
|
list(input?:ListInputParam):ChargebeeRequest<ListResponse>;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @description This endpoint creates unbilled charges for a subscription.
|
|
219
|
+
|
|
220
|
+
*/
|
|
221
|
+
|
|
34
222
|
create(input:CreateInputParam):ChargebeeRequest<CreateResponse>;
|
|
35
223
|
}
|
|
36
|
-
export interface DeleteResponse {
|
|
37
|
-
|
|
224
|
+
export interface DeleteResponse {
|
|
225
|
+
unbilled_charge:UnbilledCharge;
|
|
38
226
|
}
|
|
39
227
|
|
|
40
|
-
export interface InvoiceNowEstimateResponse {
|
|
41
|
-
|
|
228
|
+
export interface InvoiceNowEstimateResponse {
|
|
229
|
+
estimate:Estimate;
|
|
42
230
|
}
|
|
43
231
|
export interface InvoiceNowEstimateInputParam {
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* @description Identifier of the subscription for which this estimate needs to be created. Should be given if 'customer_id' is not specified.
|
|
235
|
+
|
|
236
|
+
*/
|
|
237
|
+
|
|
44
238
|
subscription_id?:string;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @description Identifier of the customer for whom this estimate is created. Is given if 'subscription_id' is not specified. Applicable only if the 'Consolidated Invoicing' is enabled. If 'Consolidated Invoicing' is not enabled, an invoice will be generated for every subscription.
|
|
242
|
+
|
|
243
|
+
*/
|
|
244
|
+
|
|
45
245
|
customer_id?:string;
|
|
46
246
|
}
|
|
47
|
-
export interface InvoiceUnbilledChargesResponse {
|
|
48
|
-
|
|
247
|
+
export interface InvoiceUnbilledChargesResponse {
|
|
248
|
+
invoices:Invoice[];
|
|
49
249
|
}
|
|
50
250
|
export interface InvoiceUnbilledChargesInputParam {
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @description Identifier of the subscription for which this invoice needs to be created. Should be specified if 'customer_id' is not specified.
|
|
254
|
+
|
|
255
|
+
*/
|
|
256
|
+
|
|
51
257
|
subscription_id?:string;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @description Identifier of the customer for whom this invoice needs to be created. Should be specified if 'subscription_id' is not specified. Applicable only if the consolidated invoicing is enabled. .
|
|
261
|
+
|
|
262
|
+
*/
|
|
263
|
+
|
|
52
264
|
customer_id?:string;
|
|
53
265
|
}
|
|
54
|
-
export interface ListResponse {
|
|
55
|
-
|
|
56
|
-
|
|
266
|
+
export interface ListResponse {
|
|
267
|
+
/**
|
|
268
|
+
* @description This endpoint lists all the unbilled charges.
|
|
269
|
+
|
|
270
|
+
*/
|
|
271
|
+
|
|
272
|
+
list:{unbilled_charge:UnbilledCharge}[];
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @description This endpoint lists all the unbilled charges.
|
|
276
|
+
|
|
277
|
+
*/
|
|
278
|
+
|
|
279
|
+
next_offset?:string;
|
|
57
280
|
}
|
|
58
281
|
export interface ListInputParam {
|
|
59
|
-
[key : string]: any;
|
|
282
|
+
[key : string]: any;
|
|
283
|
+
/**
|
|
284
|
+
* @description The number of resources to be returned.
|
|
285
|
+
|
|
286
|
+
*/
|
|
287
|
+
|
|
60
288
|
limit?:number;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call.
|
|
292
|
+
|
|
293
|
+
*/
|
|
294
|
+
|
|
61
295
|
offset?:string;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @description Indicates whether to include deleted objects in the list. The deleted objects have the attribute \`deleted\` as \`true\`.
|
|
299
|
+
|
|
300
|
+
*/
|
|
301
|
+
|
|
62
302
|
include_deleted?:boolean;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* @description This endpoint lists all the unbilled charges.
|
|
306
|
+
|
|
307
|
+
*/
|
|
308
|
+
|
|
63
309
|
is_voided?:boolean;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @description A unique identifier for the subscription this charge belongs to.
|
|
313
|
+
|
|
314
|
+
*/
|
|
315
|
+
|
|
64
316
|
subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string};
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* @description A unique identifier for the customer being charged.
|
|
320
|
+
|
|
321
|
+
*/
|
|
322
|
+
|
|
65
323
|
customer_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string};
|
|
66
324
|
}
|
|
67
|
-
export interface CreateResponse {
|
|
68
|
-
|
|
325
|
+
export interface CreateResponse {
|
|
326
|
+
unbilled_charges:UnbilledCharge[];
|
|
69
327
|
}
|
|
70
328
|
export interface CreateInputParam {
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @description Identifier of the subscription for which this unbilled charges needs to be created.
|
|
332
|
+
|
|
333
|
+
*/
|
|
334
|
+
|
|
71
335
|
subscription_id:string;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* @description The currency code (ISO 4217 format) of the unbilled_charge.
|
|
339
|
+
|
|
340
|
+
*/
|
|
341
|
+
|
|
72
342
|
currency_code?:string;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* @description Parameters for item_prices
|
|
346
|
+
|
|
347
|
+
*/
|
|
348
|
+
|
|
73
349
|
item_prices?:{date_from?:number,date_to?:number,item_price_id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}[];
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* @description Parameters for item_tiers
|
|
353
|
+
|
|
354
|
+
*/
|
|
355
|
+
|
|
74
356
|
item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[];
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @description Parameters for charges
|
|
360
|
+
|
|
361
|
+
*/
|
|
362
|
+
|
|
75
363
|
charges?:{amount?:number,amount_in_decimal?:string,avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_tax_code?:string,avalara_transaction_type?:number,date_from?:number,date_to?:number,description?:string,hsn_code?:string,tax_profile_id?:string,taxable?:boolean,taxjar_product_code?:string}[];
|
|
76
364
|
}
|
|
77
|
-
export interface LineItemTier {
|
|
365
|
+
export interface LineItemTier {
|
|
78
366
|
starting_unit?:number;
|
|
367
|
+
|
|
79
368
|
ending_unit?:number;
|
|
369
|
+
|
|
80
370
|
quantity_used?:number;
|
|
371
|
+
|
|
81
372
|
unit_amount?:number;
|
|
373
|
+
|
|
82
374
|
starting_unit_in_decimal?:string;
|
|
375
|
+
|
|
83
376
|
ending_unit_in_decimal?:string;
|
|
377
|
+
|
|
84
378
|
quantity_used_in_decimal?:string;
|
|
379
|
+
|
|
85
380
|
unit_amount_in_decimal?:string;
|
|
86
381
|
}
|
|
87
382
|
}
|
|
@@ -1,70 +1,294 @@
|
|
|
1
1
|
///<reference path='./../core.d.ts'/>
|
|
2
2
|
declare module 'chargebee' {
|
|
3
3
|
export interface Usage {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description A unique and immutable id for the usage. If not provided, it is autogenerated.
|
|
7
|
+
|
|
8
|
+
*/
|
|
9
|
+
|
|
4
10
|
id?:string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description The time at which this usage occurred. Chargebee bills only those usages whose `usage_date` falls within a time when the subscription `status` was `active` or `non_renewing`. However, the remaining usage records are still stored and are [retrievable](/docs/api/usages?prod_cat_ver=2#retrieve_a_usage).
|
|
14
|
+
**Note:** If `usage_date` corresponds to a time already invoiced, then it is stored but never invoiced unless the [invoice is regenerated](/docs/api/subscriptions?prod_cat_ver=2#regenerate_an_invoice).
|
|
15
|
+
|
|
16
|
+
*/
|
|
17
|
+
|
|
5
18
|
usage_date:number;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @description The id of the [subscription](/docs/api/subscriptions?prod_cat_ver=2) to which this usage record belongs.
|
|
22
|
+
|
|
23
|
+
*/
|
|
24
|
+
|
|
6
25
|
subscription_id:string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @description The id of the [item price](/docs/api/item_prices?prod_cat_ver=2) to which this usage belongs. The item price must be a part of the subscription or should have been part of it historically.
|
|
29
|
+
|
|
30
|
+
*/
|
|
31
|
+
|
|
7
32
|
item_price_id:string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @description When the usage has been invoiced, this is the `id` of the [invoice](/docs/api/invoices?prod_cat_ver=2). This is cleared when the invoice is `voided` or deleted.
|
|
36
|
+
|
|
37
|
+
*/
|
|
38
|
+
|
|
8
39
|
invoice_id?:string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @description When the usage has been invoiced, this is the `id` of the [invoice.line_item](/docs/api/invoices?prod_cat_ver=2#invoice_line_items) that the usage is for. This is cleared when the invoice is [voided](/docs/api/invoices?prod_cat_ver=2#void_an_invoice) or [deleted](/docs/api/invoices?prod_cat_ver=2#delete_an_invoice).
|
|
43
|
+
|
|
44
|
+
*/
|
|
45
|
+
|
|
9
46
|
line_item_id?:string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @description The quantity specified for this usage record.
|
|
50
|
+
|
|
51
|
+
*/
|
|
52
|
+
|
|
10
53
|
quantity:string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @description The source from which the usage record was created. \* admin_console - Operation made through the Chargebee admin UI \* api - Operation made through the API \* bulk_operation - Operation that are triggerd through bulk operation.
|
|
57
|
+
|
|
58
|
+
*/
|
|
59
|
+
|
|
11
60
|
source?:Source;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @description A note for this usage record. This appears against the usage on the Chargebee UI. This note is not displayed on any customer-facing document or interface such as [invoice PDFs](/docs/api/invoices?prod_cat_ver=2#retrieve_invoice_as_pdf) or [Hosted Pages](/docs/api/hosted_pages?prod_cat_ver=2).
|
|
64
|
+
|
|
65
|
+
*/
|
|
66
|
+
|
|
12
67
|
note?:string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @description Version number of this resource. The `resource_version` is updated with a new timestamp in milliseconds for every change made to the resource. This attribute will be present only if the resource has been updated after 2016-09-28.
|
|
71
|
+
|
|
72
|
+
*/
|
|
73
|
+
|
|
13
74
|
resource_version?:number;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @description Timestamp indicating when this usage resource was last updated.
|
|
78
|
+
|
|
79
|
+
*/
|
|
80
|
+
|
|
14
81
|
updated_at?:number;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @description Timestamp indicating when the item was created.
|
|
85
|
+
|
|
86
|
+
*/
|
|
87
|
+
|
|
15
88
|
created_at:number;
|
|
16
89
|
}
|
|
17
90
|
export namespace Usage {
|
|
18
|
-
export class UsageResource {
|
|
91
|
+
export class UsageResource {
|
|
92
|
+
/**
|
|
93
|
+
* @description Retrieves usages record for an invoice in PDF file format.
|
|
94
|
+
|
|
95
|
+
*/
|
|
96
|
+
|
|
19
97
|
pdf(input?:PdfInputParam):ChargebeeRequest<PdfResponse>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @description Retrieves a usage record of a specific subscription.
|
|
101
|
+
|
|
102
|
+
*/
|
|
103
|
+
|
|
20
104
|
retrieve(subscription_id:string, input:RetrieveInputParam):ChargebeeRequest<RetrieveResponse>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @description Creates a usage record for an item price in a subscription. The item price must belong to a [metered](/docs/api/items?prod_cat_ver=2#item_metered) item.
|
|
108
|
+
**Max Usages**
|
|
109
|
+
The maximum number of usages that can be recorded for the entire lifetime of a subscription is 5000. [Contact Support](https://chargebee.freshdesk.com/support/home) if you want this limit to be increased for your site.
|
|
110
|
+
|
|
111
|
+
*/
|
|
112
|
+
|
|
21
113
|
create(subscription_id:string, input:CreateInputParam):ChargebeeRequest<CreateResponse>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @description Deletes a usage record. This operation cannot be invoked for a usage record that has been [invoiced](usages?prod_cat_ver=2#invoicing_usages).
|
|
117
|
+
|
|
118
|
+
*/
|
|
119
|
+
|
|
22
120
|
delete(subscription_id:string, input:DeleteInputParam):ChargebeeRequest<DeleteResponse>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @description Retrieves the list of usages.
|
|
124
|
+
|
|
125
|
+
*/
|
|
126
|
+
|
|
23
127
|
list(input:ListInputParam):ChargebeeRequest<ListResponse>;
|
|
24
128
|
}
|
|
25
|
-
export interface PdfResponse {
|
|
26
|
-
|
|
129
|
+
export interface PdfResponse {
|
|
130
|
+
download:Download;
|
|
27
131
|
}
|
|
28
132
|
export interface PdfInputParam {
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser
|
|
136
|
+
|
|
137
|
+
*/
|
|
138
|
+
|
|
29
139
|
disposition_type?:DispositionType;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @description Parameters for invoice
|
|
143
|
+
|
|
144
|
+
*/
|
|
145
|
+
|
|
30
146
|
invoice?:{id:string};
|
|
31
147
|
}
|
|
32
|
-
export interface RetrieveResponse {
|
|
33
|
-
|
|
148
|
+
export interface RetrieveResponse {
|
|
149
|
+
usage:Usage;
|
|
34
150
|
}
|
|
35
151
|
export interface RetrieveInputParam {
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @description Retrieves a usage record of a specific subscription.
|
|
155
|
+
|
|
156
|
+
*/
|
|
157
|
+
|
|
36
158
|
id:string;
|
|
37
159
|
}
|
|
38
|
-
export interface CreateResponse {
|
|
39
|
-
|
|
160
|
+
export interface CreateResponse {
|
|
161
|
+
usage:Usage;
|
|
40
162
|
}
|
|
41
163
|
export interface CreateInputParam {
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @description A unique and immutable id for the usage. If not provided, it is autogenerated.
|
|
167
|
+
|
|
168
|
+
*/
|
|
169
|
+
|
|
42
170
|
id?:string;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @description The id of the [item price](/docs/api/item_prices?prod_cat_ver=2) to which this usage belongs. The item price must be a part of the subscription or should have been part of it historically.
|
|
174
|
+
|
|
175
|
+
*/
|
|
176
|
+
|
|
43
177
|
item_price_id:string;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @description The quantity specified for this usage record.
|
|
181
|
+
|
|
182
|
+
*/
|
|
183
|
+
|
|
44
184
|
quantity:string;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @description The time at which this usage occurred. Chargebee bills only those usages whose `usage_date` falls within a time when the subscription `status` was `active` or `non_renewing`. However, the remaining usage records are still stored and are [retrievable](/docs/api/usages?prod_cat_ver=2#retrieve_a_usage).
|
|
188
|
+
**Note:** If `usage_date` corresponds to a time already invoiced, then it is stored but never invoiced unless the [invoice is regenerated](/docs/api/subscriptions?prod_cat_ver=2#regenerate_an_invoice).
|
|
189
|
+
|
|
190
|
+
*/
|
|
191
|
+
|
|
45
192
|
usage_date:number;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @description A note for this usage record. This appears against the usage on the Chargebee UI. This note is not displayed on any customer-facing document or interface such as [invoice PDFs](/docs/api/invoices?prod_cat_ver=2#retrieve_invoice_as_pdf) or [Hosted Pages](/docs/api/hosted_pages?prod_cat_ver=2).
|
|
196
|
+
|
|
197
|
+
*/
|
|
198
|
+
|
|
46
199
|
note?:string;
|
|
47
200
|
}
|
|
48
|
-
export interface DeleteResponse {
|
|
49
|
-
|
|
201
|
+
export interface DeleteResponse {
|
|
202
|
+
usage:Usage;
|
|
50
203
|
}
|
|
51
204
|
export interface DeleteInputParam {
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @description A unique and immutable id for the usage. If not provided, it is autogenerated.
|
|
208
|
+
|
|
209
|
+
*/
|
|
210
|
+
|
|
52
211
|
id:string;
|
|
53
212
|
}
|
|
54
|
-
export interface ListResponse {
|
|
55
|
-
|
|
56
|
-
|
|
213
|
+
export interface ListResponse {
|
|
214
|
+
/**
|
|
215
|
+
* @description Retrieves the list of usages.
|
|
216
|
+
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
list:{usage:Usage}[];
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @description Retrieves the list of usages.
|
|
223
|
+
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
next_offset?:string;
|
|
57
227
|
}
|
|
58
228
|
export interface ListInputParam {
|
|
59
|
-
[key : string]: any;
|
|
229
|
+
[key : string]: any;
|
|
230
|
+
/**
|
|
231
|
+
* @description The number of resources to be returned.
|
|
232
|
+
|
|
233
|
+
*/
|
|
234
|
+
|
|
60
235
|
limit?:number;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call.
|
|
239
|
+
|
|
240
|
+
*/
|
|
241
|
+
|
|
61
242
|
offset?:string;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @description A unique and immutable id for the usage. If not provided, it is autogenerated.
|
|
246
|
+
|
|
247
|
+
*/
|
|
248
|
+
|
|
62
249
|
id?:{is?:string,is_not?:string,starts_with?:string};
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @description The id of the [subscription](/docs/api/subscriptions?prod_cat_ver=2) to which this usage record belongs.
|
|
253
|
+
|
|
254
|
+
*/
|
|
255
|
+
|
|
63
256
|
subscription_id:{is?:string,is_not?:string,starts_with?:string};
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @description The time at which this usage occurred. Chargebee bills only those usages whose `usage_date` falls within a time when the subscription `status` was `active` or `non_renewing`. However, the remaining usage records are still stored and are [retrievable](/docs/api/usages?prod_cat_ver=2#retrieve_a_usage).
|
|
260
|
+
**Note:** If `usage_date` corresponds to a time already invoiced, then it is stored but never invoiced unless the [invoice is regenerated](/docs/api/subscriptions?prod_cat_ver=2#regenerate_an_invoice).
|
|
261
|
+
|
|
262
|
+
*/
|
|
263
|
+
|
|
64
264
|
usage_date?:{after?:string,before?:string,between?:string,on?:string};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @description The id of the [item price](/docs/api/item_prices?prod_cat_ver=2) to which this usage belongs. The item price must be a part of the subscription or should have been part of it historically.
|
|
268
|
+
|
|
269
|
+
*/
|
|
270
|
+
|
|
65
271
|
item_price_id?:{is?:string,is_not?:string,starts_with?:string};
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @description When the usage has been invoiced, this is the `id` of the [invoice](/docs/api/invoices?prod_cat_ver=2). This is cleared when the invoice is `voided` or deleted.
|
|
275
|
+
|
|
276
|
+
*/
|
|
277
|
+
|
|
66
278
|
invoice_id?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string};
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @description The source from which the usage record was created.
|
|
282
|
+
|
|
283
|
+
*/
|
|
284
|
+
|
|
67
285
|
source?:{in?:string,is?:'admin_console' | 'bulk_operation' | 'api',is_not?:'admin_console' | 'bulk_operation' | 'api',not_in?:string};
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @description Retrieves the list of usages.
|
|
289
|
+
|
|
290
|
+
*/
|
|
291
|
+
|
|
68
292
|
sort_by?:{asc?:'usage_date',desc?:'usage_date'};
|
|
69
293
|
}
|
|
70
294
|
|