diff --git a/api/stripe/createPaymentIntent.cfm b/api/stripe/createPaymentIntent.cfm index 828a6d9..9c2b721 100644 --- a/api/stripe/createPaymentIntent.cfm +++ b/api/stripe/createPaymentIntent.cfm @@ -60,9 +60,9 @@ try { abort; } - // Get business Stripe account + // Get business Stripe account and fee settings qBusiness = queryExecute(" - SELECT StripeAccountID, StripeOnboardingComplete, Name + SELECT StripeAccountID, StripeOnboardingComplete, Name, PayfritFee FROM Businesses WHERE ID = :businessID ", { businessID: businessID }, { datasource: "payfrit" }); @@ -108,8 +108,9 @@ try { // ============================================================ // FEE CALCULATION // ============================================================ - customerFeePercent = 0.05; // 5% customer pays to Payfrit - businessFeePercent = 0.05; // 5% business pays to Payfrit + // Customer fee from database (PayfritFee), default 5% if not set + customerFeePercent = isNumeric(qBusiness.PayfritFee) && qBusiness.PayfritFee > 0 ? qBusiness.PayfritFee : 0.05; + businessFeePercent = 0.05; // 5% business pays to Payfrit (always) cardFeePercent = 0.029; // 2.9% Stripe fee cardFeeFixed = 0.30; // $0.30 Stripe fixed fee