diff --git a/package.json b/package.json index cf51379..8903bd5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@internxt/sdk", - "version": "1.5.13", + "version": "1.5.14", "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 4e8fc2d..d5b101a 100644 --- a/src/drive/payments/index.ts +++ b/src/drive/payments/index.ts @@ -34,29 +34,20 @@ export class Payments { this.apiSecurity = apiSecurity; } - private createCustomer(name: string, email: string): Promise<{ customerId: string; token: string }> { - return this.client.post('/create-customer', { name, email }, this.headers()); - } - - public getCustomerId(name: string, email: string): Promise<{ customerId: string; token: string }> { - const query = new URLSearchParams(); - query.set('email', email); - return this.client - .get<{ customerId: string; token: string }>(`/get-customer-id?${query.toString()}`, this.headers()) - .catch((err) => { - const error = err as AppError; - if (error.status === 404) { - return this.createCustomer(name, email); - } else { - throw error; - } - }); + public createCustomer( + name: string, + email: string, + country?: string, + companyVatId?: string, + ): Promise<{ customerId: string; token: string }> { + return this.client.post('/create-customer', { name, email, country, companyVatId }, this.headers()); } public createSubscription( customerId: string, priceId: string, token: string, + quantity: number, currency?: string, promoCodeId?: string, ): Promise { @@ -66,6 +57,7 @@ export class Payments { customerId, priceId, token, + quantity, currency, promoCodeId, },