REST API - List plans

davidelucchelli
Contributor
Contributor

Hi,

I'm trying to get my billing plans list using REST API. 

I'm making a GET call to this url: https://api.sandbox.paypal.com/v1/payments/billing-plans?page_size=3&status=ACTIVE&page_size=2&page=..., but the response is empty. 

 

What's the problem? If I fill a param with a wrong value (i.e. status=FOO) I get the right json error.

 

Thanks a lot,

Davide

Login to Me Too
3 REPLIES 3

MTS_Ciaran
Moderator
Moderator

Do you mean the response doesnt contain any billing plans or that you don't get any info at all in the response?

 

Is it possible that you are using the wrong client ID, as in you're using a client ID for a sandbox account that doesnt have any billing plans?

 

Can you post the API response you get, including debug ID's?

Login to Me Too

davidelucchelli
Contributor
Contributor

Hi, 

thanks for the answer. 

 

The response in empty, an empty string.  If I force an error, for example using "ACTIVEEE" as "status" param, I get the json error I expect:

 

{

  "debug_id" : "e21c448a72218",

  "details" : [

    {

      "field" : "status",

      "issue" : "Invalid status, valid values are CREATED, ACTIVE, INACTIVE"

    }

  ],

  "information_link" : "https://developer.paypal.com/docs/api/payments.billing-plans#errors",

  "message" : "Invalid request. See details.",

  "name" : "VALIDATION_ERROR"

}

 

But if I use the correct value for the params I get an empty string.

 

Thanks,

Davide

 

Login to Me Too

davidelucchelli
Contributor
Contributor

Hi,

I found the problem. The sample request posted in the documentation is: 

 

curl -v -X GET https://api.sandbox.paypal.com/v1/payments/billing-plans?page_size=3&status=ALL&page_size=2&page=1&total_required=yes \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Access-Token"

This call has 3 problem:

 

1. There are 2 "page_size" params 

2. The status "ALL" is not a valid value for the param

3. Pagination starts from page 0, not page 1. If I use "page=1" I get an empty string as response. If I use "page=0"  I get the correct json with billing plans list. 

 

Good afternoon,

Davide 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.