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,81 +1,365 @@
|
|
|
1
1
|
///<reference path='./../core.d.ts'/>
|
|
2
2
|
declare module 'chargebee' {
|
|
3
3
|
export interface PromotionalCredit {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description Unique reference ID provided for promotional credits
|
|
7
|
+
|
|
8
|
+
*/
|
|
9
|
+
|
|
4
10
|
id:string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description Identifier of the customer.
|
|
14
|
+
|
|
15
|
+
*/
|
|
16
|
+
|
|
5
17
|
customer_id:string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @description Type of promotional credits \* decrement - Decrement \* increment - Increment
|
|
21
|
+
|
|
22
|
+
*/
|
|
23
|
+
|
|
6
24
|
type:'decrement' | 'increment';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description Amount in decimal
|
|
28
|
+
|
|
29
|
+
*/
|
|
30
|
+
|
|
7
31
|
amount_in_decimal?:string;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @description Promotional credits amount
|
|
35
|
+
|
|
36
|
+
*/
|
|
37
|
+
|
|
8
38
|
amount:number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @description The currency code (ISO 4217 format) for promotional credit
|
|
42
|
+
|
|
43
|
+
*/
|
|
44
|
+
|
|
9
45
|
currency_code:string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @description Detailed description of this promotional credits.
|
|
49
|
+
|
|
50
|
+
*/
|
|
51
|
+
|
|
10
52
|
description:string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @description Type of promotional credits provided to customer \* referral_rewards - Referral \* loyalty_credits - Loyalty Credits \* general - General
|
|
56
|
+
|
|
57
|
+
*/
|
|
58
|
+
|
|
11
59
|
credit_type:CreditType;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @description Describes why promotional credits were provided
|
|
63
|
+
|
|
64
|
+
*/
|
|
65
|
+
|
|
12
66
|
reference?:string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @description Closing balance as on end date.
|
|
70
|
+
|
|
71
|
+
*/
|
|
72
|
+
|
|
13
73
|
closing_balance:number;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @description The user who added/deducted the credit. If created via API, this contains the name given for the API key used.
|
|
77
|
+
|
|
78
|
+
*/
|
|
79
|
+
|
|
14
80
|
done_by?:string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @description Timestamp indicating when this promotional credit resource is created.
|
|
84
|
+
|
|
85
|
+
*/
|
|
86
|
+
|
|
15
87
|
created_at:number;
|
|
16
88
|
}
|
|
17
89
|
export namespace PromotionalCredit {
|
|
18
|
-
export class PromotionalCreditResource {
|
|
90
|
+
export class PromotionalCreditResource {
|
|
91
|
+
/**
|
|
92
|
+
* @description This endpoint retrieves the promotional credit based on the promotional credit id
|
|
93
|
+
|
|
94
|
+
*/
|
|
95
|
+
|
|
19
96
|
retrieve(account_credit_id:string):ChargebeeRequest<RetrieveResponse>;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @description This endpoint lists the promotional credits set for a customer
|
|
100
|
+
|
|
101
|
+
*/
|
|
102
|
+
|
|
20
103
|
list(input?:ListInputParam):ChargebeeRequest<ListResponse>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @description This API call can be used to deduct promotional credits for a customer. [Learn more about Promotional Credits](https://www.chargebee.com/docs/2.0/credit-notes.html#creating-promotional-credits).
|
|
107
|
+
|
|
108
|
+
For example, if a customer has a credit balance of $20, if you pass the **amount** as $5, then the customer's credit balance would become $15.
|
|
109
|
+
|
|
110
|
+
If you do not pass any amount as the input parameter then, it will deduct the whole available amount from the credit balance.
|
|
111
|
+
|
|
112
|
+
*/
|
|
113
|
+
|
|
21
114
|
deduct(input:DeductInputParam):ChargebeeRequest<DeductResponse>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @description This API call can be used to set the promotional credits balance of a customer. [Learn more about Promotional Credits](https://www.chargebee.com/docs/2.0/credit-notes.html#creating-promotional-credits).
|
|
118
|
+
|
|
119
|
+
For example, if a customer has a credit balance of $10 and if you would like to set the balance to $100, you could pass the **amount** as $100.
|
|
120
|
+
|
|
121
|
+
*/
|
|
122
|
+
|
|
22
123
|
set(input:SetInputParam):ChargebeeRequest<SetResponse>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @description This API call can be used to add promotional credits to a customer. [Learn more about Promotional Credits](https://www.chargebee.com/docs/2.0/credit-notes.html#creating-promotional-credits).
|
|
127
|
+
|
|
128
|
+
For example, if a customer has credits of $10, if you pass the **amount** as $10, then the customer's credit balance would become $20.
|
|
129
|
+
|
|
130
|
+
*/
|
|
131
|
+
|
|
23
132
|
add(input:AddInputParam):ChargebeeRequest<AddResponse>;
|
|
24
133
|
}
|
|
25
|
-
export interface RetrieveResponse {
|
|
26
|
-
|
|
134
|
+
export interface RetrieveResponse {
|
|
135
|
+
promotional_credit:PromotionalCredit;
|
|
27
136
|
}
|
|
28
137
|
|
|
29
|
-
export interface ListResponse {
|
|
30
|
-
|
|
31
|
-
|
|
138
|
+
export interface ListResponse {
|
|
139
|
+
/**
|
|
140
|
+
* @description This endpoint lists the promotional credits set for a customer
|
|
141
|
+
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
list:{promotional_credit:PromotionalCredit}[];
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @description This endpoint lists the promotional credits set for a customer
|
|
148
|
+
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
next_offset?:string;
|
|
32
152
|
}
|
|
33
153
|
export interface ListInputParam {
|
|
34
|
-
[key : string]: any;
|
|
154
|
+
[key : string]: any;
|
|
155
|
+
/**
|
|
156
|
+
* @description The number of resources to be returned.
|
|
157
|
+
|
|
158
|
+
*/
|
|
159
|
+
|
|
35
160
|
limit?:number;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @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.
|
|
164
|
+
|
|
165
|
+
*/
|
|
166
|
+
|
|
36
167
|
offset?:string;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @description Unique reference ID provided for promotional credits
|
|
171
|
+
|
|
172
|
+
*/
|
|
173
|
+
|
|
37
174
|
id?:{is?:string,is_not?:string,starts_with?:string};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @description Timestamp indicating when this promotional credit resource is created.
|
|
178
|
+
|
|
179
|
+
*/
|
|
180
|
+
|
|
38
181
|
created_at?:{after?:string,before?:string,between?:string,on?:string};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @description Type of promotional credits
|
|
185
|
+
|
|
186
|
+
*/
|
|
187
|
+
|
|
39
188
|
type?:{in?:string,is?:'decrement' | 'increment',is_not?:'decrement' | 'increment',not_in?:string};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @description Identifier of the customer.
|
|
192
|
+
|
|
193
|
+
*/
|
|
194
|
+
|
|
40
195
|
customer_id?:{is?:string,is_not?:string,starts_with?:string};
|
|
41
196
|
}
|
|
42
|
-
export interface DeductResponse {
|
|
43
|
-
|
|
44
|
-
|
|
197
|
+
export interface DeductResponse {
|
|
198
|
+
customer:Customer;
|
|
199
|
+
|
|
200
|
+
promotional_credit:PromotionalCredit;
|
|
45
201
|
}
|
|
46
202
|
export interface DeductInputParam {
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @description Identifier of the customer.
|
|
206
|
+
|
|
207
|
+
*/
|
|
208
|
+
|
|
47
209
|
customer_id:string;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @description Promotional credits amount.
|
|
213
|
+
|
|
214
|
+
*/
|
|
215
|
+
|
|
48
216
|
amount?:number;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @description Amount in decimal.
|
|
220
|
+
|
|
221
|
+
*/
|
|
222
|
+
|
|
49
223
|
amount_in_decimal?:string;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @description The currency code (ISO 4217 format) for promotional credit.
|
|
227
|
+
|
|
228
|
+
*/
|
|
229
|
+
|
|
50
230
|
currency_code?:string;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @description Detailed description of this promotional credits.
|
|
234
|
+
|
|
235
|
+
*/
|
|
236
|
+
|
|
51
237
|
description:string;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @description Type of promotional credits provided to customer. \* general - General \* referral_rewards - Referral \* loyalty_credits - Loyalty Credits
|
|
241
|
+
|
|
242
|
+
*/
|
|
243
|
+
|
|
52
244
|
credit_type?:CreditType;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @description Describes why promotional credits were provided.
|
|
248
|
+
|
|
249
|
+
*/
|
|
250
|
+
|
|
53
251
|
reference?:string;
|
|
54
252
|
}
|
|
55
|
-
export interface SetResponse {
|
|
56
|
-
|
|
57
|
-
|
|
253
|
+
export interface SetResponse {
|
|
254
|
+
customer:Customer;
|
|
255
|
+
|
|
256
|
+
promotional_credit:PromotionalCredit;
|
|
58
257
|
}
|
|
59
258
|
export interface SetInputParam {
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @description Identifier of the customer.
|
|
262
|
+
|
|
263
|
+
*/
|
|
264
|
+
|
|
60
265
|
customer_id:string;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* @description Promotional credits amount.
|
|
269
|
+
|
|
270
|
+
*/
|
|
271
|
+
|
|
61
272
|
amount?:number;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @description Amount in decimal.
|
|
276
|
+
|
|
277
|
+
*/
|
|
278
|
+
|
|
62
279
|
amount_in_decimal?:string;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @description The currency code (ISO 4217 format) for promotional credit.
|
|
283
|
+
|
|
284
|
+
*/
|
|
285
|
+
|
|
63
286
|
currency_code?:string;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @description Detailed description of this promotional credits.
|
|
290
|
+
|
|
291
|
+
*/
|
|
292
|
+
|
|
64
293
|
description:string;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @description Type of promotional credits provided to customer. \* general - General \* referral_rewards - Referral \* loyalty_credits - Loyalty Credits
|
|
297
|
+
|
|
298
|
+
*/
|
|
299
|
+
|
|
65
300
|
credit_type?:CreditType;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @description Describes why promotional credits were provided.
|
|
304
|
+
|
|
305
|
+
*/
|
|
306
|
+
|
|
66
307
|
reference?:string;
|
|
67
308
|
}
|
|
68
|
-
export interface AddResponse {
|
|
69
|
-
|
|
70
|
-
|
|
309
|
+
export interface AddResponse {
|
|
310
|
+
customer:Customer;
|
|
311
|
+
|
|
312
|
+
promotional_credit:PromotionalCredit;
|
|
71
313
|
}
|
|
72
314
|
export interface AddInputParam {
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @description Identifier of the customer.
|
|
318
|
+
|
|
319
|
+
*/
|
|
320
|
+
|
|
73
321
|
customer_id:string;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* @description Promotional credits amount.
|
|
325
|
+
|
|
326
|
+
*/
|
|
327
|
+
|
|
74
328
|
amount?:number;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @description Amount in decimal.
|
|
332
|
+
|
|
333
|
+
*/
|
|
334
|
+
|
|
75
335
|
amount_in_decimal?:string;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* @description The currency code (ISO 4217 format) for promotional credit.
|
|
339
|
+
|
|
340
|
+
*/
|
|
341
|
+
|
|
76
342
|
currency_code?:string;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* @description Detailed description of this promotional credits.
|
|
346
|
+
|
|
347
|
+
*/
|
|
348
|
+
|
|
77
349
|
description:string;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* @description Type of promotional credits provided to customer. \* general - General \* referral_rewards - Referral \* loyalty_credits - Loyalty Credits
|
|
353
|
+
|
|
354
|
+
*/
|
|
355
|
+
|
|
78
356
|
credit_type?:CreditType;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* @description Describes why promotional credits were provided.
|
|
360
|
+
|
|
361
|
+
*/
|
|
362
|
+
|
|
79
363
|
reference?:string;
|
|
80
364
|
}
|
|
81
365
|
|
|
@@ -1,42 +1,243 @@
|
|
|
1
1
|
///<reference path='./../core.d.ts'/>
|
|
2
2
|
declare module 'chargebee' {
|
|
3
3
|
export interface Purchase {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description The unique identifier of the purchase resource. This is always autogenerated.
|
|
7
|
+
|
|
8
|
+
*/
|
|
9
|
+
|
|
4
10
|
id?:string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @description The unique identifier of the [customer](https://apidocs.chargebee.com/docs/api/customers) that made this purchase.
|
|
14
|
+
|
|
15
|
+
*/
|
|
16
|
+
|
|
5
17
|
customer_id:string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @description The time at which this purchase was created.
|
|
21
|
+
|
|
22
|
+
*/
|
|
23
|
+
|
|
6
24
|
created_at?:number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description The time at which the purchase was modified.
|
|
28
|
+
|
|
29
|
+
*/
|
|
30
|
+
|
|
7
31
|
modified_at?:number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @description The unique identifiers of the [subscriptions](https://apidocs.chargebee.com/docs/api/subscriptions) that are created as part of this purchase. These IDs remain even when the associated subscriptions have been deleted.
|
|
35
|
+
|
|
36
|
+
*/
|
|
37
|
+
|
|
8
38
|
subscription_ids?:string[];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @description The unique identifier of the [invoice(s)](invoices) created immediately as part of this purchase.
|
|
42
|
+
|
|
43
|
+
*/
|
|
44
|
+
|
|
9
45
|
invoice_ids?:string[];
|
|
10
46
|
}
|
|
11
47
|
export namespace Purchase {
|
|
12
|
-
export class PurchaseResource {
|
|
48
|
+
export class PurchaseResource {
|
|
49
|
+
/**
|
|
50
|
+
* @description Creates a `purchase` resource. A purchase can contain one or more of the following:
|
|
51
|
+
|
|
52
|
+
* subscriptions (a [subscription](subscriptions) resource consists of item prices such that at least one of the item prices belongs to an [item](items) of `type` `plan`.)
|
|
53
|
+
* group of one-time charges (aka [charge item prices](item_prices#types))
|
|
54
|
+
|
|
55
|
+
When you call this API, the invoices for the subscription(s) and one-time charge(s) are created immediately and not left [unbilled](subscriptions?prod_cat_ver=2#create_subscription_for_items_invoice_immediately).
|
|
56
|
+
**Note**
|
|
57
|
+
|
|
58
|
+
Providing `shipping_addresses[]` is required when the [Orders feature](https://www.chargebee.com/docs/2.0/orders.html#configuration_step-1-configure-site-wide-settings) has been enabled.
|
|
59
|
+
|
|
60
|
+
### Specifying `purchase_item` groups {#groups}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
When creating a purchase, you must specify the *group* or `index` to which each item price belongs. You can do this by setting the `purchase_items[index]` for each item price. Item prices with the same `purchase_items[index]` belong to the same group.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
The grouping of item prices allows you to specify the `discounts[]` applicable for each group and indicate which item prices should be added to any subscriptions you want to create. Groups can be one of two types:
|
|
67
|
+
|
|
68
|
+
* Subscription groups
|
|
69
|
+
* One-time charge groups
|
|
70
|
+
|
|
71
|
+
The following subsections describe the types of groups in detail.
|
|
72
|
+
**Note**
|
|
73
|
+
|
|
74
|
+
You can specify up to 10 groups,
|
|
75
|
+
|
|
76
|
+
* with a recommended subscription group of 5. To increase this limit to a maximum of 8, contact [Chargebee Support](https://support.chargebee.com).
|
|
77
|
+
* with a maximum of 10 one-time charge groups by default.
|
|
78
|
+
|
|
79
|
+
The total limit for group items for a single purchase is 60.
|
|
80
|
+
|
|
81
|
+
#### Subscription groups {#subscription}
|
|
82
|
+
|
|
83
|
+
To create a subscription, specify a *subscription group* . A subscription [group](#groups) is a group of item prices that contains exactly one item price of `type` `plan`. To create multiple subscriptions, provide multiple subscription groups.
|
|
84
|
+
**Note**
|
|
85
|
+
|
|
86
|
+
A subscription group can have up to 20 non-plan item prices. To increase this limit to a maximum of 60, contact [Chargebee Support](https://support.chargebee.com).
|
|
87
|
+
|
|
88
|
+
#### Custom Fields {#custom-fields}
|
|
89
|
+
|
|
90
|
+
Purchase API supports custom fields of Subscriptions, use the following format to specify custom fields in Purchase API: **`subscription_info[custom_field]`**.
|
|
91
|
+
|
|
92
|
+
#### One-time charge groups {#one-time}
|
|
93
|
+
|
|
94
|
+
A one-time charge [group](#groups) is a group of charge item prices (i.e. item prices belonging to items of `type` `charge`). Charge item prices can be added to subscription groups as well. The charges within and across each one-time group must be unique.
|
|
95
|
+
**Note**
|
|
96
|
+
|
|
97
|
+
* A one-time charge group can have up to 20 item prices. To increase this limit to a maximum of 60, contact [Chargebee Support](https://support.chargebee.com).
|
|
98
|
+
* A charge item price can only be added to a single one-time charge group. However, it can be part of multiple [subscription groups](#subscription).
|
|
99
|
+
|
|
100
|
+
### Applying discounts {#discounts}
|
|
101
|
+
|
|
102
|
+
Discounts, both [manual discounts](discounts) and <coupons>, can be applied to groups by specifying the `discounts[]` array. The following table describes the method of application based on whether `discounts[index][i]` is provided:
|
|
103
|
+
|
|
104
|
+
| | **`discounts[index][i]` is provided** | **`discounts[index][i]` is not provided** |
|
|
105
|
+
|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
106
|
+
| **Coupons** | * The coupon is applied exclusively to the invoice for group `i`. * The coupon is applied exclusively to the invoice created immediately upon invoking this API. * If group `i` is a [subscription group](#subscription), then the coupon is applied to invoices for subscription renewals based on coupon attributes such as `duration_type` and `max_redemptions`. | * The coupon is applied to all the invoices immediately generated upon invoking this API. * The coupon is not applied to subsequent invoices, such as those generated upon subscription renewal. |
|
|
107
|
+
| **Manual discounts** | * The manual discount is applied exclusively to the invoice for group `i`. * The manual discount is applied exclusively to the invoice created immediately upon invoking this API. * The manual discount is not applied to subsequent invoices, such as those generated upon subscription renewal. | * The manual discount is applied to all the invoices immediately generated upon invoking this API. * The manual discount is not applied to subsequent invoices, such as those generated upon subscription renewal. |
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
*/
|
|
111
|
+
|
|
13
112
|
create(input:CreateInputParam):ChargebeeRequest<CreateResponse>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @description Returns an estimate for creating a `purchase` resource. The operation works exactly like [Create a purchase](purchases#create_a_purchase), except that only an [estimate](estimates) resource is returned without an actual `purchase` resource being created.
|
|
116
|
+
|
|
117
|
+
*/
|
|
118
|
+
|
|
14
119
|
estimate(input?:EstimateInputParam):ChargebeeRequest<EstimateResponse>;
|
|
15
120
|
}
|
|
16
|
-
export interface CreateResponse {
|
|
17
|
-
|
|
121
|
+
export interface CreateResponse {
|
|
122
|
+
purchase:Purchase;
|
|
18
123
|
}
|
|
19
124
|
export interface CreateInputParam {
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @description The unique identifier of the [customer](https://apidocs.chargebee.com/docs/api/customers) that made this purchase.
|
|
128
|
+
|
|
129
|
+
*/
|
|
130
|
+
|
|
20
131
|
customer_id:string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @description Parameters for invoice_info
|
|
135
|
+
|
|
136
|
+
*/
|
|
137
|
+
|
|
21
138
|
invoice_info?:{notes?:string,po_number?:string};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @description Parameters for purchase_items
|
|
142
|
+
|
|
143
|
+
*/
|
|
144
|
+
|
|
22
145
|
purchase_items?:{index:number,item_price_id:string,quantity?:number,quantity_in_decimal?:string,unit_amount?:number,unit_amount_in_decimal?:string}[];
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @description Parameters for item_tiers
|
|
149
|
+
|
|
150
|
+
*/
|
|
151
|
+
|
|
23
152
|
item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,index:number,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[];
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @description Parameters for shipping_addresses
|
|
156
|
+
|
|
157
|
+
*/
|
|
158
|
+
|
|
24
159
|
shipping_addresses?:{city?:string,company?:string,country?:string,email?:string,first_name?:string,last_name?:string,line1?:string,line2?:string,line3?:string,phone?:string,state?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string}[];
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @description Parameters for discounts
|
|
163
|
+
|
|
164
|
+
*/
|
|
165
|
+
|
|
25
166
|
discounts?:{amount?:number,coupon_id?:string,included_in_mrr?:boolean,index?:number,percentage?:number}[];
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @description Parameters for subscription_info
|
|
170
|
+
|
|
171
|
+
*/
|
|
172
|
+
|
|
26
173
|
subscription_info?:{billing_cycles?:number,index:number,meta_data?:object,subscription_id?:string}[];
|
|
27
174
|
}
|
|
28
|
-
export interface EstimateResponse {
|
|
29
|
-
|
|
175
|
+
export interface EstimateResponse {
|
|
176
|
+
estimate:Estimate;
|
|
30
177
|
}
|
|
31
178
|
export interface EstimateInputParam {
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @description Indicates the Client profile id for the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration.
|
|
182
|
+
|
|
183
|
+
*/
|
|
184
|
+
|
|
32
185
|
client_profile_id?:string;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @description The unique identifier of the [customer](https://apidocs.chargebee.com/docs/api/customers) that made this purchase.
|
|
189
|
+
|
|
190
|
+
*/
|
|
191
|
+
|
|
33
192
|
customer_id?:string;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @description Parameters for customer
|
|
196
|
+
|
|
197
|
+
*/
|
|
198
|
+
|
|
34
199
|
customer?:{customer_type?:CustomerType,entity_code?:EntityCode,exempt_number?:string,exemption_details?:any[],registered_for_gst?:boolean,taxability?:Taxability,vat_number?:string,vat_number_prefix?:string};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @description Parameters for billing_address
|
|
203
|
+
|
|
204
|
+
*/
|
|
205
|
+
|
|
35
206
|
billing_address?:{city?:string,country?:string,line1?:string,line2?:string,line3?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @description Parameters for purchase_items
|
|
210
|
+
|
|
211
|
+
*/
|
|
212
|
+
|
|
36
213
|
purchase_items?:{index:number,item_price_id:string,quantity?:number,quantity_in_decimal?:string,unit_amount?:number,unit_amount_in_decimal?:string}[];
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @description Parameters for item_tiers
|
|
217
|
+
|
|
218
|
+
*/
|
|
219
|
+
|
|
37
220
|
item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,index:number,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[];
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @description Parameters for shipping_addresses
|
|
224
|
+
|
|
225
|
+
*/
|
|
226
|
+
|
|
38
227
|
shipping_addresses?:{city?:string,company?:string,country?:string,email?:string,first_name?:string,last_name?:string,line1?:string,line2?:string,line3?:string,phone?:string,state?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string}[];
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @description Parameters for discounts
|
|
231
|
+
|
|
232
|
+
*/
|
|
233
|
+
|
|
39
234
|
discounts?:{amount?:number,coupon_id?:string,included_in_mrr?:boolean,index?:number,percentage?:number}[];
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* @description Parameters for subscription_info
|
|
238
|
+
|
|
239
|
+
*/
|
|
240
|
+
|
|
40
241
|
subscription_info?:{billing_cycles?:number,index:number,subscription_id?:string}[];
|
|
41
242
|
}
|
|
42
243
|
|