Jump to content

Recommended Posts

Good day,

 

My company want to accept credit card on our website. They contacted a third-party company for the back-end processing and the company provided us with the code attached below.

 

A Transaction Authorisation Request should be formatted as follows in order for the transaction to be
processed successfully:
<enMobileAPI>
<AuthorisationRequest msisdn="1831119911" pin="1200">
<Amount>500.50</Amount>
<CardPresent>false</CardPresent>
<Track2>xxxx</Track2>
<CardNumber>5221000000000002</CardNumber>
<ExpiryDate>MMYY</ExpiryDate>
<Cv2>175</Cv2>
<ReconReference>6645321</ReconReference>
<BudgetPeriod>00</BudgetPeriod>
<Reference>Test Reference</Reference>*
<ClientTel>0116468216</ClientTel>*
<ManualAuthorisationCode>123456</ManualAuthorisationCode>*
<AutomaticSettlement>true</AutomaticSettlement>
<3dSecureCavv>123654982</3dSecureCavv>*
<3dSecureECI>02</3dSecureECI>*
<3dSecureXID>8908098098098</3dSecureXID>*
</AuthorisationRequest>
</enMobileAPI>

My question is, how do i use the code provided in PHP/MYSQL. Do i need an interface and some php scripts or its strictly XML. Kindly help.

 

Regards

Link to comment
https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/
Share on other sites

they apparently want you to post to their server, then parse the response XML. from page 5:

 

Server to Server URL

 

The URL to which the above data must be posted is

 

https://www.vwire.co.za/vapp/XML-Landing2.jsp

 

The data must be URL-encoded and must be passed as the contents of the parameter

xmlData. Ensure that the xmlData parameter name is not URL-encoded. 

 

I am in a middle of a dark channel. Please help me out. I believe this is how the form should look like. Do i need to do anything else?

 

<form name="cardone" action="https%3A%2F%2Fwww.vwire.co.za%2Fvapp%2FXML-Landing2.jsp" method="post">
<table width="490" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="25" height="35"> </td>
    <td width="114"> </td>
    <td width="20"> </td>
    <td width="15"> </td>
    <td width="148"> </td>
    <td width="45"> </td>
    <td width="123"> </td>
  </tr>
  <tr>
    <td height="31"> </td>
    <td valign="top">Card Number </td>
    <td> </td>
    <td colspan="3" valign="top"><label>
      <input name="CardNumber" type="text" id="CardNumber" />
    </label></td>
    <td> </td>
  </tr>
  <tr>
    <td height="24"> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td height="28"> </td>
    <td valign="top">Expiry date </td>
    <td> </td>
    <td colspan="3" valign="top"><input name="month" type="text" id="month" size="5" maxlength="2" />  <input name="year" type="text" id="year" size="5" maxlength="2" /></td>
    <td> </td>
  </tr>
  <tr>
    <td height="26"> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td height="31"> </td>
    <td valign="top">CVV</td>
    <td> </td>
    <td colspan="3" valign="top"><input name="cvv" type="text" id="cvv" size="8" maxlength="5" /></td>
    <td> </td>
  </tr>
  <tr>
    <td height="20"></td>
    <td></td>
    <td></td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td></td>
  </tr>
  <tr>
    <td height="28"></td>
    <td></td>
    <td></td>
    <td></td>
    <td valign="top">
<input name="submit" type="submit" value="Process">
<!--DWLayoutEmptyCell--> </td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="16"></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
</table>
</form>

i think that you will want to use the curl functions to post to the server and retrieve the xml response. then parse the xml response to get any success or error message(s) to determine whether the transaction was a success. it's not going to be as easy as simply creating a form. here is a link to the curl function manual pages: http://us3.php.net/curl

OMG it's "getting you off"....  :o

 

Help to fix my problem. Its getting me off. Someone there to assist?

 

As previously suggested, you need to build a form that posts to YOUR server. In YOUR php you need to build an XML string (like the one they sent you), and you then need to send it from YOUR server to THEIR server (either using streams or cURL). Therefore I recommend you do as BlueSkyIS suggested and do some reading on cURL ;)

