From 958adbe0256c3b72349446b8680b5118cff3d436 Mon Sep 17 00:00:00 2001 From: Marcus Pasell Date: Fri, 16 Sep 2022 11:44:32 -0700 Subject: [PATCH] Add a route to start a stripe session in SDK --- libs/src/services/identity/IdentityService.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libs/src/services/identity/IdentityService.ts b/libs/src/services/identity/IdentityService.ts index 2d5f8e4cb2d..206817161d3 100644 --- a/libs/src/services/identity/IdentityService.ts +++ b/libs/src/services/identity/IdentityService.ts @@ -76,6 +76,17 @@ type InAppAudioPurchaseMetadata = { cleanupTransactionId?: string } +type CreateStripeSessionRequest = { + destinationWallet: string + amount: string +} + +type CreateStripeSessionResponse = { + id: string + client_secret: string + status: string +} + // Only probabilistically capture 50% of relay captchas const RELAY_CAPTCHA_SAMPLE_RATE = 0.5 @@ -556,6 +567,19 @@ export class IdentityService { }) } + async createStripeSession( + data: CreateStripeSessionRequest + ): Promise { + const headers = await this._signData() + + return await this._makeRequest({ + url: '/stripe/session', + method: 'post', + data, + headers + }) + } + /* ------- INTERNAL FUNCTIONS ------- */ async _makeRequest(axiosRequestObj: AxiosRequestConfig) {