From 34e2049ad95235c62049cae1804ecdc16fbcc44c Mon Sep 17 00:00:00 2001 From: Lucas Coratger <73360179+coratgerl@users.noreply.github.com> Date: Sat, 21 Dec 2024 20:01:23 +0100 Subject: [PATCH] feat(wabe-stripe): add invoice_creation param (#111) --- packages/wabe-stripe/src/index.test.ts | 3 +++ packages/wabe-stripe/src/index.ts | 4 ++++ packages/wabe/src/payment/interface.ts | 1 + 3 files changed, 8 insertions(+) diff --git a/packages/wabe-stripe/src/index.test.ts b/packages/wabe-stripe/src/index.test.ts index 153022d6..6b05f190 100644 --- a/packages/wabe-stripe/src/index.test.ts +++ b/packages/wabe-stripe/src/index.test.ts @@ -621,6 +621,9 @@ describe('wabe-stripe', () => { automatic_tax: { enabled: false, }, + invoice_creation: { + enabled: true, + }, }) }) diff --git a/packages/wabe-stripe/src/index.ts b/packages/wabe-stripe/src/index.ts index 5b3f9744..7abed236 100644 --- a/packages/wabe-stripe/src/index.ts +++ b/packages/wabe-stripe/src/index.ts @@ -141,6 +141,7 @@ export class StripeAdapter implements PaymentAdapter { currency, automaticTax, recurringInterval, + createInvoice = true, }: CreatePaymentOptions) { const customersWithSameEmail = await this.stripe.customers.list({ email: customerEmail, @@ -178,6 +179,9 @@ export class StripeAdapter implements PaymentAdapter { automatic_tax: { enabled: !!automaticTax, }, + invoice_creation: { + enabled: createInvoice, + }, ...(automaticTax ? { billing_address_collection: 'required', diff --git a/packages/wabe/src/payment/interface.ts b/packages/wabe/src/payment/interface.ts index af014c4d..316eda12 100644 --- a/packages/wabe/src/payment/interface.ts +++ b/packages/wabe/src/payment/interface.ts @@ -102,6 +102,7 @@ export type CreatePaymentOptions = { cancelUrl: string automaticTax?: boolean recurringInterval?: 'month' | 'year' + createInvoice?: boolean } export type InitWebhookOptions = {