Php Paypal API交易搜索NVP-成功但无结果

Php Paypal API交易搜索NVP-成功但无结果,php,api,paypal,nvp,Php,Api,Paypal,Nvp,我正在编辑一个终极飞盘组织的网站,我是该组织的一员,当用户尝试登录时,需要验证会员费 为此,我使用了一个PHP Paypal API(NVP版本,而不是SOAP版本),它向Paypal发送一个请求(称为TransactionSearch),请求从开始日期开始使用特定的电子邮件地址进行交易。这里的问题是Paypal返回我请求成功但没有结果。如果我登录paypal网站并尝试执行相同的搜索,它会返回我想要的交易 下面是创建要发送到paypal的参数字符串和响应分析的代码 $nvpStr; //The

我正在编辑一个终极飞盘组织的网站,我是该组织的一员,当用户尝试登录时,需要验证会员费

为此,我使用了一个PHP Paypal API(NVP版本,而不是SOAP版本),它向Paypal发送一个请求(称为TransactionSearch),请求从开始日期开始使用特定的电子邮件地址进行交易。这里的问题是Paypal返回我请求成功但没有结果。如果我登录paypal网站并尝试执行相同的搜索,它会返回我想要的交易

下面是创建要发送到paypal的参数字符串和响应分析的代码

$nvpStr; //The parameters string to send to paypal (will contain the start date and the email address)

if (date('m') < 9)
    $startDateStr= '08/01/' . (date('y') - 1); //the 1st of april of last year
else
    $startDateStr= '08/01/' . date('y');       //the 1st of april this year
if(isset($startDateStr)) {
    $start_time = strtotime($startDateStr);
    $iso_start = date('Y-m-d\T00:00:00\Z',  $start_time);
    $nvpStr="&STARTDATE=$iso_start";           //we apply the format paypal requires
}

$nvpStr .= "&EMAIL=" . $_SESSION['Email']; //the user's email address

/* Make the API call to PayPal, using API signature.
   The API response is stored in an associative array called $resArray */

$resArray = PPHttpPost("TransactionSearch", $nvpStr);

/* After that we check the values returned by paypal to verify if there is a
   transaction related to this email address after the 1st of April*/
然后我为您转储一些变量:

//$nvpStr we use as the second parameter for the PPHttpPost (I hid the email address)
string(60) "&STARTDATE=2011-08-01T00:00:00Z&EMAIL=account@domain.com"

//$nvpreq we use to create the message to send to paypal (I hid the password, user and signature)
string(222) "METHOD=TransactionSearch&VERSION=51.0&PWD=XXX&USER=YYY&SIGNATURE=ZZZ&STARTDATE=2011-08-01T00:00:00Z&EMAIL=diableraph@hotmail.com"

//$resArray the response from paypal
array(5) {
    ["TIMESTAMP"]=>
    string(28) "2011%2d12%2d07T17%3a55%3a13Z"
    ["CORRELATIONID"]=>
    string(13) "8f1c9593e26c0"
    ["ACK"]=>
    string(7) "Success"
    ["VERSION"]=>
    string(6) "51%2e0"
    ["BUILD"]=>
    string(7) "2230381"
}

//$resArray the response from paypal that works when I use the sandbox (I hid the email address)
array(16) {
    ["L_TIMESTAMP0"]=>
    string(28) "2011%2d12%2d07T00%3a26%3a12Z"
    ["L_TIMEZONE0"]=>
    string(3) "GMT"
    ["L_TYPE0"]=>
    string(7) "Payment"
    ["L_EMAIL0"]=>
    string(26) "account%40domain%2ecom"
    ["L_NAME0"]=>
    string(24) "Raphael%20Royer%2dRivard"
    ["L_TRANSACTIONID0"]=>
    string(17) "25V35432PY2041246"
    ["L_STATUS0"]=>
    string(9) "Completed"
    ["L_AMT0"]=>
    string(7) "20%2e00"
    ["L_CURRENCYCODE0"]=>
    string(3) "CAD"
    ["L_FEEAMT0"]=>
    string(9) "%2d0%2e88"
    ["L_NETAMT0"]=>
    string(7) "19%2e12"
    ["TIMESTAMP"]=>
    string(28) "2011%2d12%2d07T18%3a19%3a40Z"
    ["CORRELATIONID"]=>
    string(13) "53733eef8b4e2"
    ["ACK"]=>
    string(7) "Success"
    ["VERSION"]=>
    string(6) "51%2e0"
    ["BUILD"]=>
    string(7) "2230381"
}

