LoRz

Monday, February 9, 2009

 

Integrate Virtual Merchant in PHP



Virtual Merchant gateway is used by NOVA Systems / Costco Merchant Services.

Developer Guide
User Guide

<?php

$submit_data = array(
'ssl_merchant_id' =>'000091',
'ssl_user_id' => '000091',
'ssl_pin' => '1234',
'ssl_test_mode'=>'false',
'ssl_amount' => '0',
'ssl_salestax'=>'0',
'ssl_card_number' => '5341897790221515',
'ssl_exp_date' => '1210',
'ssl_avs_zip' => 'zip',
'ssl_avs_address' => 'address',
'ssl_transaction_type' => 'ccsale',
'ssl_show_form' => 'false',
'ssl_cvv2cvc2_indicator' => '1',
'ssl_cvv2cvc2' => '1234',
'ssl_receipt_link_method' => 'GET',
'ssl_result_format' => 'ASCII',
'ssl_receipt_link_url' => $_SERVER['PHP_SELF']
);


$url = 'https://www.myvirtualmerchant.com/VirtualMerchant/process.do';
//$url = 'https://demo.myvirtualmerchant.com/VirtualMerchantDemo/process.do';

while (list($key, $value) = each($submit_data)) {
$postdata .= $key .'='. urlencode(ereg_replace(',', '', $value)) .'&';
}

$postdata = substr($postdata, 0, -1);

$refer = $_SERVER["HTTP_REFERER"];

$ch = curl_init();
curl_setopt($ch, CURLOPT_REFERER, $refer);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_NOPROGRESS, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,0);
$authorize = curl_exec($ch);

if ($error = curl_error($ch)) {
print_r($error);
}
curl_close($ch);

$authorize = trim($authorize);
$authorize = str_replace("\r", "", $authorize);
$authorize = str_replace("\n", "&", $authorize);

// Put the results into an associative array.
parse_str($authorize, $response);

print_r($response);

?>





<< Home

Archives

June 2008   July 2008   August 2008   September 2008   October 2008   November 2008   December 2008   January 2009   February 2009   March 2009   May 2009   July 2009   September 2009   October 2009   WEC 44 live stream   UFC 106 live stream

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]