Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,777,893 members, 6,619,197 topics. Date: Monday, 06 December 2021 at 04:25 PM

Connecting Your Form To Interswitch Webpay - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Connecting Your Form To Interswitch Webpay (3568 Views)

Integrating Interswitch's Webpay With Joomla's Virtuemart(shopping Cart) / How Do I Obtain Interswitch Webpay / How Is The Interswitch Webpay Doing ? (2) (3) (4)

(1) (2) (Reply) (Go Down)

Connecting Your Form To Interswitch Webpay by 5hyguy: 7:48am On Nov 03, 2013
Hello is there anyone who has successfully connected a web application form to interswitch webpay gateway, thanks
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 8:11am On Nov 03, 2013
Yes. Have they assigned you test paramters? What programming language are you using?
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 8:18am On Nov 03, 2013
Na I haven't been assigned any test parameters, I work for a company, and a client wants dat func on her web, I have seen the demo tutorials on interswitch website, but that isn't enough for me, 1) how does one combine the values of the fields and convert them to sha format automatically, I hope u get wat am saying
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 8:11am On Nov 05, 2013
What do you mean by 'sha format automatically'? Please explain further.
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 1:17pm On Nov 05, 2013
Ok u knw wat, let's leave dat, I want to learn the procedure from u, what and what am I supposed to to be able to do to connect my form to the interswitch gateway
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 4:05pm On Nov 05, 2013
1. You create your form which an applicant or user is to submit through your site

2. Ensure that the cost of the form is displayed on a 'confirmation' page which the applicant or user is to click on to trigger the payment process

3. Create a payment script which will derive its variables from the 'confirmation' page to send to the Interswitch Gateway in the format expected and post to the URL

<form name="form1" action="https://stageserv.interswitchng.com/test_paydirect/pay"
method="post">
<input name="product_id" type="hidden" value="XX" />
<input name="pay_item_id" type="hidden" value="XX" />
<input name="amount" type="hidden" value="XXXXXXX" />
<input name="currency" type="hidden" value="566" />
<input name="site_redirect_url" type="hidden" value="http://abc.com /getresponse”/>
<input name="txn_ref" type="hidden" value=" XXXAFTXXX”" />
<input name="hash" type="hidden" value="BB292DF9268F05CB9CBBC5E0C13CC1B13ACA34DC" />
</form>

4. The Hash you need to compute using SHA512 can be done from this site http://www.fileformat.info/tool/hash.htm? It is a combination of the following (I guess this is where you found difficult?)

You can also generate same in your script using the format hash('sha512', $variables_represented_by_the details_each_shown_below)
txn_ref
7645536
product_id
174
pay_item_id
23
amount
1000000
site_redirect_url
http://www.yoursite.com/return/
MAC key
AC43543FA32234HB23423AFH843535

Note that the MAC key would assigned to you by Interswitch for production. environment

The rest of the process is pretty straight forward.
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 6:29am On Nov 06, 2013
Yea clearly stated, but are there no values that are supposed to change? E.g payment I'd, its a bit confusing there, thanks ,
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 6:35am On Nov 06, 2013
Or probably am confusing my self, the variables dat are supposed to be hashed do they change per user who uses d form,or do we nid to create a form for every type of product or service u selling,
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 8:56am On Nov 06, 2013
5hyguy: Or probably am confusing my self, the variables dat are supposed to be hashed do they change per user who uses d form,or do we nid to create a form for every type of product or service u selling,

Yes the variables change for every form or every transaction carried out. For every form filled on your site, there ought to be a unique txn_ref, product_id and pay_item_id (note the txn_ref is like your receipt number, product_id maybe numbers you categorize the forms into such membership premium or membership gold etc while the pay_item_id you can use something unique).

These numbers can be randomly generated using this function mt_rand(100,9999) as maybe the case for txn_ref and pay_item_id while for the product_id you can use static numbers.

The MAC key would be assigned to you by Interswitch and is your own unique identifier with them.
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 4:28pm On Nov 06, 2013
Hmmm do u mind if I gv u a call something, I think things would be really clear please, thanks
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 11:04am On Nov 07, 2013
5hyguy: Hmmm do u mind if I gv u a call something, I think things would be really clear please, thanks

Ok. One question ..must you integrate with Interswitch? Why not go for one which is cost free and is an aggregator? Buzz me when you can.
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 11:30am On Nov 07, 2013
Its not compulsory its interswitch, is there an alternative? Hw straight forward is d implementation, like I luv paypals integration that uses simple javascript, I wanted to call u, but felt ul b @ work, so I can call nytym right
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 2:53pm On Nov 07, 2013
5hyguy: Its not compulsory its interswitch, is there an alternative? Hw straight forward is d implementation, like I luv paypals integration that uses simple javascript, I wanted to call u, but felt ul b @ work, so I can call nytym right

There's Pay4me and this is a sample script to send payment request to their gateway

<?php

//NOTE: This is assigned to merchants by Pay4me for use on the Demo Environment
$merchant_id = ;

