Php Paypal REST api计费协议搜索交易

Php Paypal REST api计费协议搜索交易,php,curl,paypal,Php,Curl,Paypal,对于我的项目,我尝试使用RESTAPI来处理定期付款。我已经建立了账单协议,一切正常,但我在搜索交易时遇到了问题 我在PHP中使用curl 这是我的代码: $url = "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transaction?start-date=2012-04-10&end-date=2014-11-18" ; curl_setopt($curl, CURL

对于我的项目,我尝试使用RESTAPI来处理定期付款。我已经建立了账单协议,一切正常,但我在搜索交易时遇到了问题

我在PHP中使用curl

这是我的代码:

$url =  "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transaction?start-date=2012-04-10&end-date=2014-11-18" ;

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_HTTPGET, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer A015zQG9wQ6uBkQE39DRk5eeBVqw67NFVx3ReErsG-80Qwg',
    'Content-Type: application/json'
));

$result = curl_exec($curl);
if(empty($result))die(curl_error($curl)); // Retourne l'erreur
else
{   // Je récupère les infos renvoyés par le serveur
    $json = json_decode($result);
    // Récupération de l'adresse de la transaction
}
curl_close($curl);

// Fin de l'agreement
当我使用脚本时,它会返回以下错误:

java.lang.NullPointerException


我不知道我的问题来自哪里;我尝试了很多不同的方法,但没有任何效果,我在
$result

中仍然有相同的响应。看起来,将url更改为:

https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N/transactions?start_date=2012-04-10和结束日期=2014-11-18

关键在于:

{
    "agreement_transaction_list": [
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Created",
            "time_stamp": "2014-11-18T18:12:58Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        },
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Suspended",
            "time_stamp": "2014-11-18T18:14:26Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        },
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Reactivated",
            "time_stamp": "2014-11-18T18:16:20Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        }
    ]
}

看起来像是将url更改为:

https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N/transactions?start_date=2012-04-10和结束日期=2014-11-18

关键在于:

{
    "agreement_transaction_list": [
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Created",
            "time_stamp": "2014-11-18T18:12:58Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        },
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Suspended",
            "time_stamp": "2014-11-18T18:14:26Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        },
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Reactivated",
            "time_stamp": "2014-11-18T18:16:20Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        }
    ]
}

看起来像是将url更改为:

https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N/transactions?start_date=2012-04-10和结束日期=2014-11-18

关键在于:

{
    "agreement_transaction_list": [
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Created",
            "time_stamp": "2014-11-18T18:12:58Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        },
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Suspended",
            "time_stamp": "2014-11-18T18:14:26Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        },
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Reactivated",
            "time_stamp": "2014-11-18T18:16:20Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        }
    ]
}

看起来像是将url更改为:

https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N/transactions?start_date=2012-04-10和结束日期=2014-11-18

关键在于:

{
    "agreement_transaction_list": [
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Created",
            "time_stamp": "2014-11-18T18:12:58Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        },
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Suspended",
            "time_stamp": "2014-11-18T18:14:26Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        },
        {
            "payer_email": "",
            "payer_name": "Test Buyer",
            "status": "Reactivated",
            "time_stamp": "2014-11-18T18:16:20Z",
            "time_zone": "GMT",
            "transaction_id": "I-8E0VJL3DEL9N",
            "transaction_type": "Recurring Payment"
        }
    ]
}

我在尝试执行付款时出现了完全相同的错误。原来我发错了网址检查URL是否正确

即:

https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transactions

而不是:


https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transaction
(+s)

我在尝试执行付款时遇到了完全相同的错误。原来我发错了网址检查URL是否正确

即:

https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transactions

而不是:


https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transaction
(+s)

我在尝试执行付款时遇到了完全相同的错误。原来我发错了网址检查URL是否正确

即:

https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transactions

而不是:


https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transaction
(+s)

我在尝试执行付款时遇到了完全相同的错误。原来我发错了网址检查URL是否正确

即:

https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transactions

而不是:


https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-8E0VJL3DEL9N//transaction
(+s)

不确定原因,但您是否尝试过使用PayPal的官方REST SDK。此外,您还可以查看此处提供的样品。它们都可以使用PayPal SDK执行。不确定原因,但您是否尝试过使用PayPal的官方REST SDK。此外,您还可以查看此处提供的样品。它们都可以使用PayPal SDK执行。不确定原因,但您是否尝试过使用PayPal的官方REST SDK。此外,您还可以查看此处提供的样品。它们都可以使用PayPal SDK执行。不确定原因,但您是否尝试过使用PayPal的官方REST SDK。此外,您还可以查看此处提供的样品。它们都可以使用PayPal SDK执行。