This is another PHP payment gateway integration tutorial, Here I will discuss about integration of EBS (E-Billing Solutions) with PHP.EBS is most popular and widely used payment method for online e-commerce.You can do payment using via fable card, debit cards and Net banking using EBS. The EBS support various bank to allow payment using Net Banking.

This tutorial explained easy steps to integrate EBS payment gateway with PHP.

How to Integrate EBS system

You can easily integrate EBS with merchant website without any deep language knowledge, to integrate EBS payment gateway into your website, you need to have an EBS account, after the successfully registered, they will provide you EBS account id and EBS Key to perform transaction from merchant to EBS. In this tutorial, I have explained easy steps to integrate EBS payment gateway with PHP.

You can check other recommended tutorial of Payment Gateway,

EBS Payment Gateway Integration tutorial have following file structure,

index.php : This file will have HTML form with submit button.
decrypt.php : This file will use to decrypt EBS payment response.
response.php : This file will use to show payment information after decrypt by decrypt.php file.

We will create EBS payment HTML form, We will add some input fields and attached action URL with in Form tag.

Its just for testing. Your transaction will not be billed yet!

We will also adding user information into this form file, to display into response.php file.

After the successfully submitted and payment Done, The EBS returned the response in encrypted form, So we will need to decrypt that EBS payment response.
We will add some code to decrypt response into decrypt.php file, This file will have method to decrypt response.

setKey($key);
}
}
function setKey($key) {
if (strlen($key) > 0)
$this->_key = $key;
}
function key(&$key) {
$len= strlen($key);
for ($this->i = 0; $this->i < 256; $this->i++) {
$this->s[$this->i] = $this->i;
}
$this->j = 0;
for ($this->i = 0; $this->i < 256; $this->i++) {
$this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
$t = $this->s[$this->i];
$this->s[$this->i] = $this->s[$this->j];
$this->s[$this->j] = $t;
}
$this->i = $this->j = 0;
}
function crypt(&$paramstr) {
$this->key($this->_key);
$len= strlen($paramstr);
for ($c= 0; $c < $len; $c++) { $this->i = ($this->i + 1) % 256;
$this->j = ($this->j + $this->s[$this->i]) % 256;
$t = $this->s[$this->i];
$this->s[$this->i] = $this->s[$this->j];
$this->s[$this->j] = $t;
$t = ($this->s[$this->i] + $this->s[$this->j]) % 256;
$paramstr[$c] = chr(ord($paramstr[$c]) ^ $this->s[$t]);
}
}
function decrypt(&$paramstr) {
$this->crypt($paramstr);
}
}
?>

Now, We will create response file that will show conformation payment information, payment failed information.You can check success/failed payment using EBS payment Response code.

decrypt($QueryString);
$QueryString = explode('&',$QueryString);
$response = array();
foreach($QueryString as $param){
$param = explode('=',$param);
$response[$param[0]] = urldecode($param[1]);
}
// check for payment success
if(($response['ResponseCode'] == 0)) {
foreach( $response as $key => $value) {
echo $key;
echo $value;
}
}
// check for payment failed
if(($response['ResponseCode'] != 0)) {
foreach( $response as $key => $value) {
echo $key;
echo $value;
}
}
}
?>

Genislab Technologies

NexGeneration complete end-2-end software testing & modern development operations tooling & solutions

Do you want to discuss your testing requirements with us? please don’t hesitate to hit the contact us button below, and we will get back to you at our earliest..