在我的测试中,我使用了PayPal沙盒,它非常棒(我们可以看到我们有一笔交易)。。。我不知道为什么它不能和真的一起工作。正如我们所看到的,我的信条是好的,因为它不会给我身份验证错误。

您将给我们一个代码示例,否则我们将无法提供帮助。。。在一个不相关的注释中,ultimate=amazeballs。我添加了我正在使用的代码的主要部分。我希望它能帮上忙!您希望在var_转储($resArray)中看到哪些您没有看到的内容?我的第一个想法是,Paypal认为没有必要返回任何其他交易数据,因为您已经知道交易的所有其他信息(因为您提交了交易)。我在var_dump部分添加了预期的数组。我是资金的接收者。我试图删除电子邮件过滤器,它给了我最后100笔交易(这是最大的)。所以我猜是电子邮件过滤器不起作用,但我看不出错误是在我这边还是在贝宝那边。。。我试图发送带有url编码的电子邮件(帐户%40domain.com),但没有(account@domain.com)甚至与我删除电子邮件筛选器(帐户%40domain%2ecom)时在响应中所写的内容相同,但它们都不起作用。
//$nvpStr we use as the second parameter for the PPHttpPost (I hid the email address)
string(60) "&STARTDATE=2011-08-01T00:00:00Z&EMAIL=account@domain.com"

//$nvpreq we use to create the message to send to paypal (I hid the password, user and signature)
string(222) "METHOD=TransactionSearch&VERSION=51.0&PWD=XXX&USER=YYY&SIGNATURE=ZZZ&STARTDATE=2011-08-01T00:00:00Z&EMAIL=diableraph@hotmail.com"

//$resArray the response from paypal
array(5) {
    ["TIMESTAMP"]=>
    string(28) "2011%2d12%2d07T17%3a55%3a13Z"
    ["CORRELATIONID"]=>
    string(13) "8f1c9593e26c0"
    ["ACK"]=>
    string(7) "Success"
    ["VERSION"]=>
    string(6) "51%2e0"
    ["BUILD"]=>
    string(7) "2230381"
}

//$resArray the response from paypal that works when I use the sandbox (I hid the email address)
array(16) {
    ["L_TIMESTAMP0"]=>
    string(28) "2011%2d12%2d07T00%3a26%3a12Z"
    ["L_TIMEZONE0"]=>
    string(3) "GMT"
    ["L_TYPE0"]=>
    string(7) "Payment"
    ["L_EMAIL0"]=>
    string(26) "account%40domain%2ecom"
    ["L_NAME0"]=>
    string(24) "Raphael%20Royer%2dRivard"
    ["L_TRANSACTIONID0"]=>
    string(17) "25V35432PY2041246"
    ["L_STATUS0"]=>
    string(9) "Completed"
    ["L_AMT0"]=>
    string(7) "20%2e00"
    ["L_CURRENCYCODE0"]=>
    string(3) "CAD"
    ["L_FEEAMT0"]=>
    string(9) "%2d0%2e88"
    ["L_NETAMT0"]=>
    string(7) "19%2e12"
    ["TIMESTAMP"]=>
    string(28) "2011%2d12%2d07T18%3a19%3a40Z"
    ["CORRELATIONID"]=>
    string(13) "53733eef8b4e2"
    ["ACK"]=>
    string(7) "Success"
    ["VERSION"]=>
    string(6) "51%2e0"
    ["BUILD"]=>
    string(7) "2230381"
}