diff --git a/server/src/business-layer/services/StripeService.ts b/server/src/business-layer/services/StripeService.ts index 69a7a1ca3..dbe0f6407 100644 --- a/server/src/business-layer/services/StripeService.ts +++ b/server/src/business-layer/services/StripeService.ts @@ -21,4 +21,27 @@ export default class StripeService { }) return result.data } + + public async createCheckoutSession( + client_reference_id: string, + return_url: string, + line_item: { + price: string + quantity: number + }, + metadata: Record + ) { + const session = await stripe.checkout.sessions.create({ + // consumer changeable + client_reference_id, + return_url, + line_items: [line_item], + metadata, + // configured internally and should not change + ui_mode: "embedded", + mode: "payment", + currency: "NZD" + }) + return session.client_secret + } }