Payment Gateway Integration
Learn a simple way to integrate the eCheck payment gateway on your website. This guild offers full details of PHP and HTML code needed to get your ACH processing started on your website. Disclaimer – We strongly Recommend you to code the integration files yourself or take help of a qualified developer. we take no Guaranty about the security aspect of the Following code and Integration Instructions, It should never be Coincided accurate. This integration guide is only for reference.
As a Proud Partner with Theecheck Payment Gateway. We are happy to share our sample code that may help many Merchants integrate Echeck payment gateway on the business website.
To integrate theecheck payment gateway by using the below-mentioned method on your website you need these prerequisites
- Must have a Registered Echeck Payment Gateway Account you can apply here to get one.
- Should Have an approved website that supports SSL
- Preferably Cpanel based server
- A basic knowledge of Html and Php coding
How to integrate theecheck payment gateway on your website.
Its very simple now. All you have to do is modify and upload these 2 files on your web server. A 1st file is an HTML form. The purpose of this form is to collect the billing information that includes
- First Name
- Last Name
- Billing Address as it appears on the bank account of the customer
- Email and Phone
- Amount to be charged for the service
The second file is a processing file. This will capture data from the form and post it on the URL of theecheck transaction server.
Time To Code
Step One – let’s Code the Form Page
This will form front end will look like this
Here is the code. Copy it in HTML and save the form on the web server as Paybyecheck.html
Make sure you change the URL in the form. Replace yourdomain.com with relevant URL
You also need to code the processing file now. Don’t worry we have made it very easy for you here you go
<? //create array of data to be posted $post_data[‘security_key’] = ‘XXXXXXXXXXXXXXXX’; // Insert your security key here $post_data[‘purchaser_firstname’] = $_REQUEST[‘fname’]; $post_data[‘purchaser_lastname’] = $_REQUEST[‘lname’]; $post_data[‘purchaser_address’] = $_REQUEST[‘address’]; $post_data[‘purchaser_city’] = $_REQUEST[‘city’]; $post_data[‘purchaser_state’] = $_REQUEST[‘state’]; $post_data[‘purchaser_zipcode’] = $_REQUEST[‘zip’]; $post_data[‘purchaser_country’] = $_REQUEST[‘country’]; $post_data[‘purchaser_phone’] = $_REQUEST[‘phone’]; $post_data[‘purchaser_email’] = $_REQUEST[’email’]; $post_data[‘purchaser_ip’] = $_SERVER[“REMOTE_ADDR”]; $post_data[‘purchaser_account’] = $_REQUEST[‘paccount’]; // The test account number is 000000 $post_data[‘purchaser_routing’] = $_REQUEST[‘prouting’]; // The test routing number is 011000015 $post_data[‘transaction_amount’] = $_REQUEST[‘amount’]; //$post_data[‘purchaser_routing’] = “123456789”; // Invalid test routing number $outbound[“debugging’] = “1”;//test purpose only //traverse array and prepare data for posting foreach ( $post_data as $key => $value) {$post_items[] = $key . ‘=’ . $value;}
//create the final string to be posted using implode()
$post_string = implode (‘&’, $post_items);
//create cURL connection
$curl_connection = curl_init(‘API URLi.php’); // Required URL for API communication
//https://
//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)”);
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); // Must be set to recieve transaction or errorcurl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
//set data to be posted
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
//perform our request
$result = curl_exec($curl_connection); // Catches the result from the request into a variable
echo “Transaction Result: ” . $result . ”“;
//show information regarding the request
print_r(curl_getinfo($curl_connection)); // Useful during testing to see information regarding the CURL request
echo curl_errno($curl_connection) . ‘-‘ . curl_error($curl_connection); // Useful during testing to identify if a given error is//close the connection
curl_close($curl_connection);?>
Make sure you name this file as theecheck_status.php also change the vale XXXXXXXXXXXXXXXXX to the API secure key
Add the API URL that you got from theecheck
Make sure you put both the files on the root of the website.
Congratulations now you should be able to accept echeck payments.
Happy processing.