$item_num = mt_rand(1000,9999);
//$trans_num = mt_rand(1000,99999999999);
$sch = mt_rand(100,9999);
//NOTE: This is assigned to merchants by Pay4me for use on the Demo Environment
$merchant_code = "";

//NOTE: This is assigned to merchants by Pay4me for use on the Demo Environment
$merchant_key = "";

$item_id = $_POST['item_id'];

$name = $_POST['item_name'];

$item_description = $_POST['item_description'];

$price = $_POST['amount'];

send_payment_request($merchant_id, $item_id, $item_num, $price, $item_description, $name, $merchant_code, $merchant_key, $sch);

function send_payment_request($merchant_id, $item_id, $item_num, $price, $item_description, $name, $merchant_code, $merchant_key, $sch)

{

$request = '<?xml version="1.0" encoding="UTF-8"?>

<order xmlns="http://www.pay4me.com/schema/pay4meorder/v1">

<merchant-service id="'.$merchant_id.'">

<item number="'.$item_num.'">

<transaction-number>9876543210</transaction-number>

<name>'.$name.'</name>

<description>'.$item_description.'</description>

<price>'.$price.'</price>

<currency>naira</currency>

<parameters>

<parameter name="ref_no">'.$sch.'</parameter>

</parameters>

</item>

</merchant-service>

</order>';

$header[] = "Authorization: Basic ".base64_encode($merchant_code.":".$merchant_key);

$header[] = "Content-Type: application/xml;charset=UTF-8";

$header[] = "Accept: application/xml;charset=UTF-8 ";

$url = "http://pay4me.demo.swgindia.com/order/payment/payprocess/v1/PID/".$merchant_code; //Demo Environment URL

//$url = "https://www.pay4me.com/order/payment/payprocess/v1/PID/".$merchant_code; // Production Environment URL

$ch = curl_init(); //initialize curl handle
// enable below 2 linesfor https sites
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_URL, $url); //set the url

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); //return as a variable

//curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_POST, 1); //set POST method

curl_setopt($ch, CURLOPT_POSTFIELDS, $request); //set the POST variables

curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);

$response = curl_exec($ch); //run the whole process and return the response

curl_close($ch); //close the curl handle

$xdoc = new DOMDocument();

$isLoaded = $xdoc->loadXML($response);

$rurl = $xdoc->getElementsByTagName('redirect-url')->item(0)->nodeValue ;

header("Location: $rurl"wink;

}

?>
They offer the Interswitch Verve and Master Card Naira as well as VISA Card Processing. The Bank option is also available for payment processing and of course their eWallet system which enables bulk payment transactions without having to put in card details each time. You can explore them for a change.
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 4:05pm On Nov 07, 2013
Aiite
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 4:12pm On Nov 07, 2013
Aiite, so I just nid to add an action attri to my form and call dis particular snippet in a page
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 5:07pm On Nov 07, 2013
5hyguy: Aiite, so I just nid to add an action attri to my form and call dis particular snippet in a page

Sure. You need to be assigned with a Merchant ID (326), Merchant Code (1551060007) and Merchant Key (1466509421) try this and see if you can get a redirect to the gateway. If you succeed then u're done and need to contact them at info@pay4me.com for necessary production setup details
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 6:50pm On Nov 07, 2013
Ok, I called ur line dis evening, didn't pickup, guess u were busy, ama try it out n see,
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 4:33am On Nov 08, 2013
nice one, very flexible and easy to use, the only thing is the page that has to be printed as a proof of payment cant be customized, it always has to be their page. unlike if you were intergrating directly with interswtich, you could easily specify what page it redirects to after payment. do you get
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 5:26am On Nov 08, 2013
5hyguy: nice one, very flexible and easy to use, the only thing is the page that has to be printed as a proof of payment cant be customized, it always has to be their page. unlike if you were intergrating directly with interswtich, you could easily specify what page it redirects to after payment. do you get

Yes you specify a page to redirect to after payment by the applicant. When a payment is successful, the applicant sees a button which when clicked redirects him/her to the page the site owner wants them to be redirected to for example a customized thank you page, confirmation page or receipt page.
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 6:42am On Nov 08, 2013
In the code you gave to me thrs no where to specify that, or whr am I supposed to specify that?
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 6:48am On Nov 08, 2013
5hyguy: In the code you gave to me thrs no where to specify that, or whr am I supposed to specify that?

Sorry about the call drop. The page you want the applicant to go to after payment is stated and given to Pay4me during setup. They configure all that for you.

If you can, send me your application's Response Notification URL (where the platform posts successful transactions on your portal to) as well as the URL you want your applicants redirected to on successful payment I will get them change my demo settings to yours.
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 6:49am On Nov 08, 2013
Thanks a lot, ran out of credit, what I was saying is, after payment, can I specify the kind of page the user is redirected to(customized), so as to print the invoice or receipt as the case may be, thanks
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 6:55am On Nov 08, 2013
Ok, perfect, ill signup for it, I suppose u work with them right?
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 9:30am On Nov 08, 2013
5hyguy: Ok, perfect, ill signup for it, I suppose u work with them right?

