#ykb-pagination

1 messages ยท Page 1 of 1 (latest)

hollow cypress
devout karma
#

Hmm

#

Soo

#

Let me check ๐Ÿ™‚

#

I think that works

#

So limit as even : 1

#

Will be ignored by this function?

#

Just to make sure

graceful flicker
#

The limit parameter will still be taken into account. If you set the limit to 3, then the auto-pagination feature will continue to fetch objects 3 at a time.

devout karma
#

So how to make sure that in my query, I will get all transactions?

graceful flicker
#

What language are you using, maybe it'll be easier if we look at some code.

devout karma
#

PHP

#

Just to clarify

#

Im trying to get .CSV file with all my transactions

#

I know that Stripe offers this, but in wrong way in my case

#

Because Stripe Fee is as Column

#

And I need this as row

graceful flicker
#

Alright, so the first part is to fetch a group of objects, such as:
$customers = $stripe->customers->all([ 'limit' => 3, ]);
This is where you provide the limit, which will control how many records are retrieved initially.

Then you use the auto-pagination feature as so:
foreach ($customers->autoPagingIterator() as $customer) { // Do something with $customer }
This will iterate through all objects (in this case customers) originally fetched, and when that list is exhausted it will fetch a new batch. Because the limit was set to 3 at the beginning it will fetch the records 3 at a time.

So if you want a complete list, then you'll need to append each object to another array/list as you iterate through them.

devout karma
#

Yeah, I want complete list

#

For some reason I don't understand how to get complete list :/

graceful flicker
#

You'd want to do something along these lines, you'd declare an array to hold all of your transactions and then put each transaction in it as you iterate through the auto-pagination. (Apologies if the syntax is off, my PHP is a touch rusty)


$customers = $stripe->customers->all([
  'limit' => 3,
]);

foreach ($customers->autoPagingIterator() as $customer) {
  array_push($allCustomers, $customer);
}```
devout karma
#

I think now Understand Toby

#

Soo

#

This functions : ->autoPagingIterator()

#

Will "Fill" list (my array which I will paste to it)

#

But will it fill for sure?

#

I mean

#

Lets make an example

#

If I have 1000 transactions of my account

#

I set Limit to 10

#

Will autoPagingIterator() fill rest?

graceful flicker
#

It will go through all 1000 transactions.

devout karma
#

What about 10 000?

#

๐Ÿ˜„

graceful flicker
#

It'll go until there are no more records to fetch.

devout karma
#

Alright

#

Thanks Toby for your Help

#

๐Ÿ™‚