This is a discussion on Credit card modul integration within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Hi. I need to integrate the credit card function to my site. My bank (Garanti Bank in Turkey) sent me ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hi. I need to integrate the credit card function to my site. My bank (Garanti Bank in Turkey) sent me the file to test the credit card payment. They said that you should get the credit card informations from the form and use them like this. But I could'nt find how to use this file. Help me please. Thanks a lot. <? require('includes/application_top.php'); ?> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <? // Sanal pos XML requestine yazilacak degisken paramerteler. $name="gartest1"; //Sanal pos api kullanic adi $password="gartest1"; //Sanal pos api kullanicisi sifresi $clientid="112345678"; //Sanal pos magaza numarasi $lip=GetHostByName($REMOTE_ADDR); //Son kullanici IP adresi $email=""; //Email $oid= $_POST['oid']; //Siparis numarasy her islem icin farkli olmalidir , //bo? gonderilirse sistem bir siparis numarasi üretir. $type="Auth"; //Auth: Satış PreAuth: Ön Otorizasyon $tutar=$_POST['total']; //Kurus ayyraci olarak "." kullanylmalydyr. $cv2=$_POST['cv2']; //Kart guvenlik kodu $taksit=""; //Taksit sayisi Pe?in saty?larda bo? gonderilmelidir, "0" gecerli sayilmaz. //Provizyon alinamadigi durumda taksit sayisi degistirilirse sipari numarasininda //degistirilmesi gerekir. $mdStatus=$_POST['mdStatus']; // 3d Secure işleminin sonucu mdStatus 1,2,3,4 ise başarılı 5,6,7,8,9,0 başarısızdır // 3d Decure işleminin sonucu başarısız ise işlemi provizyona göndermeyiniz (XML göndermeyiniz). $xid=$_POST['xid']; // 3d Secure özel alani PayerTxnId $eci=$_POST['eci']; // 3d Secure özel alani PayerSecurityLevel $cavv=$_POST['cavv']; // 3d Secure özel alani PayerAuthenticationCode $md=$_POST['md']; // Eğer 3D işlembaşarılısya provizyona kart numarası yerine md değeri gönderilir. // Son kullanma tarihi ve cvv2 gönderilmez. // XML request sablonu $request= "DATA=<?xml version=\"1.0\" encoding=\"ISO-8859-9\"?> <CC5Request> <Name>{NAME}</Name> <Password>{PASSWORD}</Password> <ClientId>{CLIENTID}</ClientId> <IPAddress>{IP}</IPAddress> <Email>{EMAIL}</Email> <Mode>P</Mode> <OrderId>{OID}</OrderId> <GroupId></GroupId> <TransId></TransId> <UserId></UserId> <Type>{TYPE}</Type> <Number>{MD}</Number> <Expires></Expires> <Cvv2Val></Cvv2Val> <Total>{TUTAR}</Total> <Currency>949</Currency> <Taksit>{TAKSIT}</Taksit> <PayerTxnId>{XID}</PayerTxnId> <PayerSecurityLevel>{ECI}</PayerSecurityLevel> <PayerAuthenticationCode>{CAVV}</PayerAuthenticationCode> <CardholderPresentCode>13</CardholderPresentCode> <BillTo> <Name></Name> <Street1></Street1> <Street2></Street2> <Street3></Street3> <City></City> <StateProv></StateProv> <PostalCode></PostalCode> <Country></Country> <Company></Company> <TelVoice></TelVoice> </BillTo> <ShipTo> <Name></Name> <Street1></Street1> <Street2></Street2> <Street3></Street3> <City></City> <StateProv></StateProv> <PostalCode></PostalCode> <Country></Country> </ShipTo> <Extra></Extra> </CC5Request> "; //De?i?ken parametrelerin XML sablona yazilmasi $request=str_replace("{NAME}",$name,$request); $request=str_replace("{PASSWORD}",$password,$reque st); $request=str_replace("{CLIENTID}",$clientid,$reque st); $request=str_replace("{IP}",$lip,$request); $request=str_replace("{OID}",$oid,$request); $request=str_replace("{TYPE}",$type,$request); $request=str_replace("{XID}",$xid,$request); $request=str_replace("{ECI}",$eci,$request); $request=str_replace("{CAVV}",$cavv,$request); $request=str_replace("{MD}",$md,$request); $request=str_replace("{TUTAR}",$tutar,$request); $request=str_replace("{TAKSIT}",$taksit,$request); // Sanal pos adresine baglanti kurulmasi // Test icin $url = "https://cc5test.est.com.tr/servlet/cc5ApiServer" // Üretim ortami için $url = "https://ccpos.garanti.com.tr/servlet/cc5ApiServer" $url = "https://cc5test.est.com.tr/servlet/cc5ApiServer"; //TEST $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 90); // times out after 90s curl_setopt($ch, CURLOPT_POSTFIELDS, $request); // add POST fields // Buraya mdStatusa göre bir kontrol koymalisiniz. // 3d Secure işleminin sonucu mdStatus 1,2,3,4 ise başarılı 5,6,7,8,9,0 başarısızdır // 3d Decure işleminin sonucu başarısız ise işlemi provizyona göndermeyiniz (XML göndermeyiniz). $result = curl_exec($ch); // run the whole process if (curl_errno($ch)) { print curl_error($ch); } else { curl_close($ch); } $Response =""; $OrderId =""; $AuthCode =""; $ProcReturnCode =""; $ErrMsg =""; $HOSTMSG =""; $response_tag="Response"; $posf = strpos ( $result, ("<" . $response_tag . ">") ); $posl = strpos ( $result, ("</" . $response_tag . ">") ) ; $posf = $posf+ strlen($response_tag) +2 ; $Response = substr ( $result, $posf, $posl - $posf) ; $response_tag="OrderId"; $posf = strpos ( $result, ("<" . $response_tag . ">") ); $posl = strpos ( $result, ("</" . $response_tag . ">") ) ; $posf = $posf+ strlen($response_tag) +2 ; $OrderId = substr ( $result, $posf , $posl - $posf ) ; $response_tag="AuthCode"; $posf = strpos ( $result, "<" . $response_tag . ">" ); $posl = strpos ( $result, "</" . $response_tag . ">" ) ; $posf = $posf+ strlen($response_tag) +2 ; $AuthCode = substr ( $result, $posf , $posl - $posf ) ; $response_tag="ProcReturnCode"; $posf = strpos ( $result, "<" . $response_tag . ">" ); $posl = strpos ( $result, "</" . $response_tag . ">" ) ; $posf = $posf+ strlen($response_tag) +2 ; $ProcReturnCode = substr ( $result, $posf , $posl - $posf ) ; $response_tag="ErrMsg"; $posf = strpos ( $result, "<" . $response_tag . ">" ); $posl = strpos ( $result, "</" . $response_tag . ">" ) ; $posf = $posf+ strlen($response_tag) +2 ; $ErrMsg = substr ( $result, $posf , $posl - $posf ) ; echo $Response; echo $OrderId; echo $AuthCode; echo $ProcReturnCode; echo $ErrMsg; if ( $Response === "Approved") { echo ' <table border="0" width="100%" align="center" cellspacing="0" cellpadding="0"> <tr> <td width="25%" rowspan="2" align="center"> <a href="' . tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL') . '">' . '<img src="images/siparis/karttamam.jpg" width="500" height="300" border="0"><br> Ödeme bilgileriniz onaylanmıştır.Devam etmek için lütfen tıklayın'. '</a></td> </tr></table>' . "\n"; } else { echo ' <table border="0" width="100%" align="center" cellspacing="0" cellpadding="0"> <tr> <td width="25%" rowspan="2" align="center"> <a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '">' . '<img src="images/siparis/karthata.jpg" width="500" height="300" border="0"><br> Ödeme bilgileriniz onaylanmamıştır.Tekrar denemek için lütfen tıklayın'. '</a></td> </tr></table>' . "\n"; } ?> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Credit Card with CVV2 | michael_s | New osCommerce Contributions | 0 | 08-13-2007 08:32 PM |
| Credit Card with CVV2 | michael_s | New osCommerce Contributions | 0 | 05-03-2007 01:10 AM |
| Credit card module | clauska | osCMax v2 Customization/Mods | 0 | 06-15-2006 06:42 AM |
| 8 digits credit card | altenter | osCMax v1.7 Discussion | 9 | 08-20-2004 07:07 AM |
| credit card transactions | alisonpurcell | osCommerce 2.2 Installation Help | 1 | 04-07-2003 09:43 AM |