Searching for invoices with Paypal-PHP-SDK fails

66 views Asked by At

I'm unable to search for invoices based on the invoice status. I have tried the following:

        //$searchString = '[{
        //                  "status" : "SENT",
        //                  "page" : 0,
        //                  "page_size" : 0,
        //                  "total_count_required" : true
        //                 }]';

This above search string returns http response 500.

        $searchString = '{
                          "status" : "SENT",
                          "page" : 0,
                          "page_size" : 0,
                          "total_count_required" : "true"
                         }';

This above search string returns "{"name":"VALIDATION_ERROR","message":"Invalid request - see details.","debug_id":"e8b3b40ca05f4","details":[{"field":"status","issue":"Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token at line:1, column:2"}]}".

        //$searchString = '{
        //                  "page" : 0,
        //                  "page_size" : 0,
        //                  "total_count_required" : true
        //                 }';

The above search string returns all invoices.

        $search = new Search($searchString);

        $invoices = Invoice::search($search, $apiContext);

Has anyone been able to search based on invocie status?

Thanks Jim

1

There are 1 answers

0
Joel Johnson On

Just ran into this issue myself. Its probably a little late for @Jim but the answer was to put the stats in an array. This way you can query multiple status.

"status" : ["SENT"],

or for mulitiple

"status" : ["SENT", "PAID"],

Hope this helps someone