Thread Closed  Post Thread 

PHP paypal IPN code
Author Message
nick
SEO Dictator

SEO Team

Posts: 1,177
Group: SEO Team
   
Cash: 432.01 Donate
PHP paypal IPN code

Hey guys. Here is the code for paypal IPN thing.

checkout.php

PHP Code:

<?php
include("Includes/functions.php");
$dbc dbconnect();
$pageid $QUERY_STRING;
if (
$QUERY_STRING == "")
{
$pageid 1;
}
$arr explode("x"$pageid);
$hid $arr[0];
$catid $arr[1];
$site_url "http://www.hehehahahaha.com";
$order_total 10;
$order_total number_format($order_total2"."",");
$order_id "$hid" "x" "$catid";

$r mysql_query("Select * from tblhost WHERE HID = '$hid'");
while ( 
$row mysql_fetch_array $r ) )
{
$my_sFirstName $row['User'];
$my_sLastName $row['User'];
$hemail $row['Email'];
$hname $row['Host'];
}
$my_clientEmail $hemail;
$business_paypal "xxxxx@xxxxx.com";
$currency_id "USD";
$sdate time();
$r mysql_query("INSERT INTO tblsponser (HID, CID, Sdate) VALUES ('$hid', '$catid', '$sdate')");


//redirect to paypal
header("location:https://www.paypal.com/xclick?business=$business_paypal&item_name=$hname$order_id&first_name=$my_sFirstName&last_name=$my_sLastName&email=$my_clientEmail&item_number=1&custom=$hid&amount=$order_total&currency_code=$currency_id&notify_url=$site_url/notify.php&return=$site_url/thankyou.php");
?>





Now for the IPN script:
notify.php

PHP Code:

<?php

    
// Assign posted variables to local variables
    
$receiver_email $_POST['receiver_email'];
    
$payer_email $_POST['payer_email'];
    
$payer_status $_POST['payer_status'];
    
$payment_gross $_POST['payment_gross'];
    
$payment_fee $_POST['payment_fee'];
    
$payment_date $_POST['payment_date'];
    
$payment_type $_POST['payment_type'];
    
$payment_status $_POST['payment_status'];
    
$pending_reason $_POST['pending_reason'];
    
$txn_id $_POST['txn_id'];
    
$txn_type $_POST['txn_type'];
    
    
$custom $_POST['custom'];

    if (
$_REQUEST['payment_status'] == "Completed" || $_REQUEST['payment_status'] == "Pending") {

//Query for the payment recieved

include("Includes/functions.php");

$dbc dbconnect();

$hid $custom;



$r mysql_query("Update tblsponser SET Payment = 'Y' WHERE HID = '$hid'");

////////////////////////////////////////


}
?>




Enjoy and have fun.


DNDaily.com - Your Daily Domain Doze
Twut.com - Free Online Games
Product reviews and ratings
Search Engine Optimization Packages
11-23-2006 12:08 AM
Send the author a private message Find all posts by this author Quote this message in a reply

Thread Closed  Post Thread 


Similar Threads
Thread: Author Replies: Last Post
How to code dynamic database update. jignesh 6 05-28-2007 10:17 PM
How to code a template? -Mahi- 2 05-25-2007 01:42 AM
php RSS to HTML code nick 2 03-09-2007 04:24 PM

View a Printable Version | Send this Thread to a Friend | Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:
Forum Jump: