Error al valdiar firma

197 views
Skip to first unread message

Juan Carlos Sánchez Pulido

unread,
Sep 10, 2014, 2:41:29 PM9/10/14
to desarrollador...@googlegroups.com
Alguien sabe como solucionar el error de RefInvalido ? tengo este codigo de prueba

la cadena antes de aplicarle md5 6u39nqhq8ftd0hlvnjfs66eh8c~500238~XSECRETS01~40~MXN
con md5 = 191d734f5fb9c5c040aba1189fe13782

el coddigo es este 

<?php 
$ApiLogin = '11959c415b33d0c';
$ApiKey = '6u39nqhq8ftd0hlvnjfs66eh8c';
$merchantId = '500238';
$accountId = '500547';
$referenceCode = 'XSECRETS01';
$amount = 40;
$currency = "MXN";
//“ApiKey~merchantId~referenceCode~amount~currency”.
$string =  $ApiKey.$merchantId.'~'.$referenceCode.'~'.$amount.'~'.$currency;

$signature = md5($string);

?>
 <form method="post" action="<?php echo $url; ?>">
  <input name="merchantId"    type="hidden"  value="<?php echo $merchantId; ?>"   >
  <input name="accountId"     type="hidden"  value="<?php echo $accountId; ?>" >
  <input name="description"   type="hidden"  value="Test Xsecrets"  >
  <input name="referenceCode" type="hidden"  value="<?php echo $referenceCode; ?>" >
  <input name="amount"        type="hidden"  value="<?php echo $amount; ?>"   >
  <input name="tax"           type="hidden"  value="0"  >
  <input name="taxReturnBase" type="hidden"  value="0" >
  <input name="currency"      type="hidden"  value="<?php echo $currency; ?>" >
  <input name="signature"     type="hidden"  value="<?php echo $signature; ?>"  >
  <input name="buyerEmail"    type="hidden"  value="juan....@gmil.com" >
  <input name="responseUrl"    type="hidden"  value="xsecrets.mx/payul/response.php" >
  <input name="confirmationUrl"    type="hidden"  value="xsecrets.mx/payul/confirmation.php" >
  <input name="Submit"        type="submit"  value="Enviar" >
</form>

al hacer clcik en pagar ya en el portal de payu es dodne me dice que el Rerence Cod eno fue validado porque esta mal el signature

Alguna idea?

daniel medina

unread,
Sep 29, 2014, 6:26:39 PM9/29/14
to desarrollador...@googlegroups.com
al parecer tienes un error al generar la Firma:
$string =  $ApiKey.$merchantId.'~'.$referenceCode.'~'.$amount.'~'.$currency;
Prueba:
$string =  $ApiKey.'~'.$merchantId.'~'.$referenceCode.'~'.$amount.'~'.$currency;
falto concatenar '~' despues de $ApiKey
Reply all
Reply to author
Forward
0 new messages