Jump to content

Error adding Auto money to account at the end of a payment


Recommended Posts

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

12.png.4ab21ce257867056ecbf4032572c2a44.png

Below is the Gateway Transaction Log

Gateway-Transaction-Log.thumb.png.873b92d47cf4332d1b702e515631ab5e.png

Help us fix this

Thanks everyone
 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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 by pRieStaKos
Link to comment
Share on other sites

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?

WHMCS-Payment-Gateways.thumb.png.595872c2a6eb904d2a043b57a3412a1d.png

I have chosen it as LKR and then this problem of theirs comes up

Link to comment
Share on other sites

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 by Anu
Link to comment
Share on other sites

  • 1 year later...
 
first of all, you can use these 2 Url as guide:
 
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"];
    }
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated