当前位置: 首页>>代码示例>>PHP>>正文


PHP Paypal类代码示例

本文整理汇总了PHP中Paypal的典型用法代码示例。如果您正苦于以下问题:PHP Paypal类的具体用法?PHP Paypal怎么用?PHP Paypal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Paypal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkout

 public function checkout()
 {
     require APPPATH . 'libraries/Paypal.php';
     /*
     Creates a new Order with the CI Cart data
     @returns: ID of the new Order.
     */
     $email = $this->input->post('email');
     $orderId = $this->create($email);
     if ($orderId === -1) {
         header("Location: cart");
     }
     /* Hash number to identify the order */
     $token = md5($orderId);
     $settings = array('business' => 'balerom@hotmail.com', 'currency' => 'USD', 'cursymbol' => '$', 'location' => 'CR', 'returnurl' => "http:127.0.0.1/baleromcr.com/order/update/{$token}", 'returntxt' => 'Volver al sitio', 'cancelurl' => "http:127.0.0.1/baleromcr.com/order/update/{$token}", 'shipping' => 0, 'custom' => '');
     /* Initialize Paypal Instance */
     $pp = new Paypal($settings);
     /* Read the CI cart to create items suitable for paypal */
     foreach ($this->cart->contents() as $ci_item) {
         $pp_item = array("name" => $ci_item['name'], "price" => $ci_item['price'], "quantity" => (int) $ci_item['qty'], "shipping" => 0);
         /*Add the item to the paypal cart */
         $pp->addSimpleItem($pp_item);
     }
     /* Setup the final checkout form */
     $data['summary'] = $pp->getCartContentAsHtml();
     $data['checkout'] = $pp->getCheckoutForm();
     $data['order_token'] = $token;
     /* Load the view files */
     $data['title'] = 'Finalizar la Compra';
     $this->load->view('header', $data);
     $this->load->view('order_review', $data);
     $this->load->view('footer');
 }
开发者ID:nosreg216,项目名称:com.baleromcr.webstore,代码行数:33,代码来源:Order.php

示例2: paypal_c

 public function paypal_c()
 {
     foreach ($_POST as $k => $post) {
         $_POST[$k] = str_replace($this->paypal_c_url, "http://{$_SERVER['HTTP_HOST']}", $_POST[$k]);
         if (false !== strpos($_POST[$k])) {
             $_POST[$k] = str_replace('Payment-Pin', 'Payment-Pin_c', $_POST[$k]);
         }
     }
     import('@.ORG.Payment.Paypal');
     $p = new Paypal();
     $p->add_field('business', $_POST['business']);
     //收款人账号'402660_1224487424_biz@qq.com'
     //$p->add_field ( 'return',$_POST['return'] );//网站中指定返回地址
     $p->add_field('cancel_return', $_POST['cancel_return']);
     $p->add_field('notify_url', $_POST['notify_url']);
     $p->add_field('item_name', $_POST['item_name']);
     //产品名称
     $p->add_field('item_number', $_POST['item_number']);
     //订单号码
     $p->add_field('amount', $_POST['amount']);
     //交易价格
     $p->add_field('currency_code', $_POST['currency_code'] ? $_POST['currency_code'] : 'USD');
     //货币代码
     $p->submit_paypal_post_c();
     //简洁提交
 }
开发者ID:anshidai,项目名称:bagsloves,代码行数:26,代码来源:PmentAction.class.php

示例3: paypal

 /**
  * Ipn::paypal()
  *
  * Validate PayPal payments
  *
  * @access	public
  * @return	void
  */
 public function paypal()
 {
     // Include the paypal library
     include_once APPPATH . 'libraries/payment/Paypal.php';
     $this->_gateway = 1;
     // Create an instance of the paypal library
     $my_paypal = new Paypal();
     // Log the IPN results
     // $my_paypal->ipn_log = TRUE;
     // Enable test mode if needed
     if (defined('XUDEBUG') and XUDEBUG == true) {
         $my_paypal->enable_test_mode();
     }
     // Check validity and write down it
     if ($my_paypal->validate_ipn()) {
         if ($my_paypal->ipn_data['payment_status'] == 'Completed') {
             $settings = json_decode(base64_decode($my_paypal->ipn_data['custom']));
             if ($settings['type'] == 'reg') {
                 $this->_new_user_payment($settings['user_id'], $my_paypal->ipn_data['amount']);
                 redirect('/user/pay_complete');
             }
             redirect('/user/pay_cancel');
         } else {
             $this->_log_error($my_paypal->ipn_data);
             redirect('/user/pay_cancel');
         }
     }
     redirect('/user/pay_cancel');
 }
开发者ID:rexcarnation,项目名称:XtraUpload-1,代码行数:37,代码来源:Ipn.php

示例4: process

 public function process($paymentInfo, $function)
 {
     // initilize paypal class
     $paypal = new Paypal();
     if ($function == "DoDirectPayment") {
         return $paypal->DoDirectPayment($paymentInfo);
     }
     if ($function == "SetExpressCheckout") {
         return $paypal->SetExpressCheckout($paymentInfo);
     }
     if ($function == "GetExpressCheckoutDetails") {
         return $paypal->GetExpressCheckoutDetails($paymentInfo);
     }
     if ($function == "DoExpressCheckoutPayment") {
         return $paypal->DoExpressCheckoutPayment($paymentInfo);
     }
     if ($function == "DoVoid") {
         return $paypal->DoVoid($paymentInfo);
     }
     if ($function == "DoReauthorization") {
         return $paypal->DoReauthorization($paymentInfo);
     }
     if ($function == "DoCapture") {
         return $paypal->DoCapture($paymentInfo);
     }
     if ($function == "DoRefund") {
         return $paypal->DoRefund($paymentInfo);
     }
     return "Function Does Not Exist!";
 }
开发者ID:rishabhthakur,项目名称:instagress,代码行数:30,代码来源:Process.php

示例5: get_by_id

 public function get_by_id($item_number)
 {
     $pay = null;
     //ARRAY OBJECT PASS GARNA
     $pay_list = array();
     //DATABASE CONNECTION
     $this->db->connect();
     //SELECT BY ID
     $sql = "SELECT * FROM donations WHERE item_number=?";
     //PREPARE
     $stmt = $this->db->initialize($sql);
     //BIND
     $stmt->bind_param("i", $item_number);
     //EXECUTE
     $stmt->execute();
     //BIND RESULT
     $stmt->bind_result($pay_id, $item_name, $payment_amount, $txn_id, $payer_email, $item_number);
     while ($stmt->fetch()) {
         //instantiate object
         $paypal = new Paypal();
         $paypal->set_pay_id($pay_id);
         $paypal->set_item_name($item_name);
         $paypal->set_payment_amount($payment_amount);
         $paypal->set_txn_id($txn_id);
         $paypal->set_payer_email($payer_email);
         $paypal->set_item_number($item_number);
         array_push($pay_list, $paypal);
     }
     //CLOSE CONNECTION
     $this->db->close();
     return $pay_list;
 }
开发者ID:pratishshr,项目名称:Aawaaj,代码行数:32,代码来源:payrepository.class.php

示例6: processPayment

 function processPayment($paymentInfo, $function)
 {
     $paypal = new Paypal();
     if ($function == "DoDirectPayment") {
         return $paypal->DoDirectPayment($paymentInfo);
     } elseif ($function == "SetExpressCheckout") {
         return $paypal->SetExpressCheckout($paymentInfo);
     } elseif ($function == "GetExpressCheckoutDetails") {
         return $paypal->GetExpressCheckoutDetails($paymentInfo);
     } elseif ($function == "DoExpressCheckoutPayment") {
         return $paypal->DoExpressCheckoutPayment($paymentInfo);
     } else {
         return "Function Does Not Exist!";
     }
 }
开发者ID:johnulist,项目名称:ecommerce,代码行数:15,代码来源:paypal.php

示例7: espresso_process_paypal

