Paypal 贝宝快捷结账问题

Paypal 贝宝快捷结账问题,paypal,Paypal,嗨,我正在整合贝宝与我的网站。我希望该用户在我的网站上输入他们的所有信息(信用卡信息和个人信息) 我从paypal开发者网站下载了paypalfunctions.php 我的密码是:- if(isset($_POST['submitCard'])) { $firstName =trim($_POST['firstName']); $lastName =trim($_POST['lastName']); $street =trim($_POST['street']); $city

嗨,我正在整合贝宝与我的网站。我希望该用户在我的网站上输入他们的所有信息(信用卡信息和个人信息)

我从paypal开发者网站下载了paypalfunctions.php

我的密码是:-

if(isset($_POST['submitCard']))
{
 $firstName  =trim($_POST['firstName']);
 $lastName  =trim($_POST['lastName']);
 $street   =trim($_POST['street']);
 $city   =trim($_POST['city']);
 $state   =trim($_POST['state']);
 $zip   =trim($_POST['zip']);
 $countryCode =$_POST['country'];
 $currencyCode ='USD';
 $paymentType ='Sale';
 $paymentAmount =$_POST['productPrice'];
 $creditCardType =$_POST['cardType'];
 $creditCardNumber=$_POST['cardNo'];
 $expDate  ='122015';
 $cvv2   =$_POST['cvv'];
 $returnResult=DirectPayment( $paymentType, $paymentAmount, $creditCardType, $creditCardNumber,
        $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip, 
        $countryCode, $currencyCode );
 echo '<pre>';
     print_r($returnResult);
这是错误的


我无法理解发生了什么问题。请帮助。

是否正确配置了API凭据? 如果需要,您可以转储hash_调用

如果您正在进行沙箱测试, 确保调用的端点是:
--指向“沙盒”

是否正确配置了API凭据? 如果需要,您可以转储hash_调用

如果您正在进行沙箱测试, 确保调用的端点是:
--指向“沙箱”

这里还有一些需要担心的事情:

  • 登录到开发人员站点:

  • 转到应用程序

  • 在左侧,点击“沙箱帐户”
  • 如果没有,您应该能够使用“创建帐户”按钮创建一个业务类型

  • 点击账户,选择“配置文件”,确保账户是商业类型
  • API凭据选项卡将显示您要使用的用户名/密码/签名

  • 如果在使用沙盒url时不使用沙盒帐户的凭据,则可能会出现此10002安全错误无效代码。

    这里还有一些需要担心的问题:

  • 登录到开发人员站点:

  • 转到应用程序

  • 在左侧,点击“沙箱帐户”
  • 如果没有,您应该能够使用“创建帐户”按钮创建一个业务类型

  • 点击账户,选择“配置文件”,确保账户是商业类型
  • API凭据选项卡将显示您要使用的用户名/密码/签名

  • 如果您在使用沙盒url时未使用沙盒帐户的凭据,则可能会收到此10002安全错误无效代码。

    请注意:您知道为了在自己的网站上接受信用卡信息,您需要符合PCI标准:?提醒一下:您是否知道为了在自己的网站上接受信用卡信息,您需要符合PCI标准:?并且您必须配置全局$API\u端点、$version、$API\u用户名、$API\u密码、$API\u签名;您还必须配置全局$API\u端点、$version、$API\u用户名、$API\u密码、$API\u签名;
    function DirectPayment( $paymentType, $paymentAmount, $creditCardType, $creditCardNumber,
           $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip, 
           $countryCode, $currencyCode )
     {
      //Construct the parameter string that describes DoDirectPayment
      $nvpstr = "&AMT=" . $paymentAmount;
      $nvpstr = $nvpstr . "&CURRENCYCODE=" . $currencyCode;
      $nvpstr = $nvpstr . "&PAYMENTACTION=" . $paymentType;
      $nvpstr = $nvpstr . "&CREDITCARDTYPE=" . $creditCardType;
      $nvpstr = $nvpstr . "&ACCT=" . $creditCardNumber;
      $nvpstr = $nvpstr . "&EXPDATE=" . $expDate;
      $nvpstr = $nvpstr . "&CVV2=" . $cvv2;
      $nvpstr = $nvpstr . "&FIRSTNAME=" . $firstName;
      $nvpstr = $nvpstr . "&LASTNAME=" . $lastName;
      $nvpstr = $nvpstr . "&STREET=" . $street;
      $nvpstr = $nvpstr . "&CITY=" . $city;
      $nvpstr = $nvpstr . "&STATE=" . $state;
      $nvpstr = $nvpstr . "&COUNTRYCODE=" . $countryCode;
      $nvpstr = $nvpstr . "&IPADDRESS=" . $_SERVER['REMOTE_ADDR'];
    
      $resArray=hash_call("DoDirectPayment", $nvpstr);
    
      return $resArray;
     }
    
    
     /**
       '-------------------------------------------------------------------------------------------------------------------------------------------
       * hash_call: Function to perform the API call to PayPal using API signature
       * @methodName is name of API  method.
       * @nvpStr is nvp string.
       * returns an associtive array containing the response from the server.
       '-------------------------------------------------------------------------------------------------------------------------------------------
     */
     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;
     }
    
    
        }
        ?>
    
             Array
    (
        [TIMESTAMP] => 2010-12-21T06:06:54Z
        [CORRELATIONID] => 1cafc53222e76
        [ACK] => Failure
        [VERSION] => 64
        [BUILD] => 1620725
        [L_ERRORCODE0] => 10002
        [L_SHORTMESSAGE0] => Security error
        [L_LONGMESSAGE0] => Security header is not valid
        [L_SEVERITYCODE0] => Error
    )