Great.
Re: Connecting Your Form To Interswitch Webpay by 53cur3m0d3(m): 1:08am On Nov 09, 2013
Just 2 people on dis thread and bigtt76 cud help work dis out! Wow! I love the way she helped handle things. Great work Captains

1 Like

Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 6:48am On Nov 09, 2013
Yea that's maturity and having the knowledge to give others
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 5:10pm On Nov 22, 2013
hi, is it possible to add other fields to the form, and post them to the payment gateway. e.g address of the person, or its just item_num, item name, price etc, cause iv tried it and i get an exception. "Trying to get property of non-object" thanks
Re: Connecting Your Form To Interswitch Webpay by bigtt76(f): 5:58pm On Nov 22, 2013
5hyguy: hi, is it possible to add other fields to the form, and post them to the payment gateway. e.g address of the person, or its just item_num, item name, price etc, cause iv tried it and i get an exception. "Trying to get property of non-object" thanks

Yes you can using the validation rules (Parameters) but it has to be configured during the setup at the payment gateway end.
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 6:10pm On Nov 22, 2013
alright, no wonder i was getting that exception, thanks
Re: Connecting Your Form To Interswitch Webpay by Successguilders: 8:42pm On Nov 22, 2013
bigtt76:

There's Pay4me and this is a sample script to send payment request to their gateway

<?php

//NOTE: This is assigned to merchants by Pay4me for use on the Demo Environment
$merchant_id = ;

$item_num = mt_rand(1000,9999);
//$trans_num = mt_rand(1000,99999999999);
$sch = mt_rand(100,9999);
//NOTE: This is assigned to merchants by Pay4me for use on the Demo Environment
$merchant_code = "";

//NOTE: This is assigned to merchants by Pay4me for use on the Demo Environment
$merchant_key = "";

$item_id = $_POST['item_id'];

$name = $_POST['item_name'];

$item_description = $_POST['item_description'];

$price = $_POST['amount'];

send_payment_request($merchant_id, $item_id, $item_num, $price, $item_description, $name, $merchant_code, $merchant_key, $sch);

function send_payment_request($merchant_id, $item_id, $item_num, $price, $item_description, $name, $merchant_code, $merchant_key, $sch)

{

$request = '<?xml version="1.0" encoding="UTF-8"?>

<order xmlns="http://www.pay4me.com/schema/pay4meorder/v1">

<merchant-service id="'.$merchant_id.'">

<item number="'.$item_num.'">

<transaction-number>9876543210</transaction-number>

<name>'.$name.'</name>

<description>'.$item_description.'</description>

<price>'.$price.'</price>

<currency>naira</currency>

<parameters>

<parameter name="ref_no">'.$sch.'</parameter>

</parameters>

</item>

</merchant-service>

</order>';

$header[] = "Authorization: Basic ".base64_encode($merchant_code.":".$merchant_key);

$header[] = "Content-Type: application/xml;charset=UTF-8";

$header[] = "Accept: application/xml;charset=UTF-8 ";

$url = "http://pay4me.demo.swgindia.com/order/payment/payprocess/v1/PID/".$merchant_code; //Demo Environment URL

//$url = "https://www.pay4me.com/order/payment/payprocess/v1/PID/".$merchant_code; // Production Environment URL

$ch = curl_init(); //initialize curl handle
// enable below 2 linesfor https sites
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_URL, $url); //set the url

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); //return as a variable

//curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_POST, 1); //set POST method

curl_setopt($ch, CURLOPT_POSTFIELDS, $request); //set the POST variables

curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);

$response = curl_exec($ch); //run the whole process and return the response

curl_close($ch); //close the curl handle

$xdoc = new DOMDocument();

$isLoaded = $xdoc->loadXML($response);

$rurl = $xdoc->getElementsByTagName('redirect-url')->item(0)->nodeValue ;

header("Location: $rurl"wink;

}

?>
They offer the Interswitch Verve and Master Card Naira as well as VISA Card Processing. The Bank option is also available for payment processing and of course their eWallet system which enables bulk payment transactions without having to put in card details each time. You can explore them for a change.
really i am iterested in kjowing more do they accept visa, verve and other online cards. Thanks, i just developed an ecommerce wbsite and am looking for a good less expensive, relable payment gateway
Re: Connecting Your Form To Interswitch Webpay by 5hyguy: 5:46am On Nov 23, 2013
Yea from the explanation given, it accepts visa, verve cards, u can try putting up the demo code and see how it works
Re: Connecting Your Form To Interswitch Webpay by Successguilders: 3:12pm On Nov 23, 2013
5hyguy: Yea from the explanation given, it accepts visa, verve cards, u can try putting up the demo code and see how it works
ok is yours working?

(1) (2) (Reply)

Online Store Plugin For Wordpress / How Do I Start Accepting Credit Card Payments On My Site? / Dhtml Datagrid Control :: Jquery Integration :: Cms Support

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2021 Oluwaseun Osewa. All rights reserved. See How To Advertise. 165
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.