2015-11-23 129 views
0

禁止货运详细选项,我在我的网站使用PayPal支付使用PayPal Integration Wizard ,我想禁用送货细节。我应该在哪个文件中做出什么改变?在PayPal支付

更新 这是我expresscheckout文件,我已经发布了由paypalfunctions.php的部分为好。

expresscheckout.php

<?php 

require_once ("paypalfunctions.php"); 
$_SESSION["Payment_Amount"] = $_POST["Payment_Amount"]; 
// ================================== 
// PayPal Express Checkout Module 
// ================================== 

//'------------------------------------ 
//' The paymentAmount is the total value of 
//' the shopping cart, that was set 
//' earlier in a session variable 
//' by the shopping cart page 
//'------------------------------------ 
$paymentAmount = $_SESSION["Payment_Amount"]; 

//'------------------------------------ 
//' The currencyCodeType and paymentType 
//' are set to the selections made on the Integration Assistant 
//'------------------------------------ 
$currencyCodeType = "USD"; 
$paymentType = "Sale"; 

//'------------------------------------ 
//' The returnURL is the location where buyers return to when a 
//' payment has been succesfully authorized. 
//' 
//' This is set to the value entered on the Integration Assistant 
//'------------------------------------ 
$returnURL = "http://localhost/Reg/Components/PayPal/billinghandler.php"; 

//'------------------------------------ 
//' The cancelURL is the location buyers are sent to when they hit the 
//' cancel button during authorization of payment during the PayPal flow 
//' 
//' This is set to the value entered on the Integration Assistant 
//'------------------------------------ 
$cancelURL = "http://localhost/Reg/Portal/SecretaryProfile.php"; 

//'------------------------------------ 
//' Calls the SetExpressCheckout API call 
//' 
//' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php, 
//' it is included at the top of this file. 
//'------------------------------------------------- 
$resArray = CallShortcutExpressCheckout ($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL); 
$ack = strtoupper($resArray["ACK"]); 
if($ack=="SUCCESS" || $ack=="SUCCESSWITHWARNING") 
{ 
    RedirectToPayPal ($resArray["TOKEN"]); 
} 
else 
{ 
    //Display a user friendly Error on the page using any of the following error information returned by PayPal 
    $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); 
    $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); 
    $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]); 
    $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]); 

    echo "SetExpressCheckout API call failed. "; 
    echo "Detailed Error Message: " . $ErrorLongMsg; 
    echo "Short Error Message: " . $ErrorShortMsg; 
    echo "Error Code: " . $ErrorCode; 
    echo "Error Severity Code: " . $ErrorSeverityCode; 
} 
?> 

一部分从paypalfunctions.php

function hash_call($methodName,$nvpStr) 
    { 
     //declaring of global variables 
     global $API_Endpoint, $version, $API_UserName, $API_Password, $API_Signature; 
     global $USE_PROXY, $PROXY_HOST, $PROXY_PORT; 
     global $gv_ApiErrorURL; 
     global $sBNCode; 

     //setting the curl parameters. 
     $ch = curl_init(); 
     curl_setopt($ch, CURLOPT_URL,$API_Endpoint); 
     curl_setopt($ch, CURLOPT_VERBOSE, 1); 

     //turning off the server and peer verification(TrustManager Concept). 
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 

     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
     curl_setopt($ch, CURLOPT_POST, 1); 

     //if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled. 
     //Set proxy name to PROXY_HOST and port number to PROXY_PORT in constants.php 
     if($USE_PROXY) 
      curl_setopt ($ch, CURLOPT_PROXY, $PROXY_HOST. ":" . $PROXY_PORT); 

     //NVPRequest for submitting to server 
     $nvpreq="METHOD=" . urlencode($methodName) . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode); 

     //setting the nvpreq as POST FIELD to curl 
     curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq); 

     //getting response from server 
     $response = curl_exec($ch); 

     //convrting NVPResponse to an Associative Array 
     $nvpResArray=deformatNVP($response); 
     $nvpReqArray=deformatNVP($nvpreq); 
     $_SESSION['nvpReqArray']=$nvpReqArray; 

     if (curl_errno($ch)) 
     { 
      // moving to display page to display curl errors 
       $_SESSION['curl_error_no']=curl_errno($ch) ; 
       $_SESSION['curl_error_msg']=curl_error($ch); 

       //Execute the Error handling module to display errors. 
     } 
     else 
     { 
      //closing the curl 
      curl_close($ch); 
     } 

     return $nvpResArray; 
    } 
+0

在此处发布生成请求的代码部分,我会相应地为您调整它。 –

+0

我下载了expresscheckout.php文件和paypalfunctions.php,并将其他代码保存在billinghandler.php,paymentreview.php和paymentconfirm.php中。哪些文件的哪些部分应该被编辑? –

+0

很难说,没有看到这一切。我个人不喜欢PayPal提供的集成向导。我建立了我自己的[PayPal PHP SDK](https://www.angelleye.com/product/paypal-sdk-php/),我已经使用了多年,甚至他们自己的集成工程师也更喜欢它。你可能想看看它,因为它会使API调用非常快速和容易。至于目前的问题,我猜可能是在expresscheckout.php。它应该建立API请求参数。 –

回答

0

解决。在paypalfunctions.php文件中的hash_call函数中,提交给服务器的NVPRequest应该通过传递NOSHIPPING = 1作为参数进行更新,如下所示。

//NVPRequest for submitting to server 
$nvpreq="METHOD=" . urlencode($methodName) ."&NOSHIPPING=1" . "&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER=" . urlencode($API_UserName) . "&SIGNATURE=" . urlencode($API_Signature) . $nvpStr . "&BUTTONSOURCE=" . urlencode($sBNCode);