From 063d042378c36eb0073f5cfa7b05cf209e5e62f4 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sun, 28 Jan 2024 14:45:43 -0500 Subject: [PATCH] Update guest_ajax.php with the new stripe vars --- guest_ajax.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/guest_ajax.php b/guest_ajax.php index 44402413..b80560d5 100644 --- a/guest_ajax.php +++ b/guest_ajax.php @@ -54,6 +54,8 @@ if (isset($_GET['stripe_create_pi'])) { $config_sql = mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1"); $config_row = mysqli_fetch_array($config_sql); $config_stripe_client_pays_fees = intval($config_row['config_stripe_client_pays_fees']); + $config_stripe_percentage_fee = floatval($config_row['config_stripe_percentage_fee']); + $config_stripe_flat_fee = floatval($config_row['config_stripe_flat_fee']); // Add up all the payments for the invoice and get the total amount paid to the invoice $sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id"); @@ -63,11 +65,8 @@ if (isset($_GET['stripe_create_pi'])) { // Check config to see if client pays fees is enabled if ($config_stripe_client_pays_fees == 1) { - // Get fees from config - $percentage_fee = 0.029; // Default Stripe fee - $flat_fee = 0.30; // Default Stripe fee // Calculate the amount to charge the client - $balance_to_pay = ($balance_to_pay + $flat_fee) / (1 - $percentage_fee); + $balance_to_pay = ($balance_to_pay + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee); } $balance_to_pay = round($balance_to_pay, 2);