I keep getting this error when trying to use stream to communicate with the third party processing server.

 


Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/moagihc/public_html/css/test.php on line 6

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://vwire.co.za/vapp/XML-Landing2.jsp:443 (Unknown error) in /home/moagihc/public_html/css/test.php on line 6
(100) 

.

The below is my code

 

<?php
/* Send POST request to https://www.vwire.co.za/vapp/XML-Landing2.jsp
* Include form elements named "foo" and "bar" with dummy values
*/

$sock = fsockopen("ssl://vwire.co.za/vapp/XML-Landing2.jsp", 443, $errno, $errstr, 30);
if (!$sock) die("$errstr ($errno)\n");

$data = "foo=" . urlencode("Value for Foo") . "&bar=" . urlencode("Value for Bar");

fwrite($sock, "POST /XML-Landing2.jsp HTTP/1.0\r\n");
fwrite($sock, "Host: https://www.vwire.co.za/vapp/XML-Landing2.jsp\r\n");
fwrite($sock, "Content-type: application/x-www-form-urlencoded\r\n");
fwrite($sock, "Content-length: " . strlen($data) . "\r\n");
fwrite($sock, "Accept: */*\r\n");
fwrite($sock, "\r\n");
fwrite($sock, "$data\r\n");
fwrite($sock, "\r\n");

$headers = "";
while ($str = trim(fgets($sock, 4096)))
$headers .= "$str\n";

echo "\n";

$body = "";
while (!feof($sock))
$body .= fgets($sock, 4096);

fclose($sock);
?>

This is what i came up with.

 

String msisdn = "27820001234";

String pin = "1234";

String amount = "100.00";

String cardPresent = "0";

String cardNumber = "4242424242424242";

String expiry = "1109";

String cvc = "123";

String reconReference = "recon ref";

String budgetPeriod = "00";

String reference = "test";

String clientTel = "27820001234";

String isTxManuallyAuthed = "0";

String autoSettle = "1";

String isThreeDSecure = "0";

String algorithm = "1";

String checksum = "12821821AAFEDD328328238923D2389329BBC";



String xml = "<OnlineLinQ>" +

    "<TxRequest>" +

        "<Msisdn>" + msisdn + "</Msisdn>" +

        "<PIN>" + pin + "</PIN>" +

        "<Amount>" + amount + "</Amount>" +

        "<CardEntry>" +

            "<CardPresent>" + cardPresent + "</CardPresent>" +

            "<Track2></Track2>" +

        "</CardEntry>" +

        "<CardNumber>" + cardNumber + "</CardNumber>" +

        "<ExpiryDate>" + expiry + "</ExpiryDate>" +

        "<CVC>" + cvc + "</CVC>" +

        "<ReconReference>" + reconReference + "</ReconReference>" +

        "<BudgetPeriod>" + budgetPeriod + "</BudgetPeriod>" +

        "<Reference>" + reference + "</Reference>" +

        "<ClientTel>" + clientTel + "</ClientTel>" +

        "<ManualAuth>" +

            "<IsTxManuallyAuthed>" + isTxManuallyAuthed + "</IsTxManuallyAuthed>" +

            "<ManualAuthCode></ManualAuthCode>" +

        "</ManualAuth>" +

        "<AutomaticSettlement>" + autoSettle + "</AutomaticSettlement>" +

        "<ThreeDSecure>" +

            "<IsThreeDSecured>" + isThreeDSecure + "</IsThreeDSecured>" +

            "<CAVV></CAVV>" +

            "<ECI></ECI>" +

            "<XID></XID>" +

        "</ThreeDSecure>" +

        "<Security>" +

            "<Algorithm>" + algorithm + "</Algorithm>" +

            "<Checksum>" + checksum + "</Checksum>" +

        "</Security>" +

    "</TxRequest>" +

"</OnlineLinQ>";

May you please write for me what to start with and i will improve on your code. This is the first time am doing something like this. Please bear with me.
This could be the quote of the year on the boards here.  Well either that or this one here...

 

OMG it's "getting you off"....  :o

Help to fix my problem. Its getting me off. Someone there to assist?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.