Hallo,
Ich habe mir den Shop tt_products (ex zk_ploducts) installiert. Und ich bin total happy damit ;-)
Doch nun bin ich leider schon eine ganze weile damit beschäftigt das Zahlungssystem click&buy zu integrieren. Kennt sich da wer aus? Es dürfte laut den Anbietern keine grosse Hexerei sein.
Eigentlich muss in der ganzen Bestellroutine nur ein mitgeliefertes .php script integriert werden. Doch php gehört leider noch nicht zu meiner absolluten Stärke...
Das wäre die Beispiel-Datei.
Bitte helft mir. Denn egal wie, ich muss das hinkriegen. Denn die Geschäftsleitung will auf dieses System setzen.
Besten Dank im Voraus!!!
<?
/*************************************
***** Transaction Script Example *****
*************************************/
//Init Products
$products = Array("product1" => 29.90,"product2" => 39.90);
//Init Header Parameter
$fg_linknr = $_SERVER["HTTP_X_CONTENTID"]; //Premium Link Number
$fg_price = $_SERVER["HTTP_X_PRICE"]; //Price in Cent-> for 1 EURO enter 100 !
$fg_transaction_id = $_SERVER["HTTP_X_TRANSACTION"]; //Transaction ID is a unique ID from Click&Buy (same like BDR ID)
$fg_uid = $_SERVER["HTTP_X_USERID"]; //Click&Buy Customer Reference Number
$fg_ip = $_SERVER["REMOTE_ADDR"]; //IP - Address from Request
// Init Get Parameter
$my_transaktion_id = $_GET["my_transaktion_id"]; // Your Transaktion-ID to trace double reservation, by double Click
$my_productid = $_GET["productid"]; //Your own GET Parameter
$my_uid = $_GET["uid"]; //Your own GET Parameter
//Check UserID and Reservation check, if transaction_id=0 then is it a test purchase or the user is member in the servicearea
if(empty($fg_uid) || $fg_transaction_id == 0){ $result = false;}
//Check FIRSTGATE IP-Range
if(substr($fg_ip,0,11) != "217.22.128."){$result = false;}
//Check FIRSTGATE Price
if(empty($fg_price)){$result = false;}
// Check Price Transaktionssysteme
if($products[$my_productid]!=($fg_price/1000)){$result = false;}
//If you are using a MySQL Database you can write the values into it by using the following example code.
//Please consider that you may have to do little customizatzions
//You don't need this IF-Blick if yo are not working with a database
if($result){
$sql = "INSERT INTO transactions (uid,fg_uid,date_time,product_id,link_nr,fg_transaction_id,my_transact
Transaktionssystem
- 6 -
ion_id) ";
$sql.= "VALUES ";
$sql.= "('$my_uid','$fg_uid','".date("Y-m-d H:i:s")."','$my_productid','$fg_linknr','$fg_transaction_id','$my_transaktion_id')"; //my_transaktion_id must be unique
if(!$query = @mysql_query($sql,$connection))
{
//Check double reservation, by double Click
$sql_d_reservation = "SELECT transaction_id FROM transactions
Where my_transaction_id=";
$sql_d_reservation.= $my_transaction_id;
$count_transaction = mysql_query(mysql_fetch_row($sql_d_reservation));
//Is the reservation booked then is result=true
//Is the reservation not booked is the result=false
if($count_transaction != 1){$result = false;}
}
}
//redirect success or error
if($result)
{
header("Location: http://www.somewhere.com/FIRSTGATE/thanks.php?result=success");
}else
header("Location: http://www.somewhere.com/FIRSTGATE/sorry.
php?result=error");
}
?>