Showing posts with label ogone payment. Show all posts
Showing posts with label ogone payment. Show all posts

Thursday, October 18, 2012

Ogone payment integration in php

Ogone payment simply done in two steps.

 Step 1:        
 $PSPID = 'YOURPSPID'; //'OGONETEST';
 $Price = "100"; // PAYPAL
 $passphrase = 'YOURSECRETKEY';
 $unique_id = RAND(890000,895689596);
 $pm = "CREDIT CARD";
$accept_url="http://yourreturnurl.com"; //Like IPN
$cancelurl="http://yourcancelurl.com";

//If you add any parameters in  Ogone_sha1 order by Alphabet order.
 $Ogone_sha1 =  
                        "ACCEPTURL=".$accept_url.$passphrase.
                        "AMOUNT=".$credit.$passphrase.
                         "BGCOLOR=#010000".$passphrase.
                         "CANCELURL=".$cancelurl.$passphrase.
                         "CURRENCY=EUR".$passphrase.
                         "LANGUAGE=en_us".$passphrase.
                         "ORDERID=".$unique_id.$passphrase.
                         "PM=".$pm.$passphrase.
                         "PSPID=".$PSPID.$passphrase.
                         "TITLE=Payment via Ogone".$passphrase;
//Creating the signature
   $Ogone_sha1 = sha1($Ogone_sha1);

// For test use the url in action https://secure.ogone.com/ncol/test/orderstandard.asp

 $form1 = '<form name="directpayment1" id="directpayment" action="https://secure.ogone.com/ncol/prod/orderstandard.asp" method="post" >
      <input name="PSPID" type="hidden" value="'.$PSPID.'" />
      <input name="AMOUNT" type="hidden" value="'.$credit.'" />
      <input name="ACCEPTURL" type="hidden" value="'.$accept_url.'" />
      <input name="CANCELURL" type="hidden" value="'.$cancelurl.'" />
      <input name="ORDERID" type="hidden" value="'.$unique_id.'" />
      <input name="CURRENCY" type="hidden" value="EUR" />
      <input name="LANGUAGE" type="hidden" value="en_us" />
      <input name="PM"  type="hidden" value="'.$pm.'">
      <input name="TITLE"  type="hidden" value="Payment via Ogone">
      <input name="BGCOLOR"  type="hidden" value="#010000">
      <input name="SHASIGN" type="hidden" value="'.$Ogone_sha1.'" />    
      </form><script>document.getElementById("directpayment").submit()</script>';   
      echo $form1;

Step 2:

If the ogone payment is done it calls the accept url.

$pay_status= $_REQUEST['STATUS'];
//Status 9 is success for PAYPAL and 5 is authorized for CREDIT CARD
$pay_id=$_REQUEST['PAYID'];
//Like Transaction id
$pay_types=$_REQUEST['BRAND'];
$pay_ipaddress=$_REQUEST['IP'];
$paytype =$_REQUEST['PM'];
$amount=$_REQUEST['AMOUNT'];
$invoiceNumber = $_REQUEST['ORDERID'];

Just all the values are get from request like PAYID , ORDERID , STATUS values. Thats all. simply ogone payment is implemented.
Cheers!!!!