Helcim Logo Support & Tutorials

© Copyright 2006-2019 Helcim Inc.

All Rights Reserved.

Legacy Platforms » Converge (formerly VirtualMerchant) » Developer API »

PHP Code Sample (Converge)

Below is a PHP 5 code sample. Please note that it is for demonstration purposes only and will not work correctly until a valid account id, user id and PIN are acquired.


//extract data from the post
//set POST variables
$url = 'https://www.myvirtualmerchant.com/VirtualMerchant/process.do';
//Modify the values from xxx to your own account ID, user ID, and PIN
//Additional fields can be added as necessary to support custom fields
or required fields configured in the Virtual Merchant terminal
$fields = array(
Vi rtualMerchant Developer's Guide.docx Page 138 of 152
//modify the value below from xxx to the location of your error script
//modify the value below from xxx to the location of your receipt script
//initialize the post string variable
$fields_string = '';
//build the post string
foreach($fields as $key=>$value) { $fields_string .=$key.'='.$value.'&'; }
rtrim($fields_string, "&");
//open curl session
$ch = curl_init();
//begin seting curl options
//set URL
curl_setopt($ch, CURLOPT_URL, $url);
//set method
curl_setopt($ch, CURLOPT_POST, 1);
Vi rtualMerchant Developer's Guide.docx Page 139 of 152
//set post data string
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
//these two options are frequently necessary to avoid SSL errors with PHP
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//perform the curl post and store the result
$result = curl_exec($ch);
//close the curl session
//a nice message to prevent people from seeing a blank screen
echo "Processing, please wait..."