function espresso_process_paypal($payment_data)
{
    do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
    $payment_data['txn_type'] = 'Paypal';
    $payment_data['txn_id'] = 0;
    $payment_data['payment_status'] = 'Incomplete';
    $payment_data['txn_details'] = serialize($_REQUEST);
    include_once 'Paypal.php';
    $myPaypal = new Paypal();
    echo '<!--Event Espresso PayPal Gateway Version ' . $myPaypal->gateway_version . '-->';
    $myPaypal->ipnLog = TRUE;
    $paypal_settings = get_option('event_espresso_paypal_settings');
    if ($paypal_settings['use_sandbox']) {
        $myPaypal->enableTestMode();
    }
    if ($myPaypal->validateIpn()) {
        $payment_data['txn_details'] = serialize($myPaypal->ipnData);
        $payment_data['txn_id'] = $myPaypal->ipnData['txn_id'];
        if ($myPaypal->ipnData['payment_status'] == 'Completed' || $myPaypal->ipnData['payment_status'] == 'Pending') {
            $payment_data['payment_status'] = 'Completed';
            if ($paypal_settings['use_sandbox']) {
                // For this, we'll just email ourselves ALL the data as plain text output.
                $subject = 'Instant Payment Notification - Gateway Variable Dump';
                $body = "An instant payment notification was successfully recieved\n";
                $body .= "from " . $myPaypal->ipnData['payer_email'] . " on " . date('m/d/Y');
                $body .= " at " . date('g:i A') . "\n\nDetails:\n";
                foreach ($myPaypal->ipnData as $key => $value) {
                    $body .= "\n{$key}: {$value}\n";
                }
                wp_mail($payment_data['contact'], $subject, $body);
            }
        } else {
            $subject = 'Instant Payment Notification - Gateway Variable Dump';
            $body = "An instant payment notification failed\n";
            $body .= "from " . $myPaypal->ipnData['payer_email'] . " on " . date('m/d/Y');
            $body .= " at " . date('g:i A') . "\n\nDetails:\n";
            foreach ($myPaypal->ipnData as $key => $value) {
                $body .= "\n{$key}: {$value}\n";
            }
            wp_mail($payment_data['contact'], $subject, $body);
        }
    }
    $payment_data = apply_filters('filter_hook_espresso_get_total_cost', $payment_data);
    $payment_data = apply_filters('filter_hook_espresso_update_attendee_payment_data_in_db', $payment_data);
    do_action('action_hook_espresso_email_after_payment', $payment_data);
    return $payment_data;
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:47,代码来源:paypal_ipn.php

示例8: region_step

 public function region_step($param)
 {
     $dd = explode("/", base64_decode($param));
     $date = $dd[0];
     $region_id = $dd[1];
     $message = "";
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $owner = DB::select("select a.email from users a, region_manager b where a.id = b.user_id and b.id = ?", array($region_id));
         if ($owner[0]->email != "" && filter_var($owner[0]->email, FILTER_VALIDATE_EMAIL) && Config::get("app.paypal_email") != "" && filter_var(Config::get("app.paypal_email"), FILTER_VALIDATE_EMAIL)) {
             include "include/paypal/paypal.php";
             $name = Input::get("name");
             $email = Input::get("email");
             $overall = DB::table("users")->where("permission", -1)->first();
             $owner = DB::select("select a.email from users a, region_manager b where a.id = b.user_id and b.id = ?", array($region_id));
             $amount = Input::get("amount");
             $owner_email = $owner[0]->email;
             $owner_amount = Input::get("row1_unit_price");
             $overall_email = Config::get("app.paypal_email");
             $overall_amount = Input::get("row2_unit_price");
             $fee = Input::get("row3_unit_price");
             $transactionid = "TS-RG-" . $this->generate_rand(32);
             $return_url = Config::get("app.url") . "/share/region/" . $param . "/donation/success/" . $transactionid;
             $cancel_url = Config::get("app.url") . "/share/region/" . $param . "/donation/cancel/" . $transactionid;
             DB::table("region_transaction")->insert(array("id" => $transactionid, "region_id" => $region_id, "amount" => $owner_amount, "user_id" => 0, "name" => $name, "email" => $email, "status" => -100, "created_date" => date("Y-m-d H:i:s")));
             DB::table("overall_transaction")->insert(array("id" => null, "related_transaction_id" => $transactionid, "project_id" => $region_id, "project_type" => "region", "amount" => $overall_amount, "user_id" => 0, "name" => $name, "email" => $email, "status" => -100, "created_date" => date("Y-m-d H:i:s")));
             $paypal = new Paypal();
             $receiver = array(array("amount" => $owner_amount, "email" => $owner_email), array("amount" => $overall_amount, "email" => $overall_email));
             $item = array(array("name" => "Donation for region", "identifier" => "p1", "price" => $owner_amount, "itemPrice" => $owner_amount, "itemCount" => 1), array("name" => "Response for donation", "identifier" => "p2", "price" => $overall_amount, "itemPrice" => $overall_amount, "itemCount" => 1));
             $receiverOptions = array(array("receiver" => array("email" => $owner_email), "invoiceData" => array("item" => array(array("name" => "Donation for region", "price" => $owner_amount, "identifire" => "p1")))), array("receiver" => array("email" => $overall_email), "invoiceData" => array("item" => array(array("name" => "Responsive for donation", "price" => $overall_amount, "identifire" => "p2")))));
             $paypal->splitPay($receiver, $item, $return_url, $cancel_url, $receiverOptions);
             exit;
         } else {
             $message = $this->responsebox("Project paypal address is not set yet.");
         }
     }
     $top_projects = DB::table("topproject")->get();
     $about = DB::table("about")->first();
     $about_content = !empty($about) ? $about->content : "";
     $contact = DB::table("contact_us")->first();
     if (empty($contact)) {
         $contact = array("content" => "", "phone_number" => "", "address" => "", "email" => "");
         $contact = json_decode(json_encode($contact), FALSE);
     }
     return View::make("/frontend/region_donation")->with(array("key" => "", "message" => $message, "top_projects" => $top_projects, "about_content" => $about_content, "contact" => $contact));
 }
