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


PHP Paypal::httpPost方法代码示例

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


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

示例1: dgButton

    public static function dgButton($amount = '0.00', $description = '', $itemnumber = '101', $extra_array = null)
    {
        $extra = payment_prepare_custom($extra_array);
        $r = rand(0, 1000);
        $extra .= 'random,' . $r;
        $APIUSERNAME = payment_decrypt(osc_get_preference('paypal_api_username', 'payment'));
        $APIPASSWORD = payment_decrypt(osc_get_preference('paypal_api_password', 'payment'));
        $APISIGNATURE = payment_decrypt(osc_get_preference('paypal_api_signature', 'payment'));
        if (osc_get_preference('paypal_sandbox', 'payment') == 1) {
            $ENDPOINT = 'https://api-3t.sandbox.paypal.com/nvp';
        } else {
            $ENDPOINT = 'https://api-3t.paypal.com/nvp';
        }
        $VERSION = '65.1';
        // must be >= 65.1
        $REDIRECTURL = 'https://www.paypal.com/incontext?token=';
        if (osc_get_preference('paypal_sandbox', 'payment') == 1) {
            $REDIRECTURL = "https://www.sandbox.paypal.com/incontext?token=";
        }
        //Build the Credential String:
        $cred_str = 'USER=' . $APIUSERNAME . '&PWD=' . $APIPASSWORD . '&SIGNATURE=' . $APISIGNATURE . '&VERSION=' . $VERSION;
        //For Testing this is hardcoded. You would want to set these variable values dynamically
        $nvp_str = "&METHOD=SetExpressCheckout" . '&RETURNURL=' . osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__) . 'return.php?extra=' . $extra . '&CANCELURL=' . osc_base_url() . 'oc-content/plugins/' . osc_plugin_folder(__FILE__) . 'cancel.php?extra=' . $extra . '&PAYMENTREQUEST_0_CURRENCYCODE=' . osc_get_preference('currency', 'payment') . '&PAYMENTREQUEST_0_AMT=' . $amount . '&PAYMENTREQUEST_0_ITEMAMT=' . $amount . '&PAYMENTREQUEST_0_TAXAMT=0' . '&PAYMENTREQUEST_0_DESC=' . $description . '&PAYMENTREQUEST_0_PAYMENTACTION=Sale' . '&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital' . '&L_PAYMENTREQUEST_0_NAME0=' . $description . '&L_PAYMENTREQUEST_0_NUMBER0=' . $itemnumber . '&L_PAYMENTREQUEST_0_QTY0=1' . '&L_PAYMENTREQUEST_0_TAXAMT0=0' . '&L_PAYMENTREQUEST_0_AMT0=' . $amount . '&L_PAYMENTREQUEST_0_DESC0=Download' . '&CUSTOM=' . $extra . '&useraction=commit';
        //combine the two strings and make the API Call
        $req_str = $cred_str . $nvp_str;
        $response = Paypal::httpPost($ENDPOINT, $req_str);
        //check Response
        if ($response['ACK'] == "Success" || $response['ACK'] == "SuccessWithWarning") {
            //setup redirect URL
            $redirect_url = $REDIRECTURL . urldecode($response['TOKEN']);
            ?>
                <a href="<?php 
            echo $redirect_url;
            ?>
" id='paypalBtn_<?php 
            echo $r;
            ?>
'>
                    <img src='<?php 
            echo payment_url();
            ?>
payments/paypal/paypal.gif' border='0' />
                </a>
                <script>
                    var dg_<?php 
            echo $r;
            ?>
 = new PAYPAL.apps.DGFlow({
                        trigger: "paypalBtn_<?php 
            echo $r;
            ?>
"
                    });
                </script><?php 
        } else {
            if ($response['ACK'] == 'Failure' || $response['ACK'] == 'FailureWithWarning') {
                $redirect_url = '';
                //SOMETHING FAILED
            }
        }
    }
开发者ID:syedfiraat4,项目名称:bikade.com,代码行数:61,代码来源:Paypal.php

