New Zenner
- Join Date:
- Aug 2007
- Location:
- oregon
- Posts:
- 12
- Plugin Contributions:
- 0
Need help with Virtual Merchant module
apparently Virtual Merchant is the next genesis of the whole viaklix thing.
I needed to set up a connection to them, so i took the viaklix module available at http://www.modyourzencart.com/free-of-charge/payment-modules and attempted to modify it to work with Virtual Merchant.
The results have not been quite satisfactory, as i can't get it to work :)
Here's what i have so far: http://www.frozenplanet.com/bestnaturalpet.com/VirtualMerchant.zip
I've made changes for the new url and name changes of some of the payment fields. However, i don't seem to be able to get it to work. Nothing is showing up in the Virtual Merchant transaction log, but if i build an html file by hand that sends the query, it works.
wireshark shows that data is being sent to https://www.myvirtualmerchant.com on port 443, but i'm not clever enough to decipher what is being sent.
i'm assuming this has something to do with my lack of curl knowlege, as i can see that the variables are all being assigned properly.
here's part of the html that sends things properly:
<form action="https://www.myvirtualmerchant.com/VirtualMerchant/process.do" method="POST"> <input type="hidden" name="ssl_merchant_id" value="xxxxxx"> <input type="hidden" name="ssl_user_id" value="xxxxxxxx"> <input type="hidden" name="ssl_pin" value="xxxxxx"> <input type="hidden" name="ssl_transaction_type" value="ccsale"> <input type="hidden" name="ssl_card_number" value="5424000000000015"> <input type="hidden" name="ssl_exp_date" value="1008"> <input type="hidden" name="ssl_amount" value="1.55"> <input type="hidden" name="ssl_show_form" value="false"> <input type="hidden" name="ssl_cvv2" value="present"> <!--CVV2 Indicator --> <input type="hidden" name="ssl_cvv2cvc2" value="123"> <!--CVV2 Data -->that works fine.
here's the curl statement to send the data to the server. all i know about curl i learned today, but i'm not sure that it is sending the data in the proper format. here's what i think is the relevant snippet:
for ($i = 0; $i <= sizeof($post['key'])-1; $i++) {$string .= $post['key'][$i].'='.$post['value'][$i].'&';}//build post vars
$string = substr($string, 0, -1); // not needed
$ch = curl_init();//init curl options
curl_setopt ($ch, CURLOPT_URL, $this->url);
curl_setopt ($ch, CURLOPT_FRESH_CONNECT, 1); //no cache connection
curl_setopt ($ch, CURLOPT_POST, 1); //enable the post of vars
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_TIMEOUT, 8 ); // seconds to wait for timeout
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $string );//posted vars in fromat key1=value1&key2=value2&
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); //enable return response
$content = parse_response(curl_exec($ch));
anyway, sorry for the novel, but if someone can give me a hand here, i'd be happy to package this up for the next sucker who is stuck dealing with Virtual Merchant.
thanks,
d.