From efaceba3678ccfd9352456f3dbec3b4c27f21c2d Mon Sep 17 00:00:00 2001 From: cnohall Date: Fri, 17 Oct 2025 09:34:36 +0900 Subject: [PATCH] clarify fiat amount maths --- app/PaymentDrivers/Blockonomics/Blockonomics.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/PaymentDrivers/Blockonomics/Blockonomics.php b/app/PaymentDrivers/Blockonomics/Blockonomics.php index 25e5aea913..613eff9a8c 100644 --- a/app/PaymentDrivers/Blockonomics/Blockonomics.php +++ b/app/PaymentDrivers/Blockonomics/Blockonomics.php @@ -144,7 +144,13 @@ class Blockonomics implements LivewireMethodInterface ]); try { - $fiat_amount = round(($request->btc_price * $request->btc_amount / 100000000), 2); + // Satoshis is the smallest unit of Bitcoin + $amount_received_satoshis = $request->btc_amount; + $amount_satohis_in_one_btc = 100000000; + $amount_received_btc = $amount_received_satoshis / $amount_satohis_in_one_btc; + $price_per_btc_in_fiat = $request->btc_price; + + $fiat_amount = round(($price_per_btc_in_fiat * $amount_received_btc), 2); $data = [ 'amount' => $fiat_amount,