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


PHP Paypal::submitPayment方法代码示例

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


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

示例1: Paypal

<?php

// Include the paypal library
include_once 'Paypal.php';
// Create an instance of the paypal library
$myPaypal = new Paypal();
// Specify your paypal email
$myPaypal->addField('business', 'YOUR_PAYPAL_EMAIL');
// Specify the currency
$myPaypal->addField('currency_code', 'USD');
// Specify the url where paypal will send the user on success/failure
$myPaypal->addField('return', 'http://YOUR_HOST/payment/paypal_success.php');
$myPaypal->addField('cancel_return', 'http://YOUR_HOST/payment/paypal_failure.php');
// Specify the url where paypal will send the IPN
$myPaypal->addField('notify_url', 'http://YOUR_HOST/payment/paypal_ipn.php');
// Specify the product information
$myPaypal->addField('item_name', 'T-Shirt');
$myPaypal->addField('amount', '9.99');
$myPaypal->addField('item_number', '001');
// Specify any custom value
$myPaypal->addField('custom', 'muri-khao');
// Enable test mode if needed
$myPaypal->enableTestMode();
// Let's start the train!
$myPaypal->submitPayment();
开发者ID:fevenor,项目名称:Dockerfile,代码行数:25,代码来源:paypal_start.php

示例2: indexAction

 function indexAction()
 {
     //[TODO] must check if orderId has been paid before to avoid double charge, if somehow user can access directly to payment controller.
     $this->_checkAuth();
     $orderId = $this->_request->getParam('orderId');
     $this->_orderIdNumber = $orderId;
     if (empty($orderId)) {
         echo "kosong";
         die;
     }
     $modelAppStore = new App_Model_Store();
     if (!$modelAppStore->isUserOwnOrder($this->_userDetailInfo->guid, $orderId)) {
         //forward to error page
         $this->_helper->redirector->gotoSimple('error', 'store', 'site', array('view' => 'notowner'));
         die;
     }
     if ($modelAppStore->isOrderPaid($orderId)) {
         //forward to error page
         $this->_helper->redirector->gotoSimple('error', 'store', 'site', array('view' => 'orderalreadypaid'));
         die;
     }
     $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
     $items = $tblOrder->getOrderDetail($orderId);
     $tmpMethod = $this->_request->getParam('method');
     if (!empty($tmpMethod)) {
         $items[0]['paymentMethod'] = $tmpMethod;
     }
     switch ($items[0]['paymentMethod']) {
         case 'nsiapay':
             require_once 'PaymentGateway/Nsiapay.php';
             // include the class file
             $paymentObject = new Nsiapay();
             // initiate an instance of the class
             if ($this->_testMode) {
                 $paymentObject->enableTestMode();
             }
             $paymentObject->addField('TYPE', "IMMEDIATE");
             for ($iCart = 0; $iCart < count($items); $iCart++) {
                 $i = $iCart + 1;
                 $basket[] = $items[$iCart]['documentName'] . "," . $items[$iCart]['price'] . ".00" . "," . $items[$iCart]['qty'] . "," . $items[$iCart]['finalPrice'] . ".00";
                 $subTotal += $items[$iCart]['price'] * $items[$iCart]['qty'];
             }
             $ca = implode(";", $basket);
             $merchantId = "000100090000028";
             $paymentObject->addField("BASKET", $ca);
             $paymentObject->addField("MERCHANTID", $merchantId);
             $paymentObject->addField("CHAINNUM", "NA");
             $paymentObject->addField("TRANSIDMERCHANT", $items[0]['invoiceNumber']);
             $paymentObject->addField("AMOUNT", $subTotal);
             $paymentObject->addField("CURRENCY", "360");
             $paymentObject->addField("PurchaseCurrency", "360");
             $paymentObject->addField("acquirerBIN", "360");
             $paymentObject->addField("password", "123456");
             $paymentObject->addField("URL", ROOT_URL);
             $paymentObject->addField("MALLID", "199");
             $paymentObject->addField("SESSIONID", Zend_Session::getId());
             $sha1 = sha1($subTotal . ".00" . $merchantId . "08iIWbWvO16w" . $items[0]['invoiceNumber']);
             //                echo $subTotal.".00".$merchantId."08iIWbWvO16w".$items[0]['invoiceNumber']."<br>";
             //                echo $sha1;die;
             $paymentObject->addField("WORDS", $sha1);
             $ivnum = $this->updateInvoiceMethod($orderId, 'nsiapay', 1, 0, 'paid with nsiapay method');
             $data['orderId'] = $orderId;
             $data['starttime'] = date('YmdHis');
             $data['amount'] = $subTotal;
             $data['transidmerchant'] = $items[0]['invoiceNumber'];
             $tblNsiapay = new Pandamp_Modules_Payment_Nsiapay_Model_Nsiapay();
             $tblNsiapay->insert($data);
             $nhis['orderId'] = $items[0]['invoiceNumber'];
             $nhis['paymentStatus'] = 'requested';
             $nhis['dateAdded'] = date('YmdHis');
             $tblNhis = new Pandamp_Modules_Payment_NsiapayHistory_Model_NsiapayHistory();
             $tblNhis->insert($nhis);
             //                $paymentObject->dumpFields();
             $this->_helper->layout->disableLayout();
             $paymentObject->submitPayment();
             break;
         case 'paypal':
             /*
              - Detect Multi Item and set accordingly
              - Logic for test mode 
             */
             require_once 'PaymentGateway/Paypal.php';
             // include the class file
             $paymentObject = new Paypal();
             // initiate an instance of the class
             if ($this->_testMode) {
                 $paymentObject->addField('business', $this->_paymentVars['paypalTestBusiness']);
                 $paymentObject->addField('return', $this->_paymentVars['paypalTestSuccessUrl']);
                 $paymentObject->addField('cancel_return', $this->_paymentVars['paypalTestCancelUrl']);
                 $paymentObject->addField('notify_url', $this->_paymentVars['paypalTestNotifyUrl']);
                 $paymentObject->enableTestMode();
             } else {
                 $paymentObject->addField('business', $this->_paymentVars['paypalBusiness']);
                 $paymentObject->addField('return', $this->_paymentVars['paypalSuccessUrl']);
                 $paymentObject->addField('cancel_return', $this->_paymentVars['paypalCancelUrl']);
                 $paymentObject->addField('notify_url', $this->_paymentVars['paypalNotifyUrl']);
             }
             for ($iCart = 0; $iCart < count($items); $iCart++) {
                 $i = $iCart + 1;
                 $paymentObject->addField("item_number_" . $i, $items[$iCart]['itemId']);
//.........这里部分代码省略.........
开发者ID:hukumonline,项目名称:quart80,代码行数:101,代码来源:PaymentController.php

示例3: start_ipn

 public function start_ipn($data, $config)
 {
     $myPaypal = new Paypal();
     $myPaypal->addField('cmd', '_cart');
     $myPaypal->addField('charset', 'utf-8');
     // Specify your paypal email
     $myPaypal->addField('business', $config["email"]);
     $myPaypal->addField('upload', 1);
     if (isset($config["image_url"]) && $config["image_url"] != '') {
         $myPaypal->addField('image_url', $config["image_url"]);
     }
     if (isset($config["cpp_header_image"]) && $config["cpp_header_image"] != '') {
         $myPaypal->addField('cpp_header_image', $config["cpp_header_image"]);
     }
     // Specify the currency
     $myPaypal->addField('currency_code', $this->_config["currency"]);
     // Specify the url where paypal will send the user on success/failure
     $myPaypal->addField('return', $this->EE->functions->create_url($config["thank_you_url"]));
     $myPaypal->addField('cancel_return', $data["cancel_return"] . '&token=' . $data["transaction_id"]);
     // Specify the url where paypal will send the IPN
     $myPaypal->addField('notify_url', $data["notify_url"]);
     $i = 1;
     foreach ($data["cart"]["items"] as $items) {
         $myPaypal->addField('item_name_' . $i, $items["title"]);
         $myPaypal->addField('amount_' . $i, $this->_currency_round($items["price"]));
         $myPaypal->addField('item_number_' . $i, $items["product_id"]);
         $myPaypal->addField('quantity_' . $i, $items["quantity"]);
         $i++;
     }
     // Add shipping address info
     #$myPaypal->addField('address_override',1);
     $myPaypal->addField('address1', $data["br_shipping_address1"]);
     $myPaypal->addField('address2', $data["br_shipping_address2"]);
     $myPaypal->addField('city', $data["br_shipping_city"]);
     $myPaypal->addField('country', $data["br_shipping_country"]);
     $myPaypal->addField('email', $data["email"]);
     $myPaypal->addField('first_name', $data["br_shipping_fname"]);
     $myPaypal->addField('last_name', $data["br_shipping_lname"]);
     $myPaypal->addField('state', $data["br_shipping_state"]);
     $myPaypal->addField('zip', $data["br_shipping_zip"]);
     // Specify the shipping / discount / tax
     $myPaypal->addField('no_shipping', 2);
     $myPaypal->addField('handling_cart', $data["cart_shipping"]);
     $myPaypal->addField('discount_amount_cart', $data["cart_discount"]);
     $myPaypal->addField('tax_cart', $data["cart_tax"]);
     // Specify any custom value
     $myPaypal->addField('no_note', 1);
     $myPaypal->addField('custom', $data["transaction_id"]);
     if ($config["sandbox"] == "TRUE") {
         $myPaypal->enableTestMode();
     }
     // Let's start the train!
     $myPaypal->submitPayment();
 }
开发者ID:ebeauchamps,项目名称:brilliantretail,代码行数:54,代码来源:gateway.paypal_standard.php

示例4: pay_new

 public function pay_new($id = '', $gate_id = '')
 {
     if (intval($id) == 0 or intval($gate_id) == 0) {
         show_404();
     }
     $user = $this->db->get_where('users', array('id' => $id))->row();
     if (!$user or $user->status != 0) {
         show_404();
     }
     $group = $this->db->get_where('groups', array('id' => $user->group))->row();
     if (!$group) {
         show_404();
     }
     $gate = $this->db->get_where('gateways', array('id' => $gate_id))->row();
     if (!$gate) {
         show_404();
     }
     // get payment gateway settings
     $gate_conf = unserialize($gate->settings);
     // load payment libs
     include_once APPPATH . 'libraries/payment/PaymentGateway.php';
     // which payment system to use?
     if ($gate->name == 'paypal') {
         // Include the paypal library
         include_once APPPATH . 'libraries/payment/Paypal.php';
         // Create an instance of the paypal library
         $myPaypal = new Paypal();
         // Specify your paypal email
         $myPaypal->addField('business', $gate_conf['email']);
         // Specify the currency
         $myPaypal->addField('currency_code', $gate_conf['currency']);
         // Specify the url where paypal will send the user on success/failure
         $myPaypal->addField('return', site_url('user/pay_complete'));
         $myPaypal->addField('cancel_return', site_url('user/pay_cancel'));
         // Specify the url where paypal will send the IPN
         $myPaypal->addField('notify_url', site_url('payment/ipn/paypal'));
         // Specify the product information
         $myPaypal->addField('item_name', $this->startup->site_config['sitename'] . ' ' . $this->lang->line('user_controller_14'));
         $myPaypal->addField('amount', $group->price);
         $myPaypal->addField('item_number', rand(1, 1000) . '-' . $user->id);
         // Specify any custom value
         $myPaypal->addField('custom', base64_encode(serialize(array('user_id' => $user->id, 'type' => 'reg'))));
         // Enable test mode if needed
         if (defined('XUDEBUG') and XUDEBUG == true) {
             $myPaypal->enableTestMode();
         }
         // Let's start the train!
         $data['form'] = $myPaypal->submitPayment($this->lang->line('user_controller_paypal_submitpayment'));
     } else {
         if ($gate->name == 'authorize') {
             // Include the paypal library
             include_once APPPATH . 'libraries/payment/Authorize.php';
             // Create an instance of the authorize.net library
             $myAuthorize = new Authorize();
             // Specify your authorize.net login and secret
             $myAuthorize->setUserInfo($gate_conf['login'], $gate_conf['secret']);
             // Specify the url where authorize.net will send the user on success/failure
             $myAuthorize->addField('x_Receipt_Link_URL', site_url('user/pay_complete'));
             // Specify the url where authorize.net will send the IPN
             $myAuthorize->addField('x_Relay_URL', site_url('payment/ipn/authorize'));
             // Specify the product information
             $myAuthorize->addField('x_Description', $this->startup->site_config['sitename'] . ' ' . $this->lang->line('user_controller_14'));
             $myAuthorize->addField('x_Amount', $group->price);
             $myAuthorize->addField('x_Invoice_num', rand(1, 1000) . '-' . $user->id);
             $myAuthorize->addField('x_Cust_ID', base64_encode(serialize(array('user_id' => $user->id, 'type' => 'reg'))));
             // Enable test mode if needed
             if (defined('XUDEBUG') and XUDEBUG == true) {
                 $myAuthorize->enableTestMode();
             }
             // Let's start the train!
             $data['form'] = $myAuthorize->submitPayment($this->lang->line('user_controller_paypal_submitpayment'));
         } else {
             if ($gate->name = '2co') {
                 // Include the paypal library
                 include_once APPPATH . 'libraries/payment/TwoCo.php';
                 // Create an instance of the authorize.net library
                 $my2CO = new TwoCo();
                 // Specify your 2CheckOut vendor id
                 $my2CO->addField('sid', $gate_conf['vendor_id']);
                 // Specify the order information
                 $my2CO->addField('cart_order_id', rand(1, 1000) . '-' . $user->id);
                 $my2CO->addField('total', $group->price);
                 // Specify the url where authorize.net will send the IPN
                 $my2CO->addField('x_Receipt_Link_URL', site_url('payment/ipn/two_checkout'));
                 $my2CO->addField('tco_currency', $gate_conf['currency']);
                 $my2CO->addField('custom', base64_encode(serialize(array('user_id' => $user->id, 'type' => 'reg'))));
                 // Enable test mode if needed
                 if (defined('XUDEBUG') and XUDEBUG == true) {
                     $my2CO->enableTestMode();
                 }
                 // Let's start the train!
                 $data['form'] = $my2CO->submitPayment($this->lang->line('user_controller_paypal_submitpayment'));
             }
         }
     }
     $this->load->view($this->startup->skin . '/header', array('headerTitle' => $this->lang->line('user_controller_15')));
     $this->load->view($this->startup->skin . '/user/register/pay_new', array('ammount' => $group, 'user' => $id, 'form' => $data['form']));
     $this->load->view($this->startup->skin . '/footer');
 }
开发者ID:KasaiDot,项目名称:XtraUpload,代码行数:99,代码来源:user.php

示例5: indexAction

 public function indexAction()
 {
     //[TODO] must check if orderId has been paid before to avoid double charge, if somehow user can access directly to payment controller.
     $this->_checkAuth();
     $orderId = $this->_request->getParam('orderId');
     $this->_orderIdNumber = $orderId;
     if (empty($orderId)) {
         echo "kosong";
         die;
     }
     $modelAppStore = new App_Model_Store();
     if (!$modelAppStore->isUserOwnOrder($this->_userDetailInfo->guid, $orderId)) {
         //forward to error page
         $this->_helper->redirector->gotoSimple('error', 'store', 'site', array('view' => 'notowner'));
         die;
     }
     if ($modelAppStore->isOrderPaid($orderId)) {
         //forward to error page
         $this->_helper->redirector->gotoSimple('error', 'store', 'site', array('view' => 'orderalreadypaid'));
         die;
     }
     $tblOrder = new Kutu_Core_Orm_Table_Order();
     $items = $tblOrder->getOrderDetail($orderId);
     //var_dump($items); die();
     $tmpMethod = $this->_request->getParam('method');
     if (!empty($tmpMethod)) {
         $items[0]['paymentMethod'] = $tmpMethod;
     }
     switch ($items[0]['paymentMethod']) {
         case 'paypal':
             /*
              - Detect Multi Item and set accordingly
              - Logic for test mode 
             */
             require_once 'PaymentGateway/Paypal.php';
             // include the class file
             $paymentObject = new Paypal();
             // initiate an instance of the class
             if ($this->_testMode) {
                 $paymentObject->addField('business', $this->_paymentVars['paypalTestBusiness']);
                 $paymentObject->addField('return', $this->_paymentVars['paypalTestSuccessUrl']);
                 $paymentObject->addField('cancel_return', $this->_paymentVars['paypalTestCancelUrl']);
                 $paymentObject->addField('notify_url', $this->_paymentVars['paypalTestNotifyUrl']);
                 $paymentObject->enableTestMode();
             } else {
                 $paymentObject->addField('business', $this->_paymentVars['paypalBusiness']);
                 $paymentObject->addField('return', $this->_paymentVars['paypalSuccessUrl']);
                 $paymentObject->addField('cancel_return', $this->_paymentVars['paypalCancelUrl']);
                 $paymentObject->addField('notify_url', $this->_paymentVars['paypalNotifyUrl']);
             }
             for ($iCart = 0; $iCart < count($items); $iCart++) {
                 $i = $iCart + 1;
                 $paymentObject->addField("item_number_" . $i, $items[$iCart]['itemId']);
                 $paymentObject->addField("item_name_" . $i, $items[$iCart]['documentName']);
                 //nama barang [documentName]
                 $paymentObject->addField("amount_" . $i, number_format($items[$iCart]['price'], 2, '.', ''));
                 //harga satuan [price]
                 $paymentObject->addField("quantity_" . $i, $items[$iCart]['qty']);
                 //jumlah barang [qty]\
             }
             $paymentObject->addField('tax_cart', $items[0]['orderTax']);
             $paymentObject->addField('currency_code', $this->_defaultCurrency);
             //$paymentObject->addField('custom',$_SESSION['_orderIdNumber']);
             $paymentObject->addField('custom', $orderId);
             $ivnum = $this->updateInvoiceMethod($orderId, 'paypal', 1, 0, 'paid with paypal method');
             //$paymentObject->dumpFields();
             $mod = new App_Model_Store_Mailer();
             $mod->sendInvoiceToUser($orderId, 1);
             $paymentObject->submitPayment();
             //setting payment and status as pending (1), notify = 0, notes = 'paid with...'
             break;
         case 'manual':
         case 'bank':
             /*
              1. update order status
              2. redirect to instruction page 
             */
             //setting payment and status as pending (1), notify = 0, notes = 'paid with...'
             $this->updateInvoiceMethod($orderId, 'bank', 1, 0, 'paid with manual method');
             $mod = new App_Model_Store_Mailer();
             $mod->sendBankInvoiceToUser($orderId, 1);
             // HAP: i think we should send this notification when user were on page "Complete Order" and after confirmation made by user is approved;
             //$this->Mailer($orderId, 'admin-order', 'admin');
             //$this->Mailer($orderId, 'user-order', 'user');
             $this->_helper->redirector('instruction', 'store_payment', 'site', array('orderId' => $orderId));
             break;
         case 'postpaid':
             /*
              1. validate POSTPAID status of the client 
              2. validate CREDIT LIMIT (per user) with current Outstanding Bill + New Bill
              3. update order status
              4. redirect to success or failed 
             */
             /*
              * if userid isn't listed as postpaid user will be redirected
              */
             if (!$this->_userInfo->isPostPaid) {
                 echo 'Not Post Paid Customer';
                 //$paymentObject->submitPayment();
                 return $this->_helper->redirector('notpostpaid');
//.........这里部分代码省略.........
开发者ID:psykomo,项目名称:kutump,代码行数:101,代码来源:PaymentController.php

示例6: indexAction

 public function indexAction()
 {
     /*
         1. Calculate Tax, Save Order and Order Detail
         2. Set Payment Method
         3. Submit Variable to Payment Gateway or Manual 
     */
     // Process and order...
     $this->_checkAuth();
     $cart = $this->completeItem();
     $methode = $this->_request->getParam('paymentMethod');
     if (empty($_SESSION['_orderIdNumber'])) {
         $this->saveOrder($cart, $methode);
     } else {
         $this->_orderIdNumber = $_SESSION['_orderIdNumber'];
         if ($methode == 'paypal') {
             $this->updateOrder($cart, $methode, $this->_orderIdNumber);
         }
     }
     $paymentMethod = $this->_request->getParam('type');
     $this->_paymentMethod = $paymentMethod;
     switch ($this->_paymentMethod) {
         case 'paypal':
             /*
              - Detect Multi Item and set accordingly
              - Logic for test mode 
             */
             require_once 'PaymentGateway/Paypal.php';
             // include the class file
             $paymentObject = new Paypal();
             // initiate an instance of the class
             if ($this->_testMode) {
                 $paymentObject->addField('business', $this->_paymentVars['paypalTestBusiness']);
                 $paymentObject->addField('return', $this->_paymentVars['paypalTestSuccessUrl']);
                 $paymentObject->addField('cancel_return', $this->_paymentVars['paypalTestCancelUrl']);
                 $paymentObject->addField('notify_url', $this->_paymentVars['paypalTestNotifyUrl']);
                 $paymentObject->enableTestMode();
             } else {
                 $paymentObject->addField('business', $this->_paymentVars['paypalBusiness']);
                 $paymentObject->addField('return', $this->_paymentVars['paypalSuccessUrl']);
                 $paymentObject->addField('cancel_return', $this->_paymentVars['paypalCancelUrl']);
                 $paymentObject->addField('notify_url', $this->_paymentVars['paypalNotifyUrl']);
             }
             $cart = $this->completeItem();
             for ($iCart = 0; $iCart < count($cart['items']); $iCart++) {
                 $i = $iCart + 1;
                 $paymentObject->addField("item_number_" . $i, $cart['items'][$iCart]['itemId']);
                 $paymentObject->addField("item_name_" . $i, $cart['items'][$iCart]['item_name']);
                 //nama barang [documentName]
                 $paymentObject->addField("amount_" . $i, $cart['items'][$iCart]['itemPrice']);
                 //harga satuan [price]
                 $paymentObject->addField("quantity_" . $i, $cart['items'][$iCart]['qty']);
                 //jumlah barang [qty]\
             }
             $paymentObject->addField('tax_cart', $cart['taxAmount']);
             $paymentObject->addField('currency_code', $this->_defaultCurrency);
             //$paymentObject->addField('custom',$_SESSION['_orderIdNumber']);
             $paymentObject->addField('custom', $this->_orderIdNumber);
             $ivnum = $this->updateInvoiceMethod('paypal', 1, 0, 'paid with paypal method');
             //$paymentObject->dumpFields();
             $paymentObject->submitPayment();
             //setting payment and status as pending (1), notify = 0, notes = 'paid with...'
             break;
         case '2co':
             /*
             require_once('PaymentGateway/TwoCo.php');  
             $paymentObject = new TwoCo;
             $paymentAccount=$this->paymentVars->twoco->business;
             $paymentNotifyUrl=$this->paymentVars->returnUrl;
             $paymentObject->addField('sid', 'YOUR_VENDOR_ID');
             $paymentObject->addField('x_Receipt_Link_URL', 'http://YOUR_HOST/payment/twoco_ipn.php');
             $paymentObject->addField('tco_currency', 'USD');                
             
             $paymentObject->addField('cart_order_id', rand(1, 100));
             $paymentObject->addField('total', '9.99');
             
             // Specify the url where authorize.net will send the IPN                
             $paymentObject->addField('custom', 'muri');
             
             // Enable test mode if needed
             if($this->testMode)$paymentObject->enableTestMode();
             $paymentObject->dumpFields();
             // Let's start the train!
             $paymentObject->submitPayment();
             */
             break;
         case 'postpaid':
             /*
              1. validate POSTPAID status of the client 
              2. validate CREDIT LIMIT (per user) with current Outstanding Bill + New Bill
              3. update order status
              4. redirect to success or failed 
             */
             /*
              * if userid isn't listed as postpaid user will be redirected
              */
             if (!$this->_userInfo->isPostPaid) {
                 echo 'Not Post Paid Customer';
                 //$paymentObject->submitPayment();
                 return $this->_helper->redirector('notpostpaid');
//.........这里部分代码省略.........
开发者ID:psykomo,项目名称:kutump-enhanced,代码行数:101,代码来源:PaymentController.php

示例7: espresso_display_paypal

function espresso_display_paypal($payment_data)
{
    extract($payment_data);
    global $wpdb;
    include_once 'Paypal.php';
    $myPaypal = new Paypal();
    echo '<!-- Event Espresso PayPal Gateway Version ' . $myPaypal->gateway_version . '-->';
    global $org_options;
    $paypal_settings = get_option('event_espresso_paypal_settings');
    $paypal_id = empty($paypal_settings['paypal_id']) ? '' : $paypal_settings['paypal_id'];
    $paypal_cur = empty($paypal_settings['currency_format']) ? '' : $paypal_settings['currency_format'];
    $no_shipping = isset($paypal_settings['no_shipping']) ? $paypal_settings['no_shipping'] : '0';
    $use_sandbox = $paypal_settings['use_sandbox'];
    if ($use_sandbox) {
        $myPaypal->enableTestMode();
    }
    $myPaypal->addField('business', $paypal_id);
    $myPaypal->addField('return', home_url() . '/?page_id=' . $org_options['return_url'] . '&id=' . $attendee_id);
    $myPaypal->addField('cancel_return', home_url() . '/?page_id=' . $org_options['cancel_return']);
    $myPaypal->addField('notify_url', home_url() . '/?page_id=' . $org_options['notify_url'] . '&id=' . $attendee_id . '&event_id=' . $event_id . '&attendee_action=post_payment&form_action=payment');
    $event_name = $wpdb->get_var('SELECT event_name FROM ' . EVENTS_DETAIL_TABLE . " WHERE id='" . $event_id . "'");
    $myPaypal->addField('cmd', '_cart');
    $myPaypal->addField('upload', '1');
    $i = 1;
    $sql = "SELECT attendee_session FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id='" . $attendee_id . "'";
    $session_id = $wpdb->get_var($sql);
    $sql = "SELECT amount_pd FROM " . EVENTS_ATTENDEE_TABLE . " WHERE attendee_session='" . $session_id . "'";
    $amount_pds = $wpdb->get_col($sql);
    $cost = 0;
    foreach ($amount_pds as $amount_pd) {
        $cost += $amount_pd;
    }
    $myPaypal->addField('item_name_' . $i, $event_name);
    $myPaypal->addField('amount_' . $i, $cost);
    $myPaypal->addField('quantity_' . $i, '1');
    $myPaypal->addField('currency_code', $paypal_cur);
    $myPaypal->addField('image_url', empty($paypal_settings['image_url']) ? '' : $paypal_settings['image_url']);
    $myPaypal->addField('no_shipping ', $no_shipping);
    $myPaypal->addField('first_name', $fname);
    $myPaypal->addField('last_name', $lname);
    $myPaypal->addField('email', $attendee_email);
    $myPaypal->addField('address1', $address);
    $myPaypal->addField('city', $city);
    $myPaypal->addField('state', $state);
    $myPaypal->addField('zip', $zip);
    if (!empty($paypal_settings['bypass_payment_page']) && $paypal_settings['bypass_payment_page'] == 'Y') {
        $myPaypal->submitPayment();
    } else {
        if (empty($paypal_settings['button_url'])) {
            if (file_exists(EVENT_ESPRESSO_GATEWAY_DIR . "/paypal/btn_stdCheckout2.gif")) {
                $button_url = EVENT_ESPRESSO_GATEWAY_DIR . "/paypal/btn_stdCheckout2.gif";
            } else {
                $button_url = EVENT_ESPRESSO_PLUGINFULLURL . "gateways/paypal/btn_stdCheckout2.gif";
            }
        } elseif (file_exists($paypal_settings['button_url'])) {
            $button_url = $paypal_settings['button_url'];
        } else {
            $button_url = EVENT_ESPRESSO_PLUGINFULLURL . "gateways/paypal/btn_stdCheckout2.gif";
        }
        $myPaypal->submitButton($button_url, 'paypal');
    }
    if ($use_sandbox) {
        echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('Paypal Debug Mode Is Turned On', 'event_espresso') . '</h3>';
        $myPaypal->dump_fields();
    }
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:66,代码来源:paypal_vars.php

示例8:

    }
}
$place_order['payment_currency'] = $currencyCode;
// Specify the currency
if (isset($place_order['payment_currency']) and $place_order['payment_currency'] != false) {
    $myPaypal->addField('currency_code', $place_order['payment_currency']);
} else {
    $myPaypal->addField('currency_code', 'USD');
}
// Specify the url where paypal will send the user on success/failure
$myPaypal->addField('return', $mw_return_url);
$myPaypal->addField('cancel_return', $mw_cancel_url);
// Specify the url where paypal will send the IPN
$myPaypal->addField('notify_url', $mw_ipn_url);
// Specify the product information
$myPaypal->addField('item_name', $place_order['item_name']);
$myPaypal->addField('amount', $place_order['payment_amount']);
$myPaypal->addField('shipping', $place_order['payment_shipping']);
//$myPaypal->addField('item_number', $cart['session_id']);
// Specify any custom value
$myPaypal->addField('total_items', $place_order['items_count']);
// Enable test mode if needed
$paypal_is_test = get_option('paypalexpress_testmode', 'payments') == 'y';
if ($paypal_is_test == true) {
    $myPaypal->enableTestMode();
}
// Let's start the train!
$place_order['order_completed'] = 1;
$place_order['is_paid'] = 0;
$place_order['success'] = $myPaypal->submitPayment();
开发者ID:newaltcoin,项目名称:microweber,代码行数:30,代码来源:process.php

示例9: paypal_form

 /**
  * Shows the paypal button after new post
  *
  * @param type $type
  * @param type $post_id
  * @param type $pack_id
  * @param type $display
  * @return type
  */
 public function paypal_form($type = 'post', $post_id = 0, $pack_id = 0, $display = false)
 {
     // Include the paypal library
     include_once dirname(__FILE__) . '/lib/payment/Paypal.php';
     //var_dump( $type, $post_id, $pack_id ); exit;
     $email = get_option('wpuf_sub_paypal_mail');
     $curreny = get_option('wpuf_sub_currency');
     $amount = 0;
     if ($type == 'post') {
         $post = get_post($post_id);
         $amount = get_option('wpuf_sub_amount');
         $item_name = $post->post_title;
         $item_number = get_post_meta($post_id, 'wpuf_order_id', true);
         $custom = 'post';
         $cbt = sprintf(__('Click here to complete the pack on %s', 'wpuf'), get_bloginfo('name'));
     }
     if ($type == 'pack') {
         $pack = $this->get_subscription($pack_id);
         if ($pack) {
             $amount = $pack->cost;
             $item_name = $pack->name;
             $item_number = $pack->id;
             $custom = 'pack';
             $cbt = sprintf(__('Click here to complete the pack on %s', 'wpuf'), get_bloginfo('name'));
         }
     }
     // Create an instance of the paypal library
     $myPaypal = new Paypal();
     // Specify your paypal email
     $myPaypal->addField('business', $email);
     // Specify the currency
     $myPaypal->addField('currency_code', $curreny);
     // Specify the url where paypal will send the user on success/failure
     $myPaypal->addField('return', get_bloginfo('home') . '/?action=wpuf_pay_success');
     $myPaypal->addField('cancel_return', get_bloginfo('home'));
     // Specify the url where paypal will send the IPN
     $myPaypal->addField('notify_url', get_bloginfo('home') . '/?action=wpuf_pay_success');
     // Specify the product information
     $myPaypal->addField('item_name', $item_name);
     $myPaypal->addField('amount', $amount);
     $myPaypal->addField('item_number', $item_number);
     // Specify any custom value
     $myPaypal->addField('custom', $custom);
     $myPaypal->addField('cbt', $cbt);
     // Enable test mode if needed
     if (get_option('wpuf_sub_paypal_sandbox') == 'yes') {
         $myPaypal->enableTestMode();
     }
     // Let's start the train!
     $form = $myPaypal->submitPayment();
     return $form;
 }
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:61,代码来源:wpuf-subscription.php


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