當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Paypal::submit_paypal_post方法代碼示例

本文整理匯總了PHP中Paypal::submit_paypal_post方法的典型用法代碼示例。如果您正苦於以下問題:PHP Paypal::submit_paypal_post方法的具體用法?PHP Paypal::submit_paypal_post怎麽用?PHP Paypal::submit_paypal_post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Paypal的用法示例。


在下文中一共展示了Paypal::submit_paypal_post方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: paymentPaypal

 function paymentPaypal($order_id, $amount = 0)
 {
     global $_ARRAYLANG;
     if (isset($_GET['result'])) {
         $result = $_GET['result'];
         switch ($result) {
             case -1:
                 // Go validate PayPal IPN
                 $this->paymentPaypalIpn($order_id, $amount);
                 die;
             case 0:
                 // Payment failed
                 break;
             case 1:
                 // The payment has been completed.
                 // The notification with result == -1 will update the order.
                 // This case only redirects the customer to the list page with
                 // an appropriate message according to the status of the order.
                 $order_state = self::GetOrderValue('order_state', $order_id);
                 if ($order_state == 1) {
                     $product_id = self::GetOrderValue('order_product', $order_id);
                     return self::getSuccessMessage($product_id);
                 } elseif ($order_state == 0) {
                     if (self::GetSettings('set_paypal_ipn') == 1) {
                         return 'alert("' . $_ARRAYLANG['TXT_EGOV_PAYPAL_IPN_PENDING'] . "\");\n";
                     }
                 }
                 break;
             case 2:
                 // Payment was cancelled
                 return 'alert("' . $_ARRAYLANG['TXT_EGOV_PAYPAL_CANCEL'] . "\");\n";
         }
         return 'alert("' . $_ARRAYLANG['TXT_EGOV_PAYPAL_NOT_VALID'] . "\");\n";
     }
     $product_id = self::getOrderValue('order_product', $order_id);
     if (empty($product_id)) {
         return 'alert("' . $_ARRAYLANG['TXT_EGOV_ERROR_UPDATING_ORDER'] . '");' . "\n";
     }
     // Prepare payment
     $paypalUriIpn = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?section=Egov&handler=paypal&result=-1";
     $paypalUriNok = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?section=Egov&handler=paypal&result=0";
     $paypalUriOk = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?section=Egov&handler=paypal&result=1";
     $objPaypal = new Paypal();
     $product_id = self::GetOrderValue('order_product', $order_id);
     if (empty($product_id)) {
         return 'alert("' . $_ARRAYLANG['TXT_EGOV_ERROR_PROCESSING_ORDER'] . "\");\n";
     }
     $product_name = self::GetProduktValue('product_name', $product_id);
     $product_amount = self::GetProduktValue('product_price', $product_id);
     $quantity = self::GetProduktValue('product_per_day', $product_id) == 'yes' ? intval($_REQUEST['contactFormField_Quantity']) : 1;
     if ($product_amount <= 0) {
         return '';
     }
     $objPaypal->add_field('business', self::GetProduktValue('product_paypal_sandbox', $product_id));
     $objPaypal->add_field('return', $paypalUriOk);
     $objPaypal->add_field('cancel_return', $paypalUriNok);
     $objPaypal->add_field('notify_url', $paypalUriIpn);
     $objPaypal->add_field('item_name', $product_name);
     $objPaypal->add_field('amount', $product_amount);
     $objPaypal->add_field('quantity', $quantity);
     $objPaypal->add_field('currency_code', self::GetProduktValue('product_paypal_currency', $product_id));
     $objPaypal->add_field('custom', $order_id);
     //die();
     $objPaypal->submit_paypal_post();
     die;
 }
開發者ID:Niggu,項目名稱:cloudrexx,代碼行數:66,代碼來源:Egov.class.php


注:本文中的Paypal::submit_paypal_post方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。