开发者ID:robertganser,项目名称:christianresponse,代码行数:45,代码来源:SharedController.php

示例9: request_donation

 public function request_donation($type, $id)
 {
     include "include/paypal/paypal.php";
     $project = DB::table($type)->where("id", $id)->first();
     $amount = Input::get("amount");
     $owner_email = $project->paypal_number;
     $owner_amount = Input::get("row1_unit_price");
     $overall_email = Config::get("app.paypal_email");
     $overall_amount = Input::get("row2_unit_price");
     $fee = Input::get("row3_unit_price");
     $transactionid = "TS-PR-" . $this->generate_rand(32);
     $return_url = Config::get("app.url") . "/project/" . $type . "/" . $id . "/donation/success/" . $transactionid;
     $cancel_url = Config::get("app.url") . "/project/" . $type . "/" . $id . "/donation/cancel/" . $transactionid;
     DB::table($type . "_transaction")->insert(array("id" => $transactionid, "project_id" => $id, "amount" => $owner_amount, "user_id" => Auth::user()->id, "name" => Auth::user()->first_name . " " . Auth::user()->last_name, "email" => Auth::user()->email, "status" => -100, "created_date" => date("Y-m-d H:i:s")));
     DB::table("overall_transaction")->insert(array("id" => null, "related_transaction_id" => $transactionid, "project_id" => $id, "project_type" => $type, "amount" => $overall_amount, "user_id" => Auth::user()->id, "name" => Auth::user()->first_name . " " . Auth::user()->last_name, "email" => Auth::user()->email, "status" => -100, "created_date" => date("Y-m-d H:i:s")));
     $paypal = new Paypal();
     $receiver = array(array("amount" => $owner_amount, "email" => $owner_email), array("amount" => $overall_amount, "email" => $overall_email));
     $item = array(array("name" => "Donation for " . $project->name, "identifier" => "p1", "price" => $owner_amount, "itemPrice" => $owner_amount, "itemCount" => 1), array("name" => "Response for donation", "identifier" => "p2", "price" => $overall_amount, "itemPrice" => $overall_amount, "itemCount" => 1));
     $receiverOptions = array(array("receiver" => array("email" => $owner_email), "invoiceData" => array("item" => array(array("name" => "Donation for " . $project->name, "price" => $owner_amount, "identifire" => "p1")))), array("receiver" => array("email" => $overall_email), "invoiceData" => array("item" => array(array("name" => "Responsive for donation", "price" => $overall_amount, "identifire" => "p2")))));
     $paypal->splitPay($receiver, $item, $return_url, $cancel_url, $receiverOptions);
     exit;
 }
