nitation Posted September 11, 2008 Share Posted September 11, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/ Share on other sites More sharing options...
Maq Posted September 11, 2008 Share Posted September 11, 2008 There has to be more code or some kind of API because that only provides the format for each part of the CC process... Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639179 Share on other sites More sharing options...
nitation Posted September 11, 2008 Author Share Posted September 11, 2008 Let me attach the file given to us. See below [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639187 Share on other sites More sharing options...
BlueSkyIS Posted September 11, 2008 Share Posted September 11, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639201 Share on other sites More sharing options...
Maq Posted September 11, 2008 Share Posted September 11, 2008 They even give you a test info to make sure you set it up correctly (Page 6). Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639203 Share on other sites More sharing options...
nitation Posted September 11, 2008 Author Share Posted September 11, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639231 Share on other sites More sharing options...
BlueSkyIS Posted September 11, 2008 Share Posted September 11, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639247 Share on other sites More sharing options...
nitation Posted September 11, 2008 Author Share Posted September 11, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639259 Share on other sites More sharing options...
nitation Posted September 12, 2008 Author Share Posted September 12, 2008 Am still stucked. Any ideas?? Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639565 Share on other sites More sharing options...
nitation Posted September 12, 2008 Author Share Posted September 12, 2008 Help to fix my problem. Its getting me off. Someone there to assist? Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639624 Share on other sites More sharing options...
nitation Posted September 12, 2008 Author Share Posted September 12, 2008 do i need to include the xml transaction structure in the html form or what? Anyone to post a possible solution!!! Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639635 Share on other sites More sharing options...
aschk Posted September 12, 2008 Share Posted September 12, 2008 OMG it's "getting you off".... 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 Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639647 Share on other sites More sharing options...
nitation Posted September 12, 2008 Author Share Posted September 12, 2008 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639779 Share on other sites More sharing options...
nitation Posted September 12, 2008 Author Share Posted September 12, 2008 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>"; Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639836 Share on other sites More sharing options...
cunoodle2 Posted September 12, 2008 Share Posted September 12, 2008 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".... Help to fix my problem. Its getting me off. Someone there to assist? Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639869 Share on other sites More sharing options...
nitation Posted September 12, 2008 Author Share Posted September 12, 2008 What is the essence of your post. Render help to post is the only thing needed. Regards Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-639872 Share on other sites More sharing options...
nitation Posted September 12, 2008 Author Share Posted September 12, 2008 Any assistance would help. Please refer to my last 2 posts. Quote Link to comment https://forums.phpfreaks.com/topic/123793-credit-card-processing-help/#findComment-640126 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.