Ben denetleyicisi (CodeIgniter) için kod kullanıyorum:
function paypal_tran(){
if (empty($_GET['action'])){ $_GET['action'] = 'process';}
if($this->uri->segment ( 3 )){
$action=$this->uri->segment ( 3 );
}
else{
$action='process';
}
$ammount=39.99;
$this->lenders_model->paypal_process($action,$this_script,$ammount);
$this->load->view('view_paypal_tran');
}
function ipn(){
if ($this->paypal_class->validate_ipn()) {
$data = array(
'fname'=> 'fname', /* insert the user id */
'lname'=>'lname'
);
//$this->db->insert('ajax_test',$data);
// For this example, we'll just email ourselves ALL the data.
$subject = 'Instant Payment Notification - Recieved Payment';
$to = 'ceo@stsbd.com'; // your email
$body = "An instant payment notification was successfully recieved\n";
$body .= "from ".$p->ipn_data['payer_email']." on ".date('m/d/Y');
$body .= " at ".date('g:i A')."\n\nDetails:\n";
foreach ($this->paypal_class->ipn_data as $key => $value) { $body .= "\n$key: $value"; }
mail($to, $subject, $body);
}
}
function success()
{
$this->load->view('paypal_succ_view');
}
VE bu benim modeli:
function paypal_process($action,$this_script,$ammount){
switch ($action) {
case 'process': // Process and order...
// There should be no output at this point. To process the POST data,
// the submit_paypal_post() function will output all the HTML tags which
// contains a FORM which is submited instantaneously using the BODY onload
// attribute. In other words, don't echo or printf anything when you're
// going to be calling the submit_paypal_post() function.
// This is where you would have your form validation and all that jazz.
// You would take your POST vars and load them into the class like below,
// only using the POST values instead of constant string expressions.
// For example, after ensureing all the POST variables from your custom
// order form are valid, you might have:
//
// $p->add_field('first_name', $_POST['first_name']);
// $p->add_field('last_name', $_POST['last_name']);
$this->paypal_class->add_field('business', 'lender_1269720740_biz@yahoo.com');
$this->paypal_class->add_field('return', $this_script.'/success');
$this->paypal_class->add_field('cancel_return', $this_script.'/cancel');
$this->paypal_class->add_field('notify_url', $this_script.'/ipn');
$this->paypal_class->add_field('item_name', 'Lenders Account for one month');
$this->paypal_class->add_field('amount', $ammount);
$this->paypal_class->submit_paypal_post(); // submit the fields to paypal
$this->paypal_class->dump_fields(); // for debugging, output a table of all the fields
break;
SORUN IPN ÇALIŞMA değildir. GİZLİ ALAN yönlendirmek IPN İÇİN DEĞER ETTİ, AMA ÇALIŞMIYOR! Yardım pls