chargebee 3.17.0-beta.2 → 3.18.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 +43 -8
- package/README.md +25 -173
- package/cjs/chargebee.cjs.js +4 -9
- package/cjs/environment.js +1 -1
- package/cjs/resources/api_endpoints.js +6 -2
- package/esm/chargebee.esm.js +2 -4
- package/esm/environment.js +1 -1
- package/esm/resources/api_endpoints.js +6 -2
- package/package.json +6 -11
- package/types/core.d.ts +19 -2
- package/types/index.d.ts +0 -65
- package/types/resources/CouponCode.d.ts +4 -0
- package/types/resources/CreditNote.d.ts +4 -0
- package/types/resources/Customer.d.ts +24 -2
- package/types/resources/Estimate.d.ts +13 -2
- package/types/resources/Gift.d.ts +12 -2
- package/types/resources/HostedPage.d.ts +5 -0
- package/types/resources/Invoice.d.ts +25 -2
- package/types/resources/ItemPrice.d.ts +5 -0
- package/types/resources/Order.d.ts +4 -0
- package/types/resources/PaymentIntent.d.ts +30 -5
- package/types/resources/PaymentSource.d.ts +6 -1
- package/types/resources/PricingPageSession.d.ts +2 -0
- package/types/resources/Purchase.d.ts +6 -1
- package/types/resources/SalesOrder.d.ts +1 -0
- package/types/resources/Subscription.d.ts +46 -7
- package/types/resources/Transaction.d.ts +8 -0
- package/types/resources/WebhookEvent.d.ts +28 -27
- package/cjs/resources/webhook/auth.js +0 -27
- package/cjs/resources/webhook/content.js +0 -3
- package/cjs/resources/webhook/handler.js +0 -40
- package/esm/resources/webhook/auth.js +0 -23
- package/esm/resources/webhook/content.js +0 -2
- package/esm/resources/webhook/handler.js +0 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,49 @@
|
|
|
1
|
-
### v3.
|
|
1
|
+
### v3.18.0 (2026-01-12)
|
|
2
|
+
* * *
|
|
2
3
|
|
|
3
|
-
###
|
|
4
|
-
*
|
|
5
|
-
* `WebhookEventType` and `WebhookContentType` are now exported from the main entry points.
|
|
4
|
+
### New Attributes:
|
|
5
|
+
* deleted has been added to SalesOrder.
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### New Parameters:
|
|
8
|
+
* invoice_usages has been added to HostedPage#CheckoutExistingForItemsInputParam.
|
|
8
9
|
|
|
9
|
-
###
|
|
10
|
-
*
|
|
11
|
-
|
|
10
|
+
### Bug fix:
|
|
11
|
+
* webhook event content types array resource incorrectly marked as object fixed (#96).
|
|
12
|
+
|
|
13
|
+
### v3.17.0 (2025-12-30)
|
|
14
|
+
* * *
|
|
15
|
+
|
|
16
|
+
### New Attributes:
|
|
17
|
+
* retry_engine has been added to Invoice#DunningAttempt.
|
|
18
|
+
|
|
19
|
+
### New Endpoint:
|
|
20
|
+
* move action has been added to ItemPrice.
|
|
21
|
+
|
|
22
|
+
### New Parameters:
|
|
23
|
+
* exclude_tax_type has been added to Estimate#RenewalEstimateInputParam.
|
|
24
|
+
* variant_id has been added to ItemPrice#MoveInputParam.
|
|
25
|
+
* custom has been added to PricingPageSession#CreateForNewSubscriptionInputParam.
|
|
26
|
+
* custom has been added to PricingPageSession#CreateForExistingSubscriptionInputParam.
|
|
27
|
+
|
|
28
|
+
### New Enums:
|
|
29
|
+
* ELECTRONIC_PAYMENT_STANDARD has been added to PaymentMethodTypeEnum.
|
|
30
|
+
* KBC_PAYMENT_BUTTON has been added to PaymentMethodTypeEnum.
|
|
31
|
+
* PAY_BY_BANK has been added to PaymentMethodTypeEnum.
|
|
32
|
+
* TRUSTLY has been added to PaymentMethodTypeEnum.
|
|
33
|
+
* STABLECOIN has been added to PaymentMethodTypeEnum.
|
|
34
|
+
|
|
35
|
+
### v3.16.2 (2025-12-17)
|
|
36
|
+
* * *
|
|
37
|
+
|
|
38
|
+
### Improvements:
|
|
39
|
+
* `WebhookContentType` is now deprecated but still available for backward compatibility.
|
|
40
|
+
|
|
41
|
+
### v3.16.1 (2025-12-17)
|
|
42
|
+
* * *
|
|
43
|
+
|
|
44
|
+
### Improvements:
|
|
45
|
+
* Renamed `WebhookContentType` to `WebhookEventType` for better clarity. `WebhookContentType` is now deprecated but still available for backward compatibility.
|
|
46
|
+
* Added runtime export of `WebhookEventType` enum.
|
|
12
47
|
|
|
13
48
|
### v3.16.0 (2025-12-01)
|
|
14
49
|
* * *
|
package/README.md
CHANGED
|
@@ -148,174 +148,6 @@ const chargebeeSiteEU = new Chargebee({
|
|
|
148
148
|
});
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
### Handle webhooks
|
|
152
|
-
|
|
153
|
-
Use the webhook handlers to parse and route webhook payloads from Chargebee with full TypeScript support.
|
|
154
|
-
|
|
155
|
-
#### Quick Start: Using the default `webhook` instance
|
|
156
|
-
|
|
157
|
-
The simplest way to handle webhooks is using the pre-configured `webhook` instance:
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
import express from 'express';
|
|
161
|
-
import { webhook, type WebhookEvent } from 'chargebee';
|
|
162
|
-
|
|
163
|
-
const app = express();
|
|
164
|
-
app.use(express.json());
|
|
165
|
-
|
|
166
|
-
webhook.on('subscription_created', async (event: WebhookEvent) => {
|
|
167
|
-
console.log(`Subscription created: ${event.id}`);
|
|
168
|
-
const subscription = event.content.subscription;
|
|
169
|
-
console.log(`Customer: ${subscription.customer_id}`);
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
webhook.on('error', (err: Error) => {
|
|
173
|
-
console.error('Webhook error:', err.message);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
app.post('/chargebee/webhooks', (req, res) => {
|
|
177
|
-
webhook.handle(req.body, req.headers);
|
|
178
|
-
res.status(200).send('OK');
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
app.listen(8080);
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
**Auto-configured Basic Auth:** The default `webhook` instance automatically configures Basic Auth validation if the following environment variables are set:
|
|
185
|
-
|
|
186
|
-
- `CHARGEBEE_WEBHOOK_USERNAME` - The expected username
|
|
187
|
-
- `CHARGEBEE_WEBHOOK_PASSWORD` - The expected password
|
|
188
|
-
|
|
189
|
-
When both are present, incoming webhook requests will be validated against these credentials. If not set, no authentication is applied.
|
|
190
|
-
|
|
191
|
-
#### Creating custom `WebhookHandler` instances
|
|
192
|
-
|
|
193
|
-
For more control or multiple webhook endpoints, create your own instances:
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
import express from 'express';
|
|
197
|
-
import { WebhookHandler, basicAuthValidator } from 'chargebee';
|
|
198
|
-
|
|
199
|
-
const app = express();
|
|
200
|
-
app.use(express.json());
|
|
201
|
-
|
|
202
|
-
const handler = new WebhookHandler();
|
|
203
|
-
|
|
204
|
-
// Register event listeners using .on() - events are fully typed
|
|
205
|
-
handler.on('subscription_created', async (event) => {
|
|
206
|
-
console.log(`Subscription created: ${event.id}`);
|
|
207
|
-
const subscription = event.content.subscription;
|
|
208
|
-
console.log(`Customer: ${subscription.customer_id}`);
|
|
209
|
-
console.log(`Plan: ${subscription.plan_id}`);
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
handler.on('payment_succeeded', async (event) => {
|
|
213
|
-
console.log(`Payment succeeded: ${event.id}`);
|
|
214
|
-
const transaction = event.content.transaction;
|
|
215
|
-
const customer = event.content.customer;
|
|
216
|
-
console.log(`Amount: ${transaction.amount}, Customer: ${customer.email}`);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
// Optional: Add request validator (e.g., Basic Auth)
|
|
220
|
-
handler.requestValidator = basicAuthValidator((username, password) => {
|
|
221
|
-
return username === 'admin' && password === 'secret';
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
app.post('/chargebee/webhooks', (req, res) => {
|
|
225
|
-
handler.handle(req.body, req.headers);
|
|
226
|
-
res.status(200).send('OK');
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
app.listen(8080);
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
#### Low-level: Parse and handle events manually
|
|
233
|
-
|
|
234
|
-
For more control, you can parse webhook events manually:
|
|
235
|
-
|
|
236
|
-
```typescript
|
|
237
|
-
import express from 'express';
|
|
238
|
-
import Chargebee, { type WebhookEvent } from 'chargebee';
|
|
239
|
-
|
|
240
|
-
const app = express();
|
|
241
|
-
app.use(express.json());
|
|
242
|
-
|
|
243
|
-
app.post('/chargebee/webhooks', async (req, res) => {
|
|
244
|
-
try {
|
|
245
|
-
const event = req.body as WebhookEvent;
|
|
246
|
-
|
|
247
|
-
switch (event.event_type) {
|
|
248
|
-
case 'subscription_created':
|
|
249
|
-
// Access event content with proper typing
|
|
250
|
-
const subscription = event.content.subscription;
|
|
251
|
-
console.log('Subscription created:', subscription.id);
|
|
252
|
-
break;
|
|
253
|
-
|
|
254
|
-
case 'payment_succeeded':
|
|
255
|
-
const transaction = event.content.transaction;
|
|
256
|
-
console.log('Payment succeeded:', transaction.amount);
|
|
257
|
-
break;
|
|
258
|
-
|
|
259
|
-
default:
|
|
260
|
-
console.log('Unhandled event type:', event.event_type);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
res.status(200).send('OK');
|
|
264
|
-
} catch (err) {
|
|
265
|
-
console.error('Error processing webhook:', err);
|
|
266
|
-
res.status(500).send('Error processing webhook');
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
app.listen(8080);
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
#### Handling Unhandled Events
|
|
274
|
-
|
|
275
|
-
By default, if an incoming webhook event type is not recognized or you haven't registered a corresponding callback handler, the SDK provides flexible options to handle these scenarios:
|
|
276
|
-
|
|
277
|
-
**Using the `unhandled_event` listener:**
|
|
278
|
-
|
|
279
|
-
```typescript
|
|
280
|
-
import { WebhookHandler } from 'chargebee';
|
|
281
|
-
|
|
282
|
-
const handler = new WebhookHandler();
|
|
283
|
-
|
|
284
|
-
handler.on('subscription_created', async (event) => {
|
|
285
|
-
// Handle subscription created
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
// Gracefully handle events without registered listeners
|
|
289
|
-
handler.on('unhandled_event', async (event) => {
|
|
290
|
-
console.log(`Received unhandled event: ${event.event_type}`);
|
|
291
|
-
// Log for monitoring or store for later processing
|
|
292
|
-
});
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
**Using the `error` listener for error handling:**
|
|
296
|
-
|
|
297
|
-
If an error occurs during webhook processing (e.g., invalid JSON, validator failure), the SDK will emit an `error` event:
|
|
298
|
-
|
|
299
|
-
```typescript
|
|
300
|
-
const handler = new WebhookHandler();
|
|
301
|
-
|
|
302
|
-
handler.on('subscription_created', async (event) => {
|
|
303
|
-
// Handle subscription created
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
// Catch any errors during webhook processing
|
|
307
|
-
handler.on('error', (err) => {
|
|
308
|
-
console.error('Webhook processing error:', err);
|
|
309
|
-
// Log to monitoring service, alert team, etc.
|
|
310
|
-
});
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
**Best Practices:**
|
|
314
|
-
|
|
315
|
-
- Use `unhandled_event` listener to acknowledge unknown events (return 200 OK) and log them
|
|
316
|
-
- Use `error` listener to catch and handle exceptions thrown during event processing
|
|
317
|
-
- Both listeners help ensure your webhook endpoint remains stable even when new event types are introduced by Chargebee
|
|
318
|
-
|
|
319
151
|
### Processing Webhooks - API Version Check
|
|
320
152
|
|
|
321
153
|
An attribute `api_version` is added to the [Event](https://apidocs.chargebee.com/docs/api/events) resource, which indicates the API version based on which the event content is structured. In your webhook servers, ensure this `api_version` is the same as the [API version](https://apidocs.chargebee.com/docs/api#versions) used by your webhook server's client library.
|
|
@@ -392,18 +224,38 @@ To improve type safety and gain better autocompletion when working with webhooks
|
|
|
392
224
|
#### Example
|
|
393
225
|
|
|
394
226
|
```ts
|
|
395
|
-
import Chargebee, {
|
|
227
|
+
import Chargebee, { WebhookEventType, WebhookEvent } from "chargebee";
|
|
396
228
|
|
|
397
229
|
const result = await chargebeeInstance.event.retrieve("{event-id}");
|
|
398
|
-
const
|
|
399
|
-
const subscription =
|
|
230
|
+
const subscriptionActivatedEvent: WebhookEvent<typeof WebhookEventType.SubscriptionActivated> = result.event;
|
|
231
|
+
const subscription = subscriptionActivatedEvent.content.subscription;
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
You can also use `WebhookEventType` in switch statements for runtime event handling:
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
import { WebhookEventType, WebhookEvent } from "chargebee";
|
|
238
|
+
|
|
239
|
+
function handleWebhook(event: WebhookEvent) {
|
|
240
|
+
switch (event.event_type) {
|
|
241
|
+
case WebhookEventType.SubscriptionCreated:
|
|
242
|
+
console.log("Subscription created:", event.content.subscription?.id);
|
|
243
|
+
break;
|
|
244
|
+
case WebhookEventType.PaymentSucceeded:
|
|
245
|
+
console.log("Payment succeeded:", event.content.transaction?.id);
|
|
246
|
+
break;
|
|
247
|
+
default:
|
|
248
|
+
console.log("Unhandled event:", event.event_type);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
400
251
|
```
|
|
401
252
|
|
|
402
253
|
#### Notes
|
|
403
254
|
|
|
404
255
|
* `WebhookEvent<T>` provides type hinting for the event payload, making it easier to work with specific event structures.
|
|
405
|
-
* Use
|
|
406
|
-
*
|
|
256
|
+
* Use `WebhookEventType` to specify the exact event type (e.g., `SubscriptionCreated`, `InvoiceGenerated`, etc.).
|
|
257
|
+
* `WebhookEventType` is available at runtime, so you can use it in switch statements and comparisons.
|
|
258
|
+
* `WebhookContentType` is deprecated but still available for backward compatibility.
|
|
407
259
|
|
|
408
260
|
### Custom HTTP Client
|
|
409
261
|
|
package/cjs/chargebee.cjs.js
CHANGED
|
@@ -2,17 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const createChargebee_js_1 = require("./createChargebee.js");
|
|
4
4
|
const FetchClient_js_1 = require("./net/FetchClient.js");
|
|
5
|
-
const
|
|
6
|
-
const handler_js_2 = require("./resources/webhook/handler.js");
|
|
7
|
-
const auth_js_1 = require("./resources/webhook/auth.js");
|
|
5
|
+
const eventType_js_1 = require("./resources/webhook/eventType.js");
|
|
8
6
|
const httpClient = new FetchClient_js_1.FetchHttpClient();
|
|
9
7
|
const Chargebee = (0, createChargebee_js_1.CreateChargebee)(httpClient);
|
|
10
8
|
module.exports = Chargebee;
|
|
11
9
|
module.exports.Chargebee = Chargebee;
|
|
12
10
|
module.exports.default = Chargebee;
|
|
13
|
-
// Export webhook
|
|
14
|
-
module.exports.
|
|
15
|
-
module.exports.
|
|
16
|
-
module.exports.WebhookContentType = handler_js_1.WebhookContentType;
|
|
17
|
-
module.exports.webhook = handler_js_2.default;
|
|
18
|
-
module.exports.basicAuthValidator = auth_js_1.basicAuthValidator;
|
|
11
|
+
// Export webhook event types
|
|
12
|
+
module.exports.WebhookEventType = eventType_js_1.WebhookEventType;
|
|
13
|
+
module.exports.WebhookContentType = eventType_js_1.WebhookContentType;
|
package/cjs/environment.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.Environment = {
|
|
|
11
11
|
hostSuffix: '.chargebee.com',
|
|
12
12
|
apiPath: '/api/v2',
|
|
13
13
|
timeout: DEFAULT_TIME_OUT,
|
|
14
|
-
clientVersion: '
|
|
14
|
+
clientVersion: 'v3.18.0',
|
|
15
15
|
port: DEFAULT_PORT,
|
|
16
16
|
timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
|
|
17
17
|
exportWaitInMillis: DEFAULT_EXPORT_WAIT,
|
|
@@ -4608,7 +4608,9 @@ exports.Endpoints = {
|
|
|
4608
4608
|
false,
|
|
4609
4609
|
null,
|
|
4610
4610
|
false,
|
|
4611
|
-
{
|
|
4611
|
+
{
|
|
4612
|
+
custom: 0,
|
|
4613
|
+
},
|
|
4612
4614
|
{
|
|
4613
4615
|
isIdempotent: true,
|
|
4614
4616
|
},
|
|
@@ -4621,7 +4623,9 @@ exports.Endpoints = {
|
|
|
4621
4623
|
false,
|
|
4622
4624
|
null,
|
|
4623
4625
|
false,
|
|
4624
|
-
{
|
|
4626
|
+
{
|
|
4627
|
+
custom: 0,
|
|
4628
|
+
},
|
|
4625
4629
|
{
|
|
4626
4630
|
isIdempotent: true,
|
|
4627
4631
|
},
|
package/esm/chargebee.esm.js
CHANGED
|
@@ -3,7 +3,5 @@ import { FetchHttpClient } from './net/FetchClient.js';
|
|
|
3
3
|
const httpClient = new FetchHttpClient();
|
|
4
4
|
const Chargebee = CreateChargebee(httpClient);
|
|
5
5
|
export default Chargebee;
|
|
6
|
-
// Export webhook
|
|
7
|
-
export {
|
|
8
|
-
export { default as webhook } from './resources/webhook/handler.js';
|
|
9
|
-
export { basicAuthValidator } from './resources/webhook/auth.js';
|
|
6
|
+
// Export webhook event types
|
|
7
|
+
export { WebhookEventType, WebhookContentType, } from './resources/webhook/eventType.js';
|
package/esm/environment.js
CHANGED
|
@@ -8,7 +8,7 @@ export const Environment = {
|
|
|
8
8
|
hostSuffix: '.chargebee.com',
|
|
9
9
|
apiPath: '/api/v2',
|
|
10
10
|
timeout: DEFAULT_TIME_OUT,
|
|
11
|
-
clientVersion: '
|
|
11
|
+
clientVersion: 'v3.18.0',
|
|
12
12
|
port: DEFAULT_PORT,
|
|
13
13
|
timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
|
|
14
14
|
exportWaitInMillis: DEFAULT_EXPORT_WAIT,
|
|
@@ -4605,7 +4605,9 @@ export const Endpoints = {
|
|
|
4605
4605
|
false,
|
|
4606
4606
|
null,
|
|
4607
4607
|
false,
|
|
4608
|
-
{
|
|
4608
|
+
{
|
|
4609
|
+
custom: 0,
|
|
4610
|
+
},
|
|
4609
4611
|
{
|
|
4610
4612
|
isIdempotent: true,
|
|
4611
4613
|
},
|
|
@@ -4618,7 +4620,9 @@ export const Endpoints = {
|
|
|
4618
4620
|
false,
|
|
4619
4621
|
null,
|
|
4620
4622
|
false,
|
|
4621
|
-
{
|
|
4623
|
+
{
|
|
4624
|
+
custom: 0,
|
|
4625
|
+
},
|
|
4622
4626
|
{
|
|
4623
4627
|
isIdempotent: true,
|
|
4624
4628
|
},
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chargebee",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0",
|
|
4
4
|
"description": "A library for integrating with Chargebee.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepack": "npm install && npm run build",
|
|
7
|
-
"test": "mocha -r ts-node/register 'test/**/*.test.ts'",
|
|
8
7
|
"build": "npm run build-esm && npm run build-cjs",
|
|
9
8
|
"build-esm": "rm -rf esm && mkdir -p esm && tsc -p tsconfig.esm.json && echo '{\"type\":\"module\"}' > esm/package.json",
|
|
10
9
|
"build-cjs": "rm -rf cjs && mkdir -p cjs && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > cjs/package.json",
|
|
@@ -33,6 +32,8 @@
|
|
|
33
32
|
"url": "http://github.com/chargebee/chargebee-node/blob/master/LICENSE"
|
|
34
33
|
}
|
|
35
34
|
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
},
|
|
36
37
|
"exports": {
|
|
37
38
|
"types": "./types/index.d.ts",
|
|
38
39
|
"browser": {
|
|
@@ -61,19 +62,13 @@
|
|
|
61
62
|
}
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@types/
|
|
65
|
-
"@types/mocha": "^10.0.10",
|
|
66
|
-
"@types/node": "20.12.0",
|
|
67
|
-
"chai": "^4.3.7",
|
|
68
|
-
"mocha": "^10.2.0",
|
|
65
|
+
"@types/node": "20.0.0",
|
|
69
66
|
"prettier": "^3.3.3",
|
|
70
|
-
"
|
|
71
|
-
"typescript": "^5.5.4",
|
|
72
|
-
"undici-types": "^7.16.0"
|
|
67
|
+
"typescript": "^5.5.4"
|
|
73
68
|
},
|
|
74
69
|
"prettier": {
|
|
75
70
|
"semi": true,
|
|
76
71
|
"singleQuote": true,
|
|
77
72
|
"parser": "typescript"
|
|
78
73
|
}
|
|
79
|
-
}
|
|
74
|
+
}
|
package/types/core.d.ts
CHANGED
|
@@ -369,6 +369,7 @@ declare module 'chargebee' {
|
|
|
369
369
|
| 'addon_created'
|
|
370
370
|
| 'addon_updated'
|
|
371
371
|
| 'addon_deleted';
|
|
372
|
+
type ExcludeTaxTypeEnum = 'exclusive' | 'none';
|
|
372
373
|
type ExportTypeEnum = 'data' | 'import_friendly_data';
|
|
373
374
|
type FreePeriodUnitEnum = 'day' | 'week' | 'month' | 'year';
|
|
374
375
|
type FriendOfferTypeEnum = 'none' | 'coupon' | 'coupon_code';
|
|
@@ -502,7 +503,12 @@ declare module 'chargebee' {
|
|
|
502
503
|
| 'automated_bank_transfer'
|
|
503
504
|
| 'klarna_pay_now'
|
|
504
505
|
| 'online_banking_poland'
|
|
505
|
-
| 'payconiq_by_bancontact'
|
|
506
|
+
| 'payconiq_by_bancontact'
|
|
507
|
+
| 'electronic_payment_standard'
|
|
508
|
+
| 'kbc_payment_button'
|
|
509
|
+
| 'pay_by_bank'
|
|
510
|
+
| 'trustly'
|
|
511
|
+
| 'stablecoin';
|
|
506
512
|
type PaymentMethodTypeEnum =
|
|
507
513
|
| 'card'
|
|
508
514
|
| 'paypal_express_checkout'
|
|
@@ -528,7 +534,12 @@ declare module 'chargebee' {
|
|
|
528
534
|
| 'automated_bank_transfer'
|
|
529
535
|
| 'klarna_pay_now'
|
|
530
536
|
| 'online_banking_poland'
|
|
531
|
-
| 'payconiq_by_bancontact'
|
|
537
|
+
| 'payconiq_by_bancontact'
|
|
538
|
+
| 'electronic_payment_standard'
|
|
539
|
+
| 'kbc_payment_button'
|
|
540
|
+
| 'pay_by_bank'
|
|
541
|
+
| 'trustly'
|
|
542
|
+
| 'stablecoin';
|
|
532
543
|
type PaymentVoucherTypeEnum = 'boleto';
|
|
533
544
|
type PeriodUnitEnum = 'day' | 'week' | 'month' | 'year';
|
|
534
545
|
type PriceTypeEnum = 'tax_exclusive' | 'tax_inclusive';
|
|
@@ -553,6 +564,7 @@ declare module 'chargebee' {
|
|
|
553
564
|
type RefundableCreditsHandlingEnum = 'no_action' | 'schedule_refund';
|
|
554
565
|
type ReportByEnum = 'customer' | 'invoice' | 'product' | 'subscription';
|
|
555
566
|
type ResumeOptionEnum = 'immediately' | 'specific_date';
|
|
567
|
+
type RetryEngineEnum = 'chargebee' | 'flexpay' | 'successplus';
|
|
556
568
|
type RoleEnum = 'primary' | 'backup' | 'none';
|
|
557
569
|
type ScheduleTypeEnum = 'immediate' | 'specific_dates' | 'fixed_intervals';
|
|
558
570
|
type SourceEnum =
|
|
@@ -621,6 +633,11 @@ declare module 'chargebee' {
|
|
|
621
633
|
| 'klarna_pay_now'
|
|
622
634
|
| 'online_banking_poland'
|
|
623
635
|
| 'payconiq_by_bancontact'
|
|
636
|
+
| 'electronic_payment_standard'
|
|
637
|
+
| 'kbc_payment_button'
|
|
638
|
+
| 'pay_by_bank'
|
|
639
|
+
| 'trustly'
|
|
640
|
+
| 'stablecoin'
|
|
624
641
|
| 'free_trial'
|
|
625
642
|
| 'pay_up_front'
|
|
626
643
|
| 'pay_as_you_go';
|
package/types/index.d.ts
CHANGED
|
@@ -250,69 +250,4 @@ declare module 'chargebee' {
|
|
|
250
250
|
virtualBankAccount: VirtualBankAccount.VirtualBankAccountResource;
|
|
251
251
|
webhookEndpoint: WebhookEndpoint.WebhookEndpointResource;
|
|
252
252
|
}
|
|
253
|
-
|
|
254
|
-
// Webhook Handler
|
|
255
|
-
export type WebhookEventName = EventTypeEnum | 'unhandled_event';
|
|
256
|
-
export type WebhookEventTypeValue = `${WebhookEventType}`;
|
|
257
|
-
/** @deprecated Use WebhookEventTypeValue instead */
|
|
258
|
-
export type WebhookContentTypeValue = WebhookEventTypeValue;
|
|
259
|
-
|
|
260
|
-
export type WebhookEventListener<
|
|
261
|
-
T extends WebhookEventType = WebhookEventType,
|
|
262
|
-
> = (event: WebhookEvent<T>) => Promise<void> | void;
|
|
263
|
-
export type WebhookErrorListener = (error: Error) => Promise<void> | void;
|
|
264
|
-
|
|
265
|
-
// Helper type to map string literal to enum member
|
|
266
|
-
type StringToWebhookEventType<S extends WebhookEventTypeValue> = {
|
|
267
|
-
[K in WebhookEventType]: `${K}` extends S ? K : never;
|
|
268
|
-
}[WebhookEventType];
|
|
269
|
-
|
|
270
|
-
export class WebhookHandler {
|
|
271
|
-
on<T extends WebhookEventType>(
|
|
272
|
-
eventName: T,
|
|
273
|
-
listener: WebhookEventListener<T>,
|
|
274
|
-
): this;
|
|
275
|
-
on<S extends WebhookEventTypeValue>(
|
|
276
|
-
eventName: S,
|
|
277
|
-
listener: WebhookEventListener<StringToWebhookEventType<S>>,
|
|
278
|
-
): this;
|
|
279
|
-
on(eventName: 'unhandled_event', listener: WebhookEventListener): this;
|
|
280
|
-
on(eventName: 'error', listener: WebhookErrorListener): this;
|
|
281
|
-
once<T extends WebhookEventType>(
|
|
282
|
-
eventName: T,
|
|
283
|
-
listener: WebhookEventListener<T>,
|
|
284
|
-
): this;
|
|
285
|
-
once<S extends WebhookEventTypeValue>(
|
|
286
|
-
eventName: S,
|
|
287
|
-
listener: WebhookEventListener<StringToWebhookEventType<S>>,
|
|
288
|
-
): this;
|
|
289
|
-
once(eventName: 'unhandled_event', listener: WebhookEventListener): this;
|
|
290
|
-
once(eventName: 'error', listener: WebhookErrorListener): this;
|
|
291
|
-
off<T extends WebhookEventType>(
|
|
292
|
-
eventName: T,
|
|
293
|
-
listener: WebhookEventListener<T>,
|
|
294
|
-
): this;
|
|
295
|
-
off<S extends WebhookEventTypeValue>(
|
|
296
|
-
eventName: S,
|
|
297
|
-
listener: WebhookEventListener<StringToWebhookEventType<S>>,
|
|
298
|
-
): this;
|
|
299
|
-
off(eventName: 'unhandled_event', listener: WebhookEventListener): this;
|
|
300
|
-
off(eventName: 'error', listener: WebhookErrorListener): this;
|
|
301
|
-
handle(
|
|
302
|
-
body: string | object,
|
|
303
|
-
headers?: Record<string, string | string[] | undefined>,
|
|
304
|
-
): void;
|
|
305
|
-
onError?: (error: any) => void;
|
|
306
|
-
requestValidator?: (
|
|
307
|
-
headers: Record<string, string | string[] | undefined>,
|
|
308
|
-
) => void;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// Webhook Auth
|
|
312
|
-
export function basicAuthValidator(
|
|
313
|
-
validateCredentials: (username: string, password: string) => boolean,
|
|
314
|
-
): (headers: Record<string, string | string[] | undefined>) => void;
|
|
315
|
-
|
|
316
|
-
// Default webhook handler instance
|
|
317
|
-
export const webhook: WebhookHandler;
|
|
318
253
|
}
|
|
@@ -12,6 +12,10 @@ declare module 'chargebee' {
|
|
|
12
12
|
|
|
13
13
|
export namespace CouponCode {
|
|
14
14
|
export class CouponCodeResource {
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
17
|
+
*/
|
|
18
|
+
|
|
15
19
|
create(
|
|
16
20
|
input: CreateInputParam,
|
|
17
21
|
headers?: ChargebeeRequestHeader,
|
|
@@ -113,6 +113,10 @@ declare module 'chargebee' {
|
|
|
113
113
|
headers?: ChargebeeRequestHeader,
|
|
114
114
|
): Promise<ChargebeeResponse<ListResponse>>;
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
118
|
+
*/
|
|
119
|
+
|
|
116
120
|
creditNotesForCustomer(
|
|
117
121
|
customer_id: string,
|
|
118
122
|
input?: CreditNotesForCustomerInputParam,
|
|
@@ -150,18 +150,30 @@ declare module 'chargebee' {
|
|
|
150
150
|
headers?: ChargebeeRequestHeader,
|
|
151
151
|
): Promise<ChargebeeResponse<DeleteContactResponse>>;
|
|
152
152
|
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
155
|
+
*/
|
|
156
|
+
|
|
153
157
|
addPromotionalCredits(
|
|
154
158
|
customer_id: string,
|
|
155
159
|
input: AddPromotionalCreditsInputParam,
|
|
156
160
|
headers?: ChargebeeRequestHeader,
|
|
157
161
|
): Promise<ChargebeeResponse<AddPromotionalCreditsResponse>>;
|
|
158
162
|
|
|
163
|
+
/**
|
|
164
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
165
|
+
*/
|
|
166
|
+
|
|
159
167
|
deductPromotionalCredits(
|
|
160
168
|
customer_id: string,
|
|
161
169
|
input: DeductPromotionalCreditsInputParam,
|
|
162
170
|
headers?: ChargebeeRequestHeader,
|
|
163
171
|
): Promise<ChargebeeResponse<DeductPromotionalCreditsResponse>>;
|
|
164
172
|
|
|
173
|
+
/**
|
|
174
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
175
|
+
*/
|
|
176
|
+
|
|
165
177
|
setPromotionalCredits(
|
|
166
178
|
customer_id: string,
|
|
167
179
|
input: SetPromotionalCreditsInputParam,
|
|
@@ -738,7 +750,12 @@ declare module 'chargebee' {
|
|
|
738
750
|
| 'sepa_instant_transfer'
|
|
739
751
|
| 'klarna_pay_now'
|
|
740
752
|
| 'online_banking_poland'
|
|
741
|
-
| 'payconiq_by_bancontact'
|
|
753
|
+
| 'payconiq_by_bancontact'
|
|
754
|
+
| 'electronic_payment_standard'
|
|
755
|
+
| 'kbc_payment_button'
|
|
756
|
+
| 'pay_by_bank'
|
|
757
|
+
| 'trustly'
|
|
758
|
+
| 'stablecoin';
|
|
742
759
|
reference_id?: string;
|
|
743
760
|
/**
|
|
744
761
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -911,7 +928,12 @@ declare module 'chargebee' {
|
|
|
911
928
|
| 'sepa_instant_transfer'
|
|
912
929
|
| 'klarna_pay_now'
|
|
913
930
|
| 'online_banking_poland'
|
|
914
|
-
| 'payconiq_by_bancontact'
|
|
931
|
+
| 'payconiq_by_bancontact'
|
|
932
|
+
| 'electronic_payment_standard'
|
|
933
|
+
| 'kbc_payment_button'
|
|
934
|
+
| 'pay_by_bank'
|
|
935
|
+
| 'trustly'
|
|
936
|
+
| 'stablecoin';
|
|
915
937
|
/**
|
|
916
938
|
* @deprecated Please refer API docs to use other attributes
|
|
917
939
|
*/
|
|
@@ -340,6 +340,7 @@ declare module 'chargebee' {
|
|
|
340
340
|
use_existing_balances?: boolean;
|
|
341
341
|
ignore_scheduled_cancellation?: boolean;
|
|
342
342
|
ignore_scheduled_changes?: boolean;
|
|
343
|
+
exclude_tax_type?: 'exclusive' | 'none';
|
|
343
344
|
}
|
|
344
345
|
export interface AdvanceInvoiceEstimateInputParam {
|
|
345
346
|
terms_to_charge?: number;
|
|
@@ -1041,7 +1042,12 @@ declare module 'chargebee' {
|
|
|
1041
1042
|
| 'sepa_instant_transfer'
|
|
1042
1043
|
| 'klarna_pay_now'
|
|
1043
1044
|
| 'online_banking_poland'
|
|
1044
|
-
| 'payconiq_by_bancontact'
|
|
1045
|
+
| 'payconiq_by_bancontact'
|
|
1046
|
+
| 'electronic_payment_standard'
|
|
1047
|
+
| 'kbc_payment_button'
|
|
1048
|
+
| 'pay_by_bank'
|
|
1049
|
+
| 'trustly'
|
|
1050
|
+
| 'stablecoin';
|
|
1045
1051
|
reference_id?: string;
|
|
1046
1052
|
/**
|
|
1047
1053
|
* @deprecated Please refer API docs to use other attributes
|
|
@@ -1119,7 +1125,12 @@ declare module 'chargebee' {
|
|
|
1119
1125
|
| 'sepa_instant_transfer'
|
|
1120
1126
|
| 'klarna_pay_now'
|
|
1121
1127
|
| 'online_banking_poland'
|
|
1122
|
-
| 'payconiq_by_bancontact'
|
|
1128
|
+
| 'payconiq_by_bancontact'
|
|
1129
|
+
| 'electronic_payment_standard'
|
|
1130
|
+
| 'kbc_payment_button'
|
|
1131
|
+
| 'pay_by_bank'
|
|
1132
|
+
| 'trustly'
|
|
1133
|
+
| 'stablecoin';
|
|
1123
1134
|
reference_id?: string;
|
|
1124
1135
|
/**
|
|
1125
1136
|
* @deprecated Please refer API docs to use other attributes
|