Intesa Nestpay payment gateway - problem integration (wrong security code)

Hello!
It is necessary to integrate this payment system “Intesa Nestpay payment gateway” but does not pass authentication.
Everything I looked nice, put all the necessary parameters, but still getting error “Wrong security code”.

Plain text for HASH code I created on this way:

$orgClientId  =   "111111";
$orgOid =    "3939393";
$storeK="xxxx";
$orgAmount = "500.00";
$orgOkUrl =  "http://www.xxxxx.com/ok.php";
$orgFailUrl = "http://www.xxxxx.com/fail.php";
$orgTransactionType = "Auth";
$orgInstallment = "";
$orgRnd =  microtime();
$orgRnd=str_replace(" ","",$orgRnd);

$orgCurrency = "978";
$instalment='';
$clientId  =  str_replace("|", "\\|", str_replace("\\", "\\\\", $orgClientId));
$oid =   str_replace("|", "\\|", str_replace("\\", "\\\\", $orgOid));
$amount = str_replace("|", "\\|", str_replace("\\", "\\\\", $orgAmount));
$okUrl =  str_replace("|", "\\|", str_replace("\\", "\\\\", $orgOkUrl));
$failUrl = str_replace("|", "\\|", str_replace("\\", "\\\\", $orgFailUrl));
$transactionType = str_replace("|", "\\|", str_replace("\\", "\\\\", $orgTransactionType));
$installment = str_replace("|", "\\|", str_replace("\\", "\\\\", $orgInstallment));
$rnd = str_replace("|", "\\|", str_replace("\\", "\\\\", $orgRnd));
$currency =   str_replace("|", "\\|", str_replace("\\", "\\\\", $orgCurrency));
$storeKey =  str_replace("|", "\\|", str_replace("\\", "\\\\", $storeK));

$plainText = $clientId . "|" . $oid . "|" . $amount . "|" . $okUrl . "|" . $failUrl . "|" .$transactionType . "|" . $rnd . "||||" . $currency . "|" . $storeKey;

Hash code I create on this way:

$hashValue = hash('sha512', $plainText);
$hash = base64_encode (pack('H*',$hashValue));

All these values I must send with POST method to a specific link using html form:

<form method="post" action="https://specific link">
        <input type="submit" value="Complete Payment" />
        <input type="hidden" name="clientid" value="<?php echo $orgClientId ?>">
        <input type="hidden" name="ammount" value="<?php echo $orgAmount ?>">
        <input type="hidden" name="oid" value="<?php echo $orgOid ?>">
        <input type="hidden" name="okUrl" value="<?php echo $orgOkUrl ?>">
        <input type="hidden" name="failUrl" value="<?php echo $orgFailUrl ?>">
        <input type="hidden" name="trantype" value="<?php echo $orgTransactionType ?>">
        <input type="hidden" name="currency" value="<?php echo $orgCurrency ?>">
        <input type="hidden" name="rnd" value="<?php echo $orgRnd ?>">
        <input type="hidden" name="hash" value="<?php echo $hash ?>">
        <input type="hidden" name="storetype" value="3d_pay_hosting">
        <input type="hidden" name="hashAlgorithm" value="ver2">
        <input type="hidden" name="lang" value="en">
       
  </form>

Everything looks OK, but I always get error

Array
(
    [clientid] => 111111
    [oid] => 3939393
    [mdStatus] => 7
    [mdErrorMsg] => Wrong security code
    [ErrMsg] => Wrong security code
    [Response] => Error
    [ProcReturnCode] => 99
    [hashAlgorithm] => ver2  
    [currency] => 978
    [storetype] => 3d_pay_hosting
    ...
    ...

Is anyone doing this integration?
Does anyone have any idea where I’m wrong?

Are you absolutely sure about the spelling of the form field name on this line?

<input type="hidden" name="ammount" value="<?php echo $orgAmount ?>">
                            ^ here

It would seem a poor error message if that’s actually the problem.

Can the payment gateway tech support not give any clues as to what is wrong?

1 Like

Hello!
Thank you for your answer!
Yes, I fixed this error “ammount” => “amount” but still exists error “Wrong security code”.
Support, of the support I have not received any clear answer.
They told me to check out all the variables, I did it, but to me it all looks OK

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.