Skip to content

Commit 45e9434

Browse files
authored
feat(payment-stripe): add support for custom unit amounts in price creation and entity definitions (#106)
1 parent 840017b commit 45e9434

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/interfaces/payment-stripe/entities/price.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ interface IPrice extends IEntity {
1414
updatedAt?: Date;
1515
product?: IProduct;
1616
metadata?: Record<string, any> | null;
17+
customUnitAmount?: {
18+
enabled: boolean;
19+
preset?: number;
20+
minimum?: number;
21+
maximum?: number;
22+
};
1723
}
1824

1925
export default IPrice;

src/interfaces/payment-stripe/entities/transaction.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ interface ITransaction extends IEntity {
9898
entityId?: string;
9999
// Smallest currency unit amount
100100
amount?: number;
101-
// Custom amount paid by user for PWYW transactions (in cents)
102-
customAmount?: number;
103101
// Smallest currency unit tax
104102
tax?: number;
105103
// Smallest currency unit fee

src/interfaces/payment-stripe/methods/price/create.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ interface IPriceCreateInput {
44
productId: string;
55
currency: string;
66
userId: string;
7-
unitAmount: number;
7+
unitAmount?: number; // Optional when customUnitAmount is provided
88
metadata?: Record<string, any>;
9+
customUnitAmount?: {
10+
enabled: boolean;
11+
preset?: number;
12+
minimum?: number;
13+
maximum?: number;
14+
};
915
}
1016

1117
interface IPriceCreateOutput {

0 commit comments

Comments
 (0)