Anu Posted May 3, 2022 Share Posted May 3, 2022 My Payment Gateway only supports LKR Cash Client registration on my website is allowed in USD (not allowed in LKR) Product prices on my website are in USD. Therefore, from the Payment Gateway Settings, I have selected Convert To For Processing as LKR. After making the payment related to the payment gateway, the amount made in LKR will be invoiced in USD For example My site is priced at $ 2.94 with Web Hosting, which is 1097 LKR. if a payment of LKR 1097 is made, it will be noted on the invoice as USD 1097 That amount is deducted $ 2.94 and added to the account as a $ 1067 Credit Balance. This is a big problem for us See the invoice below Below is the Gateway Transaction Log Help us fix this Thanks everyone 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted May 3, 2022 Share Posted May 3, 2022 Hello, What's the chosen Currency o Client's Profile ? 0 Quote Link to comment Share on other sites More sharing options...
Anu Posted May 3, 2022 Author Share Posted May 3, 2022 2 minutes ago, pRieStaKos said: Hello, What's the chosen Currency o Client's Profile ? Client's profile contains USD currency. 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted May 3, 2022 Share Posted May 3, 2022 What’s the payment gateway ? You can set the currency to be LKR always with code, if there is no option for this. 0 Quote Link to comment Share on other sites More sharing options...
Anu Posted May 3, 2022 Author Share Posted May 3, 2022 1 hour ago, pRieStaKos said: What’s the payment gateway ? You can set the currency to be LKR always with code, if there is no option for this. Yes, this problem does not occur if the profile is changed to LKR. Then when the exchange rates change the price of LKR in the profile does not change. It's a big problem. I googled a solution to it and searched for about 10 days but could not find it. I limited my registration to USD. Do you know the solution? I use the ipay.lk payment gateway in Sri Lanka 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted May 3, 2022 Share Posted May 3, 2022 8 minutes ago, Anu said: Yes, this problem does not occur if the profile is changed to LKR. Then when the exchange rates change the price of LKR in the profile does not change. It's a big problem. I googled a solution to it and searched for about 10 days but could not find it. I limited my registration to USD. Do you know the solution? I use the ipay.lk payment gateway in Sri Lanka Is this a commercial module ? 0 Quote Link to comment Share on other sites More sharing options...
Anu Posted May 3, 2022 Author Share Posted May 3, 2022 2 minutes ago, pRieStaKos said: Is this a commercial module ? The module was created by one of our team 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted May 3, 2022 Share Posted May 3, 2022 (edited) 26 minutes ago, Anu said: The module was created by one of our team Ok. Then you can use convertCurrency() to change the amount before pushing it to your gateway. $userCurrency = getCurrency($invoice->clientId); $paymentCurrencyID = WHMCS\Database\Capsule::table("tblcurrencies")->where("code", "LKR")->value("id"); $total = convertCurrency($invoice->total, $userCurrency["id"], $paymentCurrencyID); Edited May 3, 2022 by pRieStaKos 0 Quote Link to comment Share on other sites More sharing options...
Anu Posted May 3, 2022 Author Share Posted May 3, 2022 46 minutes ago, pRieStaKos said: Ok. Then you can use convertCurrency() to change the amount before pushing it to your gateway. $userCurrency = getCurrency($invoice->clientId); $paymentCurrencyID = WHMCS\Database\Capsule::table("tblcurrencies")->where("code", "LKR")->value("id"); $total = convertCurrency($invoice->total, $userCurrency["id"], $paymentCurrencyID); Did you mean, this? I have chosen it as LKR and then this problem of theirs comes up 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted May 3, 2022 Share Posted May 3, 2022 So this is not working as expected. 0 Quote Link to comment Share on other sites More sharing options...
Anu Posted May 4, 2022 Author Share Posted May 4, 2022 (edited) 23 hours ago, pRieStaKos said: So this is not working as expected. I found my problem. The callback currency comes from LKR which is why I have this problem. Is there a way to convert callback currency to USD? Like a code Edited May 4, 2022 by Anu 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted May 4, 2022 Share Posted May 4, 2022 9 minutes ago, Anu said: I found my problem. The callback currency comes from LKR which is why I have this problem. Is there a way to convert callback currency to USD? Like a code Same function, different currency id 0 Quote Link to comment Share on other sites More sharing options...
cloudmastertechnologies Posted April 25, 2024 Share Posted April 25, 2024 first of all, you can use these 2 Url as guide: https://classdocs.whmcs.com/8.8/WHMCS/Billing/Currency.html https://github.com/WHMCS/sample-gateway-module/blob/master/modules/gateways/callback/gatewaymodule.php in main PHP page you can add this in function gatewaymodule_link($params) global $currency; $currencyCode = $params['currency']; $currencyUSD = '840'; $postfields['currency'] = $currencyUSD; $curRate = $currency["rate"]; if($currencyCode !== 'USD'){ $postfields['amount'] = number_format(floatval($params['amount'] / $curRate), 2, '.', '' ); $postfields['amountCurrency'] = $params['amount']; } else { $postfields['amount'] = $params['amount']; } in Callback PHP page you can use this before function addInvoicePayment $paymentCurrency = $_POST["currency"]; if($paymentCurrency !== 'USD'){ $paymentAmount = $_POST["amountCurrency"]; } else { $paymentAmount = $_POST["amount"]; } 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.