#PHP API PaymentRequest invalid limit value

1 messages · Page 1 of 1 (latest)

graceful magnet
#

So, this morning I stated the following in the coffee-chat.

Good morning... Even before my first cup of coffee this morning; "so we cannot see our paymentrequests listed, we can create them, but not get them listed. App works, but api doesn't". Update: seems that I cannot list by a limit of 100 (from = null, $limit = 100, $parameters = array()). 50 works, 250 works... Weird. Problem solved for us, still weird issue

So I went investigating the issue since status.mollie.com showed everything operting normally. I'm using the GitHub Mollie PHP package 2.73.0 (latest and 3 weeks old).

So in my code I have a constructor, constructing the MollieApiClient(), providing it with the right APIKey and then we can get started.
When I request the paymentLinks->page() everything works normally as long as I call it without parameters.
But as soon as I set the $from = null, $limit = 100, $parameters = array() it goes boom.

Below is my code we're talking about. As soon as I change the $limit to 50, 200 or 250 it works. But the higher the number the slower the page gets. For instance 101 doesn't work eather. I gives an exception that the limit should be between 2 and 250. Now, I know it's weekend, I know I'm not the fittest currently, but I thought 100 and 101 where between 2 and 250? Right?

` public function connect(): Mollie
{
try {
$this->instance = new MollieApiClient();
$this->instance->setApiKey($this->mollieProfile->getAPIKey());
} catch (ApiException $e) {
}

    return $this;
}

public function listPaymentRequests(string $from = null, int $limit = 100, array $parameters = array()): ?PaymentLinkCollection
{
    try {
        return $this->instance->paymentLinks->page($from, $limit, $parameters);
    } catch (ApiException $e) {
        return null;
    }
}

`

#

The exception triggered at failing the page() request:

[2024-10-19T15:30:51+0200] Error executing API call (422: Unprocessable Entity): The limit should be between 2 and 250. Documentation: https://docs.mollie.com/overview/handling-errors. Field: limit

sand parrot
#

Do you also get an error when you try to execute the same request via Postman?

graceful magnet
#

Yes I do

#

Testing a bit more with Postman, can't really figure out the bug, but everything below 100 and above 199 works. Everything in the 100 range seems to be invalid for the API.

sand parrot
#

Seems like a bug in that case. I’ll make sure to have the right team look into it on Monday.

white violet