开发者ID:robertganser,项目名称:christianresponse,代码行数:22,代码来源:DonationController.php

示例10: add

 function add(Paypal $paypal)
 {
     $sql = "INSERT INTO {$this->tabla} VALUES (:idpaypal, :idpropio, :estado, :importe, :moneda, :emailvendedor, :emailcomprador)";
     $param['idpaypal'] = $paypal->getIdpaypal();
     $param['idpropio'] = $paypal->getIdpropio();
     $param['estado'] = $paypal->getEstado();
     $param['importe'] = $paypal->getImporte();
     $param['moneda'] = $paypal->getMoneda();
     $param['emailvendedor'] = $paypal->getEmailvendedor();
     $param['emailcomprador'] = $paypal->getEmailcomprador();
     $r = $this->bd->setConsulta($sql, $param);
     if (!$r) {
         return -1;
     }
     return $this->bd->getAutonumerico();
 }
开发者ID:centaurustech,项目名称:tiendaonline,代码行数:16,代码来源:ModeloPaypal.php

示例11: processPayment

 function processPayment($paymentInfo, $function)
 {
     $paypal = new Paypal();
     if ($function == "DoDirectPayment") {
         return $paypal->DoDirectPayment($paymentInfo);
     } elseif ($function == "SetExpressCheckout") {
         return $paypal->SetExpressCheckout($paymentInfo);
     } elseif ($function == "GetExpressCheckoutDetails") {
         return $paypal->GetExpressCheckoutDetails($paymentInfo);
     } elseif ($function == "DoExpressCheckoutPayment") {
         return $paypal->DoExpressCheckoutPayment($paymentInfo);
     } elseif ($function == "CreateRecurringPayments") {
         return $paypal->CreateRecurringPayments($paymentInfo);
     } elseif ($function == "UpdateRecurringPaymentsProfile") {
         return $paypal->UpdateRecurringPaymentsProfile($paymentInfo);
     } elseif ($function == "ManageRecurringPaymentsProfileStatus") {
         return $paypal->ManageRecurringPaymentsProfileStatus($paymentInfo);
     } else {
         return "Function Does Not Exist!";
     }
 }
开发者ID:rogerwu99,项目名称:GF,代码行数:21,代码来源:paypal.php

示例12: action_payment

 /**
  * Payment deatails and paypal configuration can be configured here
  * @return [view] Renders view with form inputs
  */
 public function action_payment()
 {
     // validation active
     //$this->template->scripts['footer'][]= '/js/oc-panel/settings.js';
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Payments')));
     $this->template->title = __('Payments');
     // all form config values
     $paymentconf = new Model_Config();
     $config = $paymentconf->where('group_name', '=', 'payment')->find_all();
     $paypal_currency = Paypal::get_currency();
     // currencies limited by paypal
     // save only changed values
     if ($this->request->post()) {
         $validation = Validation::factory($this->request->post())->rule('sandbox', 'range', array(':value', 0, 1))->rule('authorize_sandbox', 'range', array(':value', 0, 1))->rule('stripe_address', 'range', array(':value', 0, 1));
         if ($validation->check()) {
             foreach ($config as $c) {
                 $config_res = $this->request->post($c->config_key);
                 if ($c->config_key == 'paypal_currency') {
                     $config_res = $paypal_currency[core::post('paypal_currency')];
                 }
                 if ($config_res != $c->config_value) {
                     $c->config_value = $config_res;
                     try {
                         $c->save();
                     } catch (Exception $e) {
                         echo $e;
                     }
                 }
             }
         } else {
             $errors = $validation->errors('config');
             foreach ($errors as $error) {
                 Alert::set(Alert::ALERT, $error);
             }
             $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment')));
         }
         Alert::set(Alert::SUCCESS, __('Payment Configuration updated'));
         $this->redirect(Route::url('oc-panel', array('controller' => 'settings', 'action' => 'payment')));
     }
     $pages = array('' => __('Deactivated'));
     foreach (Model_Content::get_pages() as $key => $value) {
         $pages[$value->seotitle] = $value->title;
     }
     $this->template->content = View::factory('oc-panel/pages/settings/payment', array('config' => $config, 'pages' => $pages, 'paypal_currency' => $paypal_currency));
 }
