[ic] Hidden fields mapping

Ed LaFrance interchange-users@lists.akopia.com
Fri Jun 1 11:58:01 2001


At 08:11 PM 05/31/2001 -0400, you wrote:
>Thanks Ed for replying to my posts...
>
>I'll explain to you what is my problem:
>
>We have been accepted at www.worldpay.com for the "Select" service.
>
>Their setup is not really what I anticipated. Basically they host the CC and
>billing info and place cookies on clients site so that they dont have to
>re-enter their info again.
>
>Now, if you want, they can trigger a CGI on your site so that you actually
>know if the transaction was succesfull.
>
>So at first you send a POST containing a few hidden fields (i.e.: instId,
>cartId, amount, and other custom fields if you want) like this:
>
>(this is the GET method its just for illustration purpose)
>https://select.worldpay.com/wcc/purchase?instId=xxx&cartId=xxxx&amount=xxxx&
>currency=xxx
>
>Then, you are presented with a page containing billing info (*****if you
>passed it*****) and input fields for CC info.
>
>Problem #1
>To pass the billing info, I need to map the values to the names they need.
>Not the fields i have in my db. This is tricky as I can't change the names
>of the db and the info does not really exist yet (its being entered).
>
>Problem #2
>I need a callback that will get the status sent back by WorldPay to know if
>the orders are valid. And from there I'm completely lost...I dont even know
>where to start. I could pass the session Id and cartId and they would send a
>post on one of my pages parsed by interchange and i could even set a
>password from their admin section to make sure the response comes from them.
>
>I hope someone can at least give me some tips as very few people are able to
>help me right now.
>

J.P. -

This is a much better explanation, I think the basic principals of what you 
need are clear now.

It sounds like the process cannot be fully automated; in other words, the 
use must explicitly enter their credit card info on the Worldpay page and 
click submit?

The absolute simplest thing I can think of would be a self-submitting 
intermediate form, which comes immediately after the checkout page.  You 
would remove '&final=yes' from the checkout_profile in etc/profiles.order, 
and add &set=mv_successpage = the_form_page (substitute the name you give 
to the form page for 'the_form_page' - I would recommend putting it in the 
special_pages directory).  Obviously you would also remove the credit card 
form fields from the checkout page and all the related checks from the 
checkout_profile since Worldpay would be handling that aspect of the 
transaction.  Always reconfig (Apply Changes) after editing profiles.order.

On the_form_page you would have something like:

<html>
<head></head>
<body onLoad="worldpay.submit()">
<form name=worldpay action="https://insert.correct.domain.here/path.." 
method=post>
<input type=hidden name=worldpay_name value="[value name]">
<input type=hidden name=worldpay_addr value="[value addr]">
...
</form>
</body>
</html>

The form is submitted automatically as soon as the page loads; the user 
does not see anything unless you put a message on the page like "Please 
wait, connecting to Worldpay...".

I imagine you can send a return URL for successful (and failed) payment 
transactions.  For success, I would suggest adding an new profile to 
profiles.order:

__NAME__                worldpay_ok
&final=yes
__END__

Then you can send a return url on the_form_page like this (assuming here 
that they call it 'success_url');:

<input type=hidden name=success_url 
value="http://__SERVER_NAME____CGI_URL__/process?id=[data session 
id]&mv_todo=submit&mv_order_profile=workdpay_ok">

This will submit the order and show the receipt page upon return from 
successful payment.

Again, this is an easy way, if not the best or most secure.  But beyond 
this you are looking at writing a Perl chunk to handle it, in which case 
you could use one of the many internet-related Perl libraries to facilitate 
things.

Good Luck!

- Ed L.







===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================