I made my own payment gateway and used this for currency conversion but I have a problem, the amount remains the same after the conversion
For example product price is 5$ with usd currency and 4€ for euro currency
and in callback i posted 5$ and currency=USD but my account is using euro currency
and the result is 5 not 4 please give me solution and thanks ♥
<?php
require_once __DIR__ . '/../../../init.php';
require_once __DIR__ . '/../../../includes/gatewayfunctions.php';
require_once __DIR__ . '/../../../includes/invoicefunctions.php';
$gatewayModuleName = basename(__FILE__, '.php');
$gatewayParams = getGatewayVariables($gatewayModuleName);
$paymentAmount=5.00;
$invoiceId=1;
$invoice = WHMCS\Billing\Invoice::find($invoiceId);
$userCurrency = getCurrency($invoice->clientId);
if ($userCurrency["code"] != "EUR") {
$paymentCurrencyID = WHMCS\Database\Capsule::table("tblcurrencies")->where("code", "EUR")->value("id");
if (is_null($paymentCurrencyID)) {
logTransaction($gatewayParams['name'], $_POST, "Unsuccessful - Invalid Currency");
exit;
}
$paymentAmount = convertCurrency($paymentAmount, $paymentCurrencyID, $userCurrency["id"]); //Here the result is the same amount sent
}
?>