From c770a5b2d810c95f191bf6534e37e87bb4c5f33f Mon Sep 17 00:00:00 2001 From: jaaaaavier Date: Wed, 11 Feb 2026 14:59:09 +0100 Subject: [PATCH] feat: add trackCanceledSubscription to --- package.json | 2 +- src/drive/payments/index.ts | 13 +++++++++++++ src/drive/payments/types/types.ts | 9 +++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index acb07a0..5e4c841 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@internxt/sdk", "author": "Internxt ", - "version": "1.12.6", + "version": "1.12.7", "description": "An sdk for interacting with Internxt's services", "repository": { "type": "git", diff --git a/src/drive/payments/index.ts b/src/drive/payments/index.ts index a62209c..649ae71 100644 --- a/src/drive/payments/index.ts +++ b/src/drive/payments/index.ts @@ -19,6 +19,8 @@ import { UpdateSubscriptionPaymentMethod, UserSubscription, UserType, + TrackSubscriptionCancelledPayload, + TrackSubscriptionCancelledResponse, } from './types/types'; export class Payments { @@ -255,6 +257,17 @@ export class Payments { return this.client.get(`/products/tier?${query.toString()}`, this.headers()); } + /** + * Tracks a cancelled subscription event by sending the user's email to the server + * @param payload - The cancelled subscription data containing the user's email + * @returns A promise that resolves with the success status and message from the server + */ + public trackCanceledSubscription( + payload: TrackSubscriptionCancelledPayload, + ): Promise { + return this.client.post('/subscriptions/track-cancelled-subscription', { ...payload }, this.headers()); + } + /** * Returns the needed headers for the module requests * @private diff --git a/src/drive/payments/types/types.ts b/src/drive/payments/types/types.ts index 13ee10e..42ea0db 100644 --- a/src/drive/payments/types/types.ts +++ b/src/drive/payments/types/types.ts @@ -215,3 +215,12 @@ export type AvailableProducts = { backups: boolean; }; }; + +export type TrackSubscriptionCancelledPayload = { + email: string; +}; + +export interface TrackSubscriptionCancelledResponse { + success: boolean; + message: string; +}