Forums

Realex and Chrono Forms

ciaran 17 Oct, 2011
Hi,
I was wondering if you could possibly help me. I am currently using Chrono forms with realex and I have followed the forum posts here
http://www.chronoengine.com/forums.html?cont=posts&f=2&t=22205
which is what i am trying to achieve.
My first form collects all the necessary personal information, name age, email etc....
I have OnSubmit Redirect url action and the target url (http://mysite.com/index.php/2nd-form)redirects the user to a second form. Just below that in the Params/Fields map box I have the following code

<?php
$amount = JRequest::getString('20', '', 'get');
$orderid = JRequest::getString('2100188402', '', 'get');
/**


that adds the amount and the unique order id to the Redirect URL.

Under that I have a Redirect User action that redirects the user. Target url is http://mysite.com/index.php/2nd-form

In the second form i have 8 hidden box actions including Merchant ID, Oder ID etc..
in Events I have a custom code action with the following code;
<?php
$amount = JRequest::getString('20', '', 'get');
$orderid = JRequest::getString('2100188402', '', 'get');
$secret = 'mysharedsecrethere';
$merchantid = 'mymerchantidhere';
$timestamp = strftime("%Y%m%d%H%M%S");
mt_srand((double)microtime()*1000000);
$curr = "EUR";
/**
Below is the code for creating the digital signature using the MD5 algorithm provided
by PHP. you can use the SHA1 algorithm alternatively.
*/
$md5hash = md5($timestamp.$merchantid.$orderid.$amount.$curr);
$md5hash = md5($md5hash.$secret);
?>
<input type=hidden name="MERCHANT_ID" value="<?php echo $merchantid; ?>" />
<input type=hidden name="ORDER_ID" value="<?php echo $orderid; ?>" />
<input type=hidden name="CURRENCY" value="<?php echo $curr; ?>" />
<input type=hidden name="AMOUNT" value="<?php echo $amount; ?>" />
<input type=hidden name="TIMESTAMP" value="<?php echo $timestamp; ?>
"


And under that a redirect user action with the target url set to https://epage.payandshop.com/epage.cgi.

I get the following error when I try to redirect to it;

Please contact the merchant whose goods or services you are purchasing and give the error message below.

Error 508
Invalid data in MERCHANT_ID field.



I would be very grateful if you could help me with this.

All the best,
C
GreyHead 17 Oct, 2011
Hi Ciaran,

You seem to have a mess here.

First question is: Are you sure that you can submit to Realex using a URL i.e. with a GET transaction? The answerw ill be in the Realex documents.

First problem is that you can't put code into the ReDirect URL action Params/Fields map box. It only takes single line entries with form name=value

While you can pass between forms in a URL it's usually simpler to do it using the 'Data to Session' and 'Session to Data' actions.

I'm unclear about how the second form works and what it is supposed to do? If you are using the ReDirect URL to pass the information then that needs to be in the On Submit event and the URL needs to be built.

On the other hand if you are passing the information by submitting the form to RealEx using POST to send the data then you need to set he OnSubmit URL (and not use the ReDirect URL).

Lastly, I can see that you calculate the MD5 hash but I can't see that you then do anything with it? Presumably it needs to be sent to Realex.

Bob

PS Please don't post the same message through every available channel. Post once in the forums and then bump here - or send a nudge by PM or email.
This topic is locked and no more replies can be posted.