Page 1 of 1

Ogone payment service provider

Posted: Mon Jun 04, 2007 2:57 pm
by paulus4605
Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Dear since I'm a newbe in php coding I would like to ask you some help on the following problem
I have this form which is correctly sending data to Ogone, my Question is how do I retrieve the reply once I got a payment confirmation?
and what is the code to achieve this

this is my form

Code: Select all

<?php
/*
 * Created on 5-mei-2007
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 
// Associatieve array voor de betaalmethodes
// om te voorkomen dat de array moet worden geconverteerd en gesorteerd,
// staan de betaalmethodes als HTML in alfabetische volgorde:
$payment = array (
			   "CC"		=> "Creditcard",
			   "Dexia"	=> "DEXIA NetBanking",
			   "Direct" => "Direct Debits NL",
			   "Ideal"	=> "Ideal",
			   "ING"	=> "ING Homepay",
			   "kbc"	=> "KBC Online",
			   );

$currency = array (
					"AUD"	=>	"Australische Dollar",
					"CAD"	=>	"Canadese Dollar",
					"CHF"	=>	"Zwitserse frank",
					"CNY"	=>	"Yuan Renminbi",
					"CZK"	=>	"Tsjechische Kroon",
					"DKK"	=>	"Deense kroon",
					"EEK"	=>	"Estonia Kroon",
					"EUR"	=>	"EURO",
					"GBP"	=>	"Britse Pond",
					"HKD"	=>	"Hong Kong Dollar",
					"HRK"	=>	"Croatian Kuna",
					"HUF"	=>	"Hongaarse Forint",
					"ILS"	=>	"New Shekel",
					"ISK"	=>	"Iceland Krona",
					"JPY"	=>	"Japanse Yen",
					"MAD"	=>	"Moroccan Dirham",
					"NZD"	=>	"Nieuw Zeelandse Dollar",
					"PLN"	=>	"Poolse Zloty",
					"RUR"	=>	"Rouble",
					);

function is_Set($var){
    if(isset($var) && !empty($var) && strlen($var) > 0 && ctype_print($var)){
        return true;
    }
    else{
        return false;
    }
}

if($_SERVER['REQUEST_METHOD'] == 'POST'){
    $Validated = NULL;
    $Err = array();
  
//    if(is_Set($_POST['ct'])){            
//        $currencytype     = $_POST['ct'];
//    }
//    else{
//        $Err[]= "currency type";
//    }
    if(is_Set($_POST['pt'])){  
        $paymenttype    =  $_POST['pt'];
    }
    else{
         $Err[]= "payment type";
    }
    if(is_Set($_POST['n'])){
        $naam            =  $_POST['n'];
    }
    else{
         $Err[]= "naam";
    }   
    if (is_Set($_POST['orderid'])){ 
        $OrderId        =  $_POST['orderid'];
    }
    else{
         $Err[]= "orderId";
    }
    if (is_Set($_POST['amount'])){ 
        $amount            =  $_POST['amount'];
    }
    else{
         $Err[]= "amount";
    }       
    if (is_Set($_POST['pt'])){  
        $currency            =  $_POST['currency'];
    }
    else{
         $Err[]= "currency";
    }
    if (is_Set($_POST['ShaSign'])){
        
		$ShaSign        =  $_POST['ShaSign'];
    }
    else{
         $Err[]= "ShaSign";
    }
	//vaste waarden 
	$pspid ="myuserid";
	$pswd="myshapswd";
	//berekening van sha1	
    $ShaSign= sha1($OrderId.$amount.$currency.$pspid.$pswd);
   
    if(count($Err) == 0){ // Err array is leeg
        //geen backticks in Queries!
        $orderSql  = "SELECT OrderId
                        FROM Payment
                        WHERE OrderId = '". mysql_real_escape_string($OrderId)."'";
                       
        $insertSql = "INSERT INTO payments (   
                                                paymentid,
                                                 OrderId,
                                                amount,
                                                naam,
                                                ShaSign,
                                                payment,
                                                currency
                                            ) 
                                    VALUES (
                                                '".$paymentid."',
                                                '".$OrderId."',
                                                '".$amount."',
                                                '".$ShaSign."',
                                                '".$payment."',
                                                '".$naam."',
                                                '".$currency."'
                                            )";
        //uitvoeren:
        mysql_query($orderSql) or die("order SQL error: ".mysql_error());
        mysql_query($insertSql) or die("insert SQL error: ".mysql_error());                                                   
    }
    else{  // Err array is NIET leeg
        echo "De volgende velden zijn NIET ingevuld!!!<br/>\n\r";
        echo implode(", ", $Err)."<br/>\n\r";
    }
}
define("SEND_PAGE", "https://secure.ogone.com/ncol/test/orderstandard.asp");

?> 
<?php include_once('header.txt'); ?>
<form method="post" action="https://secure.ogone.com/ncol/test/orderstandard.asp" id="form1" name="form1" >

	<fieldset>
	<legend>paymentform</legend>
	
	<table >
	
		<tr>
			<td>
				<label for="n">
				<span style="text-decoration: underline">N</span>aam:</label>
			</td>
			<td>
				<input 
				 accesskey ="n" 
				 name="n"
				 id="n" 
				 type="text"/>
			</td>
		</tr>

		<tr>
			<td>
				<label for="orderid">
				<span style="text-decoration: underline">O</span>rderId:</label>
				
			</td>
			<td>
				<input 
					 accesskey="orderid"
					 name="orderid" 
					 id="orderid" 
					 type="text"/>
			</td>
		</tr>	
		<tr>
			<td>
				<label for="currency">
				<span style="text-decoration: underline">C</span>urrency:</label>
				
			</td>
			<td>
				<select 
					 accesskey="currency"
					 name="currency" 
					 id="currency" 
<?php
foreach ($currency as $currencycode => $currencyname) {
		echo "<option ";
    if ($currencycode == $currencyname) {
        echo "selected ";
    }
    echo "value=\"".$currencycode."\">".$currencyname."</option>\n";
}
    
?>
				</select>					 
			</td>
		</tr>
				<tr>
			<td>
				<label for="amount">
				<span style="text-decoration: underline">A</span>mount:</label>
				
			</td>
			<td>
				<input 
					 accesskey="amount"
					 name="amount" 
					 id="amount 
					 type="text"
					 value=""/>
			</td>
		</tr>				
			<tr>
			<td>
				<label for="SHASign">
				<span style="text-decoration: underline">S</span>haSign:</label>
				
			</td>
			<td>
			
				<input 
					 accesskey="SHASign"
					 name="SHASign" 
					 id="SHASign" 
					 type="text"
					 value=""/>
			</td>
		</tr>		
			<tr>
			<td>
				<label for="pt">
				<span style="text-decoration: underline">P</span>aymenttype:</label>
				
			</td>
			<td>
				<select 
					 accesskey="pt"
					 name="pt" 
					 id="pt" 
					 type="text"/>
<?php
foreach ($payment as $paymentcode => $paymentname) {
		echo "<option ";
    if ($paymentcode == $paymentname) {
        echo "selected ";
    }
    echo "value=\"".$paymentcode."\">".$paymentname." </option>\n";
}

?>			    
			    </select>
			</td>
			<tr>
			</tr>
			<td>
				&nbsp;
			</td>
			<td>
				<input type="hidden" name="PSPID" value="myuserid">
				<input type="submit" value="versturen" id="submit2" name="submit2">
		     
			</td>
		</tr>	
	
	</table>
	
	</fieldset>
</form>
thanks for your much apreciated help


Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Jun 04, 2007 4:24 pm
by RobertGonzalez
Does Ogone have a web site with API documentation?

Posted: Tue Jun 05, 2007 1:02 am
by paulus4605
They have a website http://www.ogone.com select international
the documentation is mentioned in these 2 pdf docs http://www.geocities.com/paulus4605/Ogo ... 2-0_EN.pdf
and in http://www.geocities.com/paulus4605/Ogo ... 1-1_EN.pdf

Paul[/url]

Posted: Tue Jun 05, 2007 10:19 am
by RobertGonzalez
Have you read the docs for an answer to the question yet?

Posted: Tue Jun 05, 2007 11:35 am
by paulus4605
I have read the docs
but don't know how to go from there
If I should have known how to do this I would have solved the problem myself.

since my php knowledge is minimal I took the liberty to post this question

thanks again for your help

Paul

Posted: Tue Jun 05, 2007 12:02 pm
by RobertGonzalez
I'm just trying to gauge what you have already tried/done.

Looking (briefly) over your docs I would assume your answer is in chapter 8 in the first document.

Posted: Tue Jun 05, 2007 12:17 pm
by paulus4605
Ok,
The problem that I have is that I need to capture the response from Ogone.
I know that this is done with the postsale URL however I don't know how to create the code to make this working
I would really apreciate it if you could help me with this

thanks again for your help

Paul

Posted: Tue Jun 05, 2007 1:15 pm
by RobertGonzalez
I can help you, but I need something from you before that. I cannot spend that much time reading the docs for you.

What do you know about the return data? Or about return codes from Ogone? How are their responses sent? It is easy to capture when you know what you are dealing with. But I am not about to read that 45 page document for you. Tell us how we can help you with what you already know about there services. We will help you code it.

Posted: Tue Jun 05, 2007 1:47 pm
by paulus4605
I think the best thing for me is retreiving the info through the accept decline cancel or exception Url
the details of the params that you get back is mentioned under point 8.2.3.1 from the advanced manual

Paul

Posted: Wed Jun 06, 2007 3:12 pm
by paulus4605
Dear
can someone help me out here
your help is much apreciated

kind regards