示例2: urldecode

 if (osc_get_preference('paypal_sandbox', 'payment') == 1) {
     $ENDPOINT = 'https://api-3t.sandbox.paypal.com/nvp';
 }
 $VERSION = '65.1';
 //must be >= 65.1
 //Build the Credential String:
 $cred_str = 'USER=' . $APIUSERNAME . '&PWD=' . $APIPASSWORD . '&SIGNATURE=' . $APISIGNATURE . '&VERSION=' . $VERSION;
 //Build NVP String for GetExpressCheckoutDetails
 $nvp_str = '&METHOD=GetExpressCheckoutDetails&TOKEN=' . urldecode($token);
 //combine the two strings and make the API Call
 $req_str = $cred_str . $nvp_str;
 $response = Paypal::httpPost($ENDPOINT, $req_str);
 //based on the API Response from GetExpressCheckoutDetails
 $doec_str = $cred_str . '&METHOD=DoExpressCheckoutPayment' . '&TOKEN=' . $token . '&PAYERID=' . $payerid . '&PAYMENTREQUEST_0_CURRENCYCODE=' . urldecode($response['PAYMENTREQUEST_0_CURRENCYCODE']) . '&PAYMENTREQUEST_0_AMT=' . urldecode($response['PAYMENTREQUEST_0_AMT']) . '&PAYMENTREQUEST_0_ITEMAMT=' . urldecode($response['PAYMENTREQUEST_0_ITEMAMT']) . '&PAYMENTREQUEST_0_TAXAMT=' . urldecode($response['PAYMENTREQUEST_0_TAXAMT']) . '&PAYMENTREQUEST_0_DESC=' . urldecode($response['PAYMENTREQUEST_0_DESC']) . '&PAYMENTREQUEST_0_PAYMENTACTION=Sale' . '&L_PAYMENTREQUEST_0_ITEMCATEGORY0=' . urldecode($response['L_PAYMENTREQUEST_0_ITEMCATEGORY0']) . '&L_PAYMENTREQUEST_0_NAME0=' . urldecode($response['L_PAYMENTREQUEST_0_NAME0']) . '&L_PAYMENTREQUEST_0_NUMBER0=' . urldecode($response['L_PAYMENTREQUEST_0_NUMBER0']) . '&L_PAYMENTREQUEST_0_QTY0=' . urldecode($response['L_PAYMENTREQUEST_0_QTY0']) . '&L_PAYMENTREQUEST_0_TAXAMT0=' . urldecode($response['L_PAYMENTREQUEST_0_TAXAMT0']) . '&L_PAYMENTREQUEST_0_AMT0=' . urldecode($response['L_PAYMENTREQUEST_0_AMT0']) . '&L_PAYMENTREQUEST_0_DESC0=' . urldecode($response['L_PAYMENTREQUEST_0_DESC0']) . '&NOTIFYURL=';
 //make the DoEC Call:
 $doresponse = Paypal::httpPost($ENDPOINT, $doec_str);
 $status = Paypal::processDGPayment($doresponse, $response);
 $product_type = explode('x', urldecode($response['L_PAYMENTREQUEST_0_NUMBER0']));
 if ($status == PAYMENT_COMPLETED || $status == PAYMENT_ALREADY_PAID) {
     osc_add_flash_ok_message(__('Payment processed correctly', 'payment'));
     if ($product_type[0] == '101') {
         $item = Item::newInstance()->findByPrimaryKey($product_type[2]);
         $category = Category::newInstance()->findByPrimaryKey($item['fk_i_category_id']);
         View::newInstance()->_exportVariableToView('category', $category);
         $html = '<p>' . __('Payment processed correctly', 'payment') . ' <a href=\\"' . osc_search_category_url() . '\\">' . __('Click here to continue', 'payment') . '</a></p>';
         $url = osc_search_category_url();
     } else {
         if ($product_type[0] == '201') {
             $html = '<p>' . __('Payment processed correctly', 'payment') . ' <a href=\\"' . payment_js_redirect_to(osc_route_url('payment-user-menu')) . '\\">' . __("Click here to continue", 'payment') . '</a></p>';
             $url = payment_js_redirect_to(osc_route_url('payment-user-menu'));
         } else {
开发者ID:virsoni,项目名称:plugin-payment,代码行数:31,代码来源:return.php


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