Creating A New Payment Gateway

Send your contacts details then.

Hi eComLabs,



I found the solution and I was able to fix it. The sample code is down below and can be used by developers in Nigeria who would intend to integrate Nigerian payment gateway into their cs cart framework.




```php

/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Session;
use Tygh\Registry;
ini_set("display_errors", "off");
$transactionref = $_GET['TransactionReference'];
$orderid = $_GET['OrderID'];
//Setting payment notification but Emeka says it is not doing anything
if (defined('PAYMENT_NOTIFICATION')) {
if ($mode == 'notify') {
fn_order_placement_routines('route', $_REQUEST['OrderID']);
}

exit;
}
//checking for response from the payment gateway
if (!empty($transactionref) && !empty($orderid)) {
require_once("../../lib/webservice.php");
$getTrn = new CIPGWebServiceCall();
// xxxxxx is the merchantID
$getTrn->GetTransactionStatusTest($orderid,"xxxxx",true);
if(!isset($getTrn->Exception) && !isset($getTrn->Error))
{
if(isset($getTrn->ErrorCode) && isset($getTrn->Description))
{
//No Transaction record found or merchant doesnt exist
$errorVar = $getTrn->ErrorCode;
$descVar = $getTrn->Description;
}else{
//there was no crash when calling the webservice "all is well"
$responsecode = $getTrn->ResponseCode;
}
}
if($responsecode=='00') {

// if the response is successful
require './init_payment.php';
fn_payments_set_company_id($orderid);
$pp_response = array();
$pp_response['reason_text'] = '';
$pp_response['transaction_id'] = $transactionref;

// set order status here (whatever you want)
$pp_response['order_status'] = "Y";
// call the finish payment built in function
fn_finish_payment($orderid, $pp_response);

//clearing the cart
$_SESSION[cart] = array();

//redirect to successful page after successful transaction

fn_redirect(Registry::get('config.http_location') . "/index.php?dispatch=checkout.complete&order_id=" . $orderid . "");

die();

}
}
else { //send payment to gateway

$amount = $order_info["total"];
$_order_id = ($order_info['repaid']) ? ($order_id . '_' . $order_info['repaid']) : $order_id;

//Payment Gateway URL
$submit_url = 'https://xxxxx.com';
$post_data = array(
'mercID' => $processor_data['processor_params']['merchant_id'],
'currCode' => $processor_data['processor_params']['currency'],
'amt' => $order_info['total'],
'orderId' => $_order_id,
'prod' => '',
'email' => $order_info['email']
);
foreach ($order_info['products'] as $p) {
if (empty($post_data['prod'])) {
$post_data['prod'] = $p['product'];
} else {
$post_data['prod'] .= (',' . $p['product']);
}
}
//fn_print_die($post_data);
fn_create_payment_form($submit_url, $post_data, 'Payment Pay server');
exit;
}
```

Thank you for letting us know it. If you face any issues with your way of implementation, please let us know.