Api Mercado Pago - Inconsistencia en / collections / search

1

The Mercado Pago API is not returning data when the external_reference parameter is indicated.

Testing the following by console:

/collections/search?external_reference=2016-11-renovar-abono-7761&range=date_created&begin_date=2016-10-01T00%3A00%3A00.000-03%3A00&end_date=2017-02-01T23%3A59%3A59.000-03%3A00&offset=0&limit=0&access_token=[eltoken]

Return:

    {
    "paging": {
        "total": 4,
        "limit": 0,
        "offset": 0
    },
    "results": []
}

This call should return at least one movement and the proof of it is given when I execute the same but without external_reference :

/collections/search?range=date_created&begin_date=2016-10-01T00%3A00%3A00.000-03%3A00&end_date=2017-02-01T23%3A59%3A59.000-03%3A00&offset=0&limit=0&access_token=[eltoken]

Return:

    {
    "paging": {
        "total": 1,
        "limit": 10,
        "offset": 0
    },
    "results": [{
        "collection": {
            "id": 2471392144,
            "site_id": "MLA",
            "date_created": "2016-12-01T13:27:58.000-04:00",
            "date_approved": null,
            "last_modified": "2016-12-01T13:29:12.000-04:00",
            "money_release_date": null,
            "operation_type": "regular_payment",
            "collector_id": 78381283,
            "sponsor_id": null,
            "payer": { ... },
            "external_reference": "2016-11-renovar-abono-7761",
            ...
        }
    }]
}

How can I get the result to return the external_reference?

Edited

  • Using the SDK for PHP version 0.5.2

  • Method $ api-> search_payment

  • The uri generated by this method is /collections/search?external_reference=2016-11-renovate-abono-7761&range=date_created&begin_date=2016-10-03T00%3A00%3A00.000-03% 3A00 & end_date = 2017-02-03T23% 3A59% 3A59.000-03% 3A00 & offset = 0 & limit = 0

asked by Alejandro Fiore 01.02.2017 в 20:08
source

2 answers

1

Found the problem, there is inconsistency in the handling of the limit parameter when indicated or not external_reference .

If we do not clarify the limit parameter, the PHP SDK 0.5.2 will default to the value 0 (zero), which I interpret as "no limit".

Now, if this parameter is 0 and we specify a external_reference we can see in the output that paging has limit = 0 , instead if we do not specify external_reference the output returns limit = 10 .

Since until recently he always returned results without clarifying the limit, I suppose they made some change in the API and now the limit parameter is interpreted differently.

    
answered by 03.02.2017 / 13:10
source
-1

Apparently you do not have that registered payment, maybe you did it using a test access_token or you are working in sandbox, and the search is done on production, the following request:

/collections/search?begin_date=2015-2-2T00:00:00.001-04:00&end_date=2017-2-2T23:59:59.999-04: 00 & access_token = [eltoken] & external_reference = 500-1423-1-1-NTAw

Return:

{
    "paging": {
        "limit": 30,
        "offset": 0,
        "total": 1
    },
    "results": [
       {
         "collection": {
           ...
           "external_reference": "500-1423-1-1-NTAw"
           ...
         ]
    }
}

From what I understand, that search by external_reference if you are doing it.

    
answered by 02.02.2017 в 19:05