I have a question about the process of the payment using a gateway emerchant. I have to provide all the variables to the gateway and get the answer if the charge was made. I can make the charge if all the data is correct, but i don't know how to receive the answer from the gateway, the manual give me a clue, the answer will provide in the variable "urlBack". Do you know how to get data from this gateway?
First I process all date in javascript then I send the information using the following code, but the answer I will receive in another page (https://acmax.mx/popup_2). All works very well but I have problems with the answer from the gateway.
Thank so much
<form name="myPayTC" id="myPayTC" method="post" action="https://www.procom.prosa.com.mx/eMerchant/7727222_acmaxdemexico.jsp" onload='javascript:MyFrmOnLoad();'>
<input type="hidden" id="total" name="total" value='total'>
<input type="hidden" id="currency" name="currency" value="484">
<input type="hidden" id="address" name="address" value="ACMAX">
<input type="hidden" id="order_id" name="order_id" value='order_id'>
<input type="hidden" id="merchant" name="merchant" value="7727222">
<input type="hidden" id="store" name="store" value="1234">
<input type="hidden" id="term" name="term" value="001">
<input type="hidden" id="digest" name="digest" value='valDigest'>
<input type="hidden" id="return_target" name="return_target" value="N/A">
<!--<input type="hidden" id="urlBack" name="urlBack" value="https://acmax.mx/index.php?controller=ComercioResp">-->
<!--<input type="hidden" id="urlBack" name="urlBack" value="https://acmax.mx/es/checkout/confirm">-->
<input type="hidden" id="urlBack" name="urlBack" value="https://acmax.mx/popup_2">
<!--<input type="hidden" id="urlBack" name="urlBack" value="http://acmax.mx/es/checkout/paymentmethod">-->
<p><img src="https://acmax.mx/themes/theme674/img//bankwire.jpg" alt="Pago por tarjeta de crédito/débito" width="86" height="54" /> <input type="submit" name="pButton" value="Pago con Tarjeta de Crédito/Débito" class="exclusive" style="font-size:14px; height:28px;"></p>
</form>
The code that has the server is the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML version="-//W3C//DTD HTML 4.01 Transitional//EN">
<HEAD>
<TITLE>Verificacion de Compra</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
</HEAD>
<BODY>
<form id="formars" name="formars" action="https://acmax.mx/popup_2" method="post">
<input type="Hidden" name="EM_Response" value="denied">
<input type="Hidden" name="EM_Total" value="102">
<input type="Hidden" name="EM_OrderID" value="625">
<input type="Hidden" name="EM_Merchant" value="7727222">
<input type="Hidden" name="EM_Store" value="1234">
<input type="Hidden" name="EM_Term" value="001">
<input type="Hidden" name="EM_RefNum" value="initialrefnum">
<input type="Hidden" name="EM_Auth" value="000000">
<input type="Hidden" name="EM_Digest" value="initialdigest">
<input type="Hidden" name="cc_number" value="0565">
<input type="Hidden" name="total" value="102">
<input type="Hidden" name="order_id" value="625">
<input type="Hidden" name="merchant" value="7727222">
<input type="Hidden" name="tx_id" value="322307f91ef2b5318e5d720f49fb30dace2ca474">
<input name="pButton" value="Pago con Tarjeta de Crédito/Débito" type="Hidden" />
<input name="address" value="ACMAX" type="Hidden" />
</form>
<script type="text/javascript">
var formars = document.getElementById('formars');
formars.submit();
</script>
</BODY>
</HTML>
I can't change this code, so I need to get the data from the form "formars"
Well, for example, if you have set the urlBack
parameter to some php page, let's call it returnCall.php
.
Now, if the payment gateway is sending back the following 'post' data:
name1=cat&name2=dog&name3=echidna
Then in your php page, you can read that data as follows:
<?php
$value1 = $_POST["name1"];
$value2 = $_POST["name2"];
$value3 = $_POST["name3"];
?>
<p>
<ul>
<li>Value1 = <?=$value1?></li>
<li>Value2 = <?=$value2?></li>
<li>Value3 = <?=$value3?></li>
</ul>
</p>
Then the output on the page would translate to:
<p>
<ul>
<li>Value1 = cat</li>
<li>Value2 = dog</li>
<li>Value3 = echidna</li>
</ul>
</p>
You could similarly have an aspx page that could do the same thing.
string Value1;
string Value2;
string Value3;
protected void Page_Load(object sender, EventArgs e)
{
Value1 = Request.Form["name1"];
Value2 = Request.Form["name2"];
Value3 = Request.Form["name3"];
}