Solved

Interswitch Connection

Posted on 2014-01-28
2
305 Views
Last Modified: 2014-03-19
Dear Experts, Am a newbie to integrating website to payment gateways. Please help with necessary guide.

1. The payment gateway would send my server an HTTP request in the format provided below:
(See Page1.Txt)

My server is to reply with xml format provided in Page2.Txt

Can anyone please help with a code.

I saw this code on the net but could not make much out of it

$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
      $keyval = explode ('=', $keyval);
      if (count($keyval) == 2)
            $myPost[$keyval[0]] = urldecode($keyval[1]);
}
Page1.txt
Page2.txt
0
Comment
Question by:ukconcepts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39816010
In PHP, XML processing is usually done with the SimpleXML class.  Get rid of that code you found on the net - it's either useless or flatly wrong.  Please contact the payment gateway and ask them what request method they use to send the XML.  It's probably POST, but we want to verify that before you go too far.

I'll try to show you how to use SimpleXML to parse Page1.txt
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39816028
Please see http://www.laprbass.com/RAY_temp_ukconcepts.php

Look at the HEREDOC definition very carefully.  What was posted in Page1.txt is not valid XML.  Several changes were necessary to even get it to create an object!

<?php // RAY_temp_ukconcepts.php
error_reporting(E_ALLL);
echo '<pre>';

$xml = <<<EOD
<?xml version="1.0" encoding="utf-8" ?>
<CustomerInformationRequest>
<MerchantReference>126</MerchantReference>
<CustReference>0123</CustReference>
<PaymentItemCategoryCode>628051043</PaymentItemCategoryCode>
<PaymentItemCode>6280510431000</PaymentItemCode>
<RequestReference>0000000001</RequestReference>
<TerminalId>31WP0001</TerminalId>
<Amount>31WP0001</Amount>
<ServiceUsername></ServiceUsername>
<ServicePassword></ServicePassword>
<FtpUsername></FtpUsername>
<FtpPassword></FtpPassword>
</CustomerInformationRequest>
EOD;

$obj = SimpleXML_Load_String($xml);
var_dump($obj);

Open in new window

How experienced are you with PHP and object-oriented programming?
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn about the eCommerce marketing trends for the year ahead.
Original post  on Monitis Blog. Web performance monitoring is broken into two camps: passive and active. Passive monitoring is defined as looking at real-world historical performance by monitoring actual log-ins, site hits, clicks, requests for…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question