@paddle/paddle-node-sdk 2.2.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.
package/CHANGELOG.md CHANGED
@@ -12,6 +12,12 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
12
12
 
13
13
  This means when upgrading minor versions of the SDK, you may notice type errors. You can safely ignore these or fix by adding additional type guards.
14
14
 
15
+ ## 2.3.0 - 2025-01-06
16
+
17
+ ### Added
18
+
19
+ - Added `onResume` property to subscription resume and pause operations to [control billing for subscriptions when resuming](https://developer.paddle.com/changelog/2024/resume-subscription-billing-period-options)
20
+
15
21
  ## 2.2.2 - 2024-12-16
16
22
 
17
23
  ### Fixed
package/README.md CHANGED
@@ -254,7 +254,7 @@ const app = express()
254
254
 
255
255
  // Create a `POST` endpoint to accept webhooks sent by Paddle.
256
256
  // We need `raw` request body to validate the integrity. Use express raw middleware to ensure express doesn't convert the request body to JSON.
257
- app.post('/webhooks', express.raw({ type: 'application/json' }), (req: Request, res: Response) => {
257
+ app.post('/webhooks', express.raw({ type: 'application/json' }), async (req: Request, res: Response) => {
258
258
  const signature = (req.headers['paddle-signature'] as string) || '';
259
259
  // req.body should be of type `buffer`, convert to string before passing it to `unmarshal`.
260
260
  // If express returned a JSON, remove any other middleware that might have processed raw request to object
@@ -265,7 +265,7 @@ app.post('/webhooks', express.raw({ type: 'application/json' }), (req: Request,
265
265
  try {
266
266
  if (signature && rawRequestBody) {
267
267
  // The `unmarshal` function will validate the integrity of the webhook and return an entity
268
- const eventData = paddle.webhooks.unmarshal(rawRequestBody, secretKey, signature);
268
+ const eventData = await paddle.webhooks.unmarshal(rawRequestBody, secretKey, signature);
269
269
  switch (eventData.eventType) {
270
270
  case EventName.ProductUpdated:
271
271
  console.log(`Product ${eventData.data.id} was updated`);
@@ -20,3 +20,4 @@ __exportStar(require("./scheduled-change-action.js"), exports);
20
20
  __exportStar(require("./subscription-status.js"), exports);
21
21
  __exportStar(require("./subscription-item-status.js"), exports);
22
22
  __exportStar(require("./subscription-on-payment-failure.js"), exports);
23
+ __exportStar(require("./subscription-on-resume.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = '2.2.2';
4
+ exports.SDK_VERSION = '2.3.0';
@@ -4,3 +4,4 @@ export * from './scheduled-change-action.js';
4
4
  export * from './subscription-status.js';
5
5
  export * from './subscription-item-status.js';
6
6
  export * from './subscription-on-payment-failure.js';
7
+ export * from './subscription-on-resume.js';
@@ -1 +1 @@
1
- export const SDK_VERSION = '2.2.2';
1
+ export const SDK_VERSION = '2.3.0';
@@ -4,3 +4,4 @@ export * from './scheduled-change-action.js';
4
4
  export * from './subscription-status.js';
5
5
  export * from './subscription-item-status.js';
6
6
  export * from './subscription-on-payment-failure.js';
7
+ export * from './subscription-on-resume.js';
@@ -0,0 +1 @@
1
+ export type SubscriptionOnResume = 'continue_existing_billing_period' | 'start_new_billing_period';
@@ -1,5 +1,6 @@
1
- import { type SubscriptionEffectiveFrom } from '../../../enums/index.js';
1
+ import { type SubscriptionOnResume, type SubscriptionEffectiveFrom } from '../../../enums/index.js';
2
2
  export interface PauseSubscription {
3
3
  effectiveFrom?: SubscriptionEffectiveFrom | null;
4
4
  resumeAt?: null | string;
5
+ onResume?: SubscriptionOnResume;
5
6
  }
@@ -1,3 +1,5 @@
1
+ import { type SubscriptionOnResume } from '../../../enums/index.js';
1
2
  export interface ResumeSubscription {
2
3
  effectiveFrom: 'immediately' | string;
4
+ onResume?: SubscriptionOnResume;
3
5
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.2.2";
1
+ export declare const SDK_VERSION = "2.3.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paddle/paddle-node-sdk",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
5
5
  "main": "dist/cjs/index.cjs.node.js",
6
6
  "module": "dist/esm/index.esm.node.js",