From d0f619f255043c6cba62b5601f23179487dd7ed1 Mon Sep 17 00:00:00 2001 From: Igor Zynov Date: Tue, 29 Jul 2025 16:58:38 +0400 Subject: [PATCH] feat(payment-stripe): add support for custom unit amounts in price creation and entity definitions --- src/interfaces/payment-stripe/entities/price.ts | 6 ++++++ src/interfaces/payment-stripe/entities/transaction.ts | 2 -- src/interfaces/payment-stripe/methods/price/create.ts | 8 +++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/interfaces/payment-stripe/entities/price.ts b/src/interfaces/payment-stripe/entities/price.ts index 1eed5db..3cb298a 100644 --- a/src/interfaces/payment-stripe/entities/price.ts +++ b/src/interfaces/payment-stripe/entities/price.ts @@ -14,6 +14,12 @@ interface IPrice extends IEntity { updatedAt?: Date; product?: IProduct; metadata?: Record | null; + customUnitAmount?: { + enabled: boolean; + preset?: number; + minimum?: number; + maximum?: number; + }; } export default IPrice; diff --git a/src/interfaces/payment-stripe/entities/transaction.ts b/src/interfaces/payment-stripe/entities/transaction.ts index a5df05f..b0321f3 100644 --- a/src/interfaces/payment-stripe/entities/transaction.ts +++ b/src/interfaces/payment-stripe/entities/transaction.ts @@ -98,8 +98,6 @@ interface ITransaction extends IEntity { entityId?: string; // Smallest currency unit amount amount?: number; - // Custom amount paid by user for PWYW transactions (in cents) - customAmount?: number; // Smallest currency unit tax tax?: number; // Smallest currency unit fee diff --git a/src/interfaces/payment-stripe/methods/price/create.ts b/src/interfaces/payment-stripe/methods/price/create.ts index e9e0d70..53b7c65 100644 --- a/src/interfaces/payment-stripe/methods/price/create.ts +++ b/src/interfaces/payment-stripe/methods/price/create.ts @@ -4,8 +4,14 @@ interface IPriceCreateInput { productId: string; currency: string; userId: string; - unitAmount: number; + unitAmount?: number; // Optional when customUnitAmount is provided metadata?: Record; + customUnitAmount?: { + enabled: boolean; + preset?: number; + minimum?: number; + maximum?: number; + }; } interface IPriceCreateOutput {