Call Us : +1-678-551-2452
+91 77381-86899

Integrate Bank Of Baroda Payment Gateway (BOB E-Gateway) In WooCommerce

You can include Bank Of Baroda Payment Gateway in a WooCommerce Application provided you have purchased Bank of Baroda Payment Gateway and have the Integration Kit which consists of SFA Folder, .Key File and a bunch of .php Files such as TestSSl.php, SFAResponse.php etc.

Below are the steps to integrate Payment Gateway of Bank & Baroda (BOB E-Gateway ) in WooCommerce (Popular E-Commerce Plugin Of WordPress)

1. Download WooCommerce Custom Payment Gateway Plugin From the link below:
https://wordpress.org/plugins/woocommerce-custom-payment-gateways/

2. Activate the plugin and do the settings for Title, Description and Instructions from Dashboard–>Woocommerce–>Settings–>Checkout–>Custom Payment Gateways 1  (See below screenshot)

3. Go to Website/wp-content/plugins/woocommerce-custom-payment-gateways and add the folder SFA & files TestSSL.php , SFAREsponse.php and the .Key file provided in the Bank Of Baroda Integration Kit (See below screenshot)

4. Edit the file Website/wp-content/plugins/woocommerce-custom-payment-gateways/class-wc-custom_payment_gateway_1.php  and find the method process_payment and add the below code within it (See the code and screenshot)

/* Process the payment and return the result. */
function process_payment ($order_id) {
global $woocommerce;
$order = new WC_Order( $order_id );

//added by developer

include(“Sfa/BillToAddress.php”);
include(“Sfa/CardInfo.php”);
include(“Sfa/Merchant.php”);
include(“Sfa/MPIData.php”);
include(“Sfa/ShipToAddress.php”);
include(“Sfa/PGResponse.php”);
include(“Sfa/PostLibPHP.php”);
include(“Sfa/PGReserveData.php”);

$oMPI = new MPIData();
$oCI = new CardInfo();
$oPostLibphp = new PostLibPHP();
$oMerchant = new Merchant();
$oBTA = new BillToAddress();
$oSTA = new ShipToAddress();
$oPGResp = new PGResponse();
$oPGReserveData = new PGReserveData();

//BOBKEY In below code is Bank Of Baroda Key which is the name of the key file provided by BOB. If your file name is 0023456.Key, then key is 0023456

//Below path which is bold font has to be the proper path of SFAResponse.php file within the plugin woocommerce-custom-payment-gateways

$oMerchant-setMerchantDetails(“BOBKEY”,”BOBKEY“,”BOBKEY“,”193.545.34.33″,rand().””,”Ord123″,”Website/wp-content/plugins/woocommerce-custom-payment-gateways/SFAResponse.php“,”POST”,”INR”,”INV123″,”req.Sale”,$order->get_total(),””,”Ext1″,”true”,”Ext3″,”Ext4″,”Ext5″);

$oBTA->setAddressDetails (“CID”,$order->billing_first_name,$order->billing_address_1,$order->billing_address_2,$order->billing_first_name,$order->billing_city,$order->billing_state,$order->billing_postcode,”IND”,$order->billing_email);

$oSTA->setAddressDetails ($order->shipping_address_1,$order->shipping_address_2,”Add3″,$order->shipping_city,$order->shipping_state,$order->shipping_postcode,”IND”,$order->shipping_email);

#$oMPI->setMPIRequestDetails(“100″,”1.00″,”356″,”2″,”2 shirts”,””,””,””,”0″,””,”image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*”,”Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)”);
$oMPI->setMPIRequestDetails(“100″,$order->get_total(),”356″,”2″,”2 shirts”,””,””,””,”0″,””,”image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*”,”Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)”);

$oPGReserveData->setReserveObj($order_id,$order->billing_first_name,$order->billing_last_name,$order->billing_phone,$order->billing_email,$order->order_key,”7″,”8″,”9″,”10″);

$oPGResp=$oPostLibphp->postSSL($oBTA,$oSTA,$oMerchant,$oMPI,$oPGReserveData);

if($oPGResp->getRespCode() == ‘000’){
$url = $oPGResp->getRedirectionUrl();
if(headers_sent()) {
$order->update_status(‘processing’, __( ‘Your order wont be shipped until the funds have cleared in our account.’, ‘woocommerce’ ));

//$order->payment_complete();

// Reduce stock levels
$order->reduce_order_stock();

// Remove cart
$woocommerce->cart->empty_cart();
?>
<html><head>
<script language=”javascript” type=”text/javascript”>

window.self.location='<?php print($url);?>';

</script>
</head></html>
<?php
exit;

} else {

header(“Location: “.$url);
exit;

}

}
else{

print “Error Occured.<br>”;
print “Error Code:”.$oPGResp->getRespCode().”<br>”;
print “Error Message:”.$oPGResp->getRespMessage().”<br>”;

}
}//end of process payment function

4. Edit the file: Website/wp-content/plugins/woocommerce-custom-payment-gateways/SFResponse.php and set first two parameters as per below code (See screenshot)

$strMerchantId=” 0023456“;
$astrFileName=”http://website path /00024364.key”;

5. Edit the file Website/wp-content/plugins/woocommerce-custom-payment-gateways/SFResponse.php and add below code at the end of it (To come back from SFAREsponse.php page to Order Received page at our site.)

<?php if ($ResponseCode!=null){?>

<?php if ($ResponseCode==0){?>
<script type=”text/javascript”>

window.location.href= “http://uns.techeasesystems.in/checkout/order-received/<?php echo trim($Reserve1); ?>/?key=<?php echo trim($Reserve6); ?>&EPGTXNID=<?php echo trim($TxnID); ?>” ;

</script>
<?php } else { echo “Some Error Occured :”. $Message; }?>
<?php } else { echo “Can Not Access, No Transaction happened”; }?>

 

6.Now you can see the Bank Of Baroda Payment Gateway option on the Checkout page as per below screenshot:

Leave a Reply

Pay with PayPal

Icon Web Solutions Service
Other Amount:
Name:

Testimonials

It has been a great pleasure working with Icon Web Solutions on the development of my digitized logo and website. From the initial phases of web design, the Icon Web Solutions team has been a pleasure to work with
Naren, USA

REQUEST A QUOTE

Request A Quote

Please fill the form to request a quote from us

Name (required)

Email (required)

Phone

Services
 Website Design & Development Logo Design SEO SMO Payment Gateway Integration Others

Any Other Detail

Input Text Shown in Image
captcha