Paypal: Transaction History with REST API / Nodejs

2019-08-02 14:19发布

I would like to display all the inbound/outbound transactions a user made/received to display it in a simple html list.

I'm using the recommended node.js module https://github.com/paypal/rest-api-sdk-nodejs and I'm trying to use this code to get the transactions:

    // Get Transaction History
    paypal.payment.list({ 
        'count': 100,
        'sort_by':'create_time',
        'sort_order': 'asc',
        'start_time': '2008-03-06T11:00:00Z'
    }, function(error, payment_history){
        if(error){
            console.error('error', error);
            response.data.payment_history = {};
        } else {
            console.log('history', payment_history);
            response.data.payment_history = payment_history;
        }
        response.finish();
    });

but payment_history gives me { count: 0 }. I'm pretty sure that I have transactions since 2008.

I'm not really sure what's the problem. The user is already logged in using the access_token and I can display user informations but I have no idea how to pull transaction informations.

2条回答
姐就是有狂的资本
2楼-- · 2019-08-02 14:49

Look into https://developer.paypal.com/docs/faq/#general-developer-questions for the answer to "Can I retrieve the history of transactions created using the Classic APIs using the REST API?".

查看更多
我只想做你的唯一
3楼-- · 2019-08-02 15:01

I also ran into this issue. Strangely, It seems that the PayPal REST API only returns results for payments made through the REST API. See here: https://stackoverflow.com/a/18139747

Classic API will remain the way to do this until the REST API is improved.

查看更多
登录 后发表回答