Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@internxt/sdk",
"author": "Internxt <hello@internxt.com>",
"version": "1.12.6",
"version": "1.12.7",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions src/drive/payments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
UpdateSubscriptionPaymentMethod,
UserSubscription,
UserType,
TrackSubscriptionCancelledPayload,
TrackSubscriptionCancelledResponse,
} from './types/types';

export class Payments {
Expand Down Expand Up @@ -255,6 +257,17 @@ export class Payments {
return this.client.get<Tier>(`/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<TrackSubscriptionCancelledResponse> {
return this.client.post('/subscriptions/track-cancelled-subscription', { ...payload }, this.headers());
}

/**
* Returns the needed headers for the module requests
* @private
Expand Down
9 changes: 9 additions & 0 deletions src/drive/payments/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,12 @@ export type AvailableProducts = {
backups: boolean;
};
};

export type TrackSubscriptionCancelledPayload = {
email: string;
};

export interface TrackSubscriptionCancelledResponse {
success: boolean;
message: string;
}
Loading