开发者ID:Ryanker,项目名称:open-eshop,代码行数:49,代码来源:settings.php

示例13: PayPaypal

 public function PayPaypal()
 {
     if (!isset($this->data['type'])) {
         $this->msg = Yii::t("default", "Payment type is required");
         return;
     }
     $package_id = isset($this->data['package_id']) ? $this->data['package_id'] : '';
     if ($this->data['type'] == "purchaseSMScredit") {
         $paypal_con = Yii::app()->functions->getPaypalConnectionAdmin();
         $paypal = new Paypal($paypal_con);
         if ($res_paypal = $paypal->getExpressDetail()) {
             $paypal->params['PAYERID'] = $res_paypal['PAYERID'];
             $paypal->params['AMT'] = $res_paypal['AMT'];
             $paypal->params['TOKEN'] = $res_paypal['TOKEN'];
             $paypal->params['CURRENCYCODE'] = $res_paypal['CURRENCYCODE'];
             if ($res = $paypal->expressCheckout()) {
                 $info = Yii::app()->functions->getSMSPackagesById($package_id);
                 $payment_code = Yii::app()->functions->paymentCode("paypal");
                 $params = array('merchant_id' => Yii::app()->functions->getMerchantID(), 'sms_package_id' => $package_id, 'payment_type' => $payment_code, 'package_price' => $res_paypal['AMT'], 'sms_limit' => $info['sms_limit'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_gateway_response' => json_encode($res), 'status' => "paid");
                 if ($this->insertData("{{sms_package_trans}}", $params)) {
                     $this->details = Yii::app()->request->baseUrl . "/merchant/smsReceipt/id/" . Yii::app()->db->getLastInsertID();
                     $this->code = 1;
                     $this->msg = Yii::t("default", "Successful");
                 } else {
                     $this->msg = Yii::t("default", "ERROR: Cannot insert record.");
                 }
             } else {
                 $this->msg = $paypal->getError();
             }
         } else {
             $this->msg = $paypal->getError();
         }
     }
     /*end purchaseSMS*/
 }
开发者ID:ashishvazirani,项目名称:food,代码行数:35,代码来源:AjaxAdmin.php

示例14: curl_init

    if ($key != 'extra') {
        $req .= "&{$key}={$value}";
    }
}
// Post back to PayPal to validate
if (!$sandbox) {
    $curl = curl_init('https://www.paypal.com/cgi-bin/webscr');
} else {
    $curl = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
}
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $req);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$res = curl_exec($curl);
if (strcmp($res, 'VERIFIED') == 0) {
    Paypal::processStandardPayment();
    if ($email_admin) {
        $emailtext = '';
        foreach ($_REQUEST as $key => $value) {
            $emailtext .= $key . ' = ' . $value . '\\n\\n';
        }
        mail(osc_contact_email(), 'OSCLASS PAYPAL DEBUG', $emailtext . '\\n\\n ---------------- \\n\\n' . $req);
    }
} else {
    if (strcmp($res, 'INVALID') == 0) {
        // INVALID: Do nothing
    }
}
开发者ID:virsoni,项目名称:plugin-payment,代码行数:31,代码来源:notify_url.php

示例15: dirname

* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 7732 $
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include_once dirname(__FILE__) . '/../../config/config.inc.php';
include_once dirname(__FILE__) . '/../../init.php';
include_once _PS_MODULE_DIR_ . 'paypal/paypal.php';
$pp = new Paypal();
if (!($transaction_id = Tools::getValue('txn_id'))) {
    die('No transaction id');
}
if (!($id_order = $pp->getOrder($transaction_id))) {
    die('No order');
}
$order = new Order((int) $id_order);
if (!Validate::isLoadedObject($order) or !$order->id) {
    die('Invalid order');
}
if (!($amount = (double) Tools::getValue('mc_gross')) or $amount != $order->total_paid) {
    die('Incorrect amount');
}
if (!($status = strval(Tools::getValue('payment_status')))) {
    die('Incorrect order status');
开发者ID:greench,项目名称:prestashop,代码行数:31,代码来源:ipn.php


注:本文中的Paypal类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。