mollie / mollie-api-php

Mollie API client for PHP

Home Page:http://www.mollie.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

payments -> page() limit using from parameter

erikkraijenoord opened this issue · comments

Specifications

When importing the history of payments i've noticed the page() isn't doing what I thought it will do, maybe it's me but to be shure i'll report this.

  • API Version: 2.49.1

Describe the issue

Importing payments with the ->page( 'tr_*', 100 ); will not include the most recent payments, it leaves out the most recent payment that has been received today. When I remove all parameters in ->page() it will list all payments on the default limit, is this a mistake on my side for not understanding the parameters?

Hi @erikkraijenoord,
could you provide me with more details of what you tried out and what you expected to be returned?

I created 4 payments via the API and was able to retrieve them all via $mollie->payments->page() and also via $mollie->payments->page(‘{first_payment_id_received_through_page_endpoint}’, 100)

foreach (range(1, 4) as $i) {
  $mollie->payments->create([
      "amount" => [
          "currency" => "USD",
          "value" => "10.00"
      ],
      "description" => "Order #{$i}",
      "redirectUrl" => "https://webshop.example.org/order/{$i}/",
      "webhookUrl"  => "https://webshop.example.org/mollie-webhook/",
  ]);
}

Hi @Naoray

Thank you for the response!
I've been importing our clients payments, using the first tr_{id} known inside his Mollie Dashboard (over 500+ payments). While importing with a limit of 100 transactions it will leave out most recent payments. clearing the page() parameters got the last 100 payments so the most recent is included in that request.

Are you filtering the payments by a specific date and then take the bottom most payment’s id and use it in the API call or what is your selection process for getting the starting payment id?

In general if you add a payment id to the ->page() method, the API will start the payment with the id you passed to the method and all payments that preceded the given payment up to a limit of 100 by default. Therefore if you want to get all payments you have to use the ->page() method without any param and then iterate over all pages.

Does this answer your question @erikkraijenoord?

Are you filtering the payments by a specific date and then take the bottom most payment’s id and use it in the API call or what is your selection process for getting the starting payment id?

In general if you add a payment id to the ->page() method, the API will start the payment with the id you passed to the method and all payments that preceded the given payment up to a limit of 100 by default. Therefore if you want to get all payments you have to use the ->page() method without any param and then iterate over all pages.

Does this answer your question @erikkraijenoord?

Correct, i've been scrolling to the very end (yeah i know why,,,) to get the first ever payment created inside his account. Using that transaction ID as the starting point to collect all payments.

So it's not required to use the first parameter to get all payments just iterate through the pages and that's it? I've been able to get all payments using different methods so the above isn't required anymore but good to know!

So it's not required to use the first parameter to get all payments just iterate through the pages and that's it? I've been able to get all payments using different methods so the above isn't required anymore but good to know!

Exactly! The first parameter is only useful if you already have a payment id available, want to skip newer payment transactions and directly receive payments older than the given id.