GetRecurringPaymentsProfileDetails - ACK =失败

时间:2015-12-10 04:02:35

标签: paypal paypal-sandbox

我有代码GetRecurringPaymentsProfileDetails ...哪里错了? // ------------------------------------------------ -------------------------------------------------- -------------------------------------------------- ----

public function callNVP($profileId) {
        $api_request = '&USER=' . urlencode('bestlifeXXXXX.gmaill.com')
                . '&PWD=' . urlencode('136XXXXXXX')
                . '&SIGNATURE=' . urlencode('XXXXXXXXJJJ4qi4-ASVptjmiE8Sqp4tXXXXXXCa')
                . '&VERSION=76.0'
                . '&METHOD =GetRecurringPaymentsProfileDetails'
                . '&PROFILEID=' . urlencode($profileId);
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'https://api-3t.sandbox.paypal.com/nvp'); // For live transactions, change to 'https://api-3t.paypal.com/nvp'
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        //curl_setopt($ch, CURLOPT_HEADER, FALSE);
        // Uncomment these to turn off server and peer verification
        //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);

        // Set the API parameters for this transaction
        //curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $api_request);

        // Request response from PayPal
        $response = curl_exec($ch);

        // If no response was received from PayPal there is no point parsing the response
        if (!$response)
            die('Calling PayPal to change_subscription_status failed: ' . curl_error($ch) . '(' . curl_errno($ch) . ')');

        curl_close($ch);

        // An associative array is more usable than a parameter string
        parse_str($response, $parsed_response);

        return $parsed_response;
    }

但是它的结果是:

Array
(
    [0] => Array
        (
            [TIMESTAMP] => 2015-12-10T03:49:09Z
            [CORRELATIONID] => cb2489449e84c
            [ACK] => Failure
            [L_ERRORCODE0] => 10001
            [L_SHORTMESSAGE0] => Internal Error
            [L_LONGMESSAGE0] => Timeout processing request
        )

)

我想要的是:

(
    [PROFILEID] => I-CL7Kxxx
    [STATUS] => Active
    [AUTOBILLOUTAMT] => AddToNextBilling
    [DESC] => xxx
    [MAXFAILEDPAYMENTS] => 2
    [SUBSCRIBERNAME] => Dan
    [PROFILESTARTDATE] => 2013-05-15T07:00:00Z
    [PROFILEREFERENCE] => 31571
    [NEXTBILLINGDATE] => 2013-05-16T10:00:00Z
    [NUMCYCLESCOMPLETED] => 1
    [NUMCYCLESREMAINING] => 18446744073709551615
    [OUTSTANDINGBALANCE] => 0.00
    [FAILEDPAYMENTCOUNT] => 0
    [LASTPAYMENTDATE] => 2013-05-15T14:52:04Z
    [LASTPAYMENTAMT] => 0.10
    [TRIALAMTPAID] => 0.00
    [REGULARAMTPAID] => 0.10
    [AGGREGATEAMT] => 0.10
    [AGGREGATEOPTIONALAMT] => 0.00
    [FINALPAYMENTDUEDATE] => 1970-01-01T00:00:00Z
    [TIMESTAMP] => 2013-05-15T14:55:58Z
    [CORRELATIONID] => 225681xxx
    [ACK] => Success
    [VERSION] => 64
    [BUILD] => 5908853
    [SHIPTOSTREET] => xxx
    [SHIPTOCITY] => xxx
    [SHIPTOSTATE] => CA
    [SHIPTOZIP] => xxx
    [SHIPTOCOUNTRYCODE] => US
    [SHIPTOCOUNTRY] => US
    [SHIPTOCOUNTRYNAME] => United States
    [SHIPADDRESSOWNER] => PayPal
    [SHIPADDRESSSTATUS] => Unconfirmed
    [BILLINGPERIOD] => Day
    [BILLINGFREQUENCY] => 1
    [TOTALBILLINGCYCLES] => 0
    [CURRENCYCODE] => USD
    [AMT] => 0.10
    [SHIPPINGAMT] => 0.00
    [TAXAMT] => 0.00
    [REGULARBILLINGPERIOD] => Day
    [REGULARBILLINGFREQUENCY] => 1
    [REGULARTOTALBILLINGCYCLES] => 0
    [REGULARCURRENCYCODE] => USD
    [REGULARAMT] => 0.10
    [REGULARSHIPPINGAMT] => 0.00
    [REGULARTAXAMT] => 0.00
)

谁能帮帮我?请...

2 个答案:

答案 0 :(得分:0)

你有这个:

'&METHOD =GetRecurringPaymentsProfileDetails'

我认为那里的空间导致无效请求。试试这个:

'&METHOD=GetRecurringPaymentsProfileDetails'

答案 1 :(得分:0)

肯定是因为您的API请求(我猜测其不正确的个人资料ID

您可以在浏览器中尝试(单击)以下链接(替换API凭据,配置文件ID)

https://api-3t.sandbox.paypal.com/nvp?&user=xxxxxxxxxx&pwd=xxxxxxxxxx&signature=xxxxxxxxxx&VERSION=109.0&METHOD=GetRecurringPaymentsProfileDetails&PROFILEID=I-XXXXXXXXXXXX

看看你得到了什么回应。

我使用内部错误,当我使用" I-XXXXXXXXXXXX"作为个人资料ID。