#twinkle0293

1 messages · Page 1 of 1 (latest)

foggy turtleBOT
chrome ore
#

Can you share a request id where you try this?

tired veldt
#

I am not sure how to retreive the request id

chrome ore
tired veldt
#

req_Vn36eebl8w6XgP

On the stripe docs, under payouts I see
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

chrome ore
#

I see 2 payouts were returned for that request though

tired veldt
#

So I made one call, but on your side, I believe it calls based upon the starting_after filter<
So if you see that request, at the same time multiple requests have gone through
which means I made a single call with a limit but on your end multiple calls were made

chrome ore
#

That's not how starting_after works though. It still only makes 1 request and just returns results after that page

#

Is your code implementing pagination

#

That would explain the multiple requests

#

We won't automatically make any requests like that

tired veldt
#

params := &stripe.PayoutListParams{}
params.SetStripeAccount(account)
/limit := int64(10)
params.Limit = &limit
/
// Expand Destination object for each Payout & include total count of result set
destinationExpansionKey := "data.destination"
includeFilterKey := "include[]"
totalCountFilterParam := "total_count"
emptyOperationParam := ""
params.AddExpand(destinationExpansionKey)
params.Filters.AddFilter("limit", "", "3")
params.Filters.AddFilter(includeFilterKey, emptyOperationParam, totalCountFilterParam)

i := payout.List(params)
count := 0
for i.Next() {
    p := i.Payout()
    fmt.Println(p)
    count++
}

hasMore := i.Meta().HasMore
fmt.Println(hasMore)
fmt.Println(count)

I am not Using pagination
and the hasMore fmt prints 155

#

even though I passed limit 3, it still returned me all the payouts

chrome ore
#

That is auto pagination

#

Where did you get that code?

tired veldt
#

I wrote it to test limit

chrome ore
#

You just told me you don't have pagination

#

The above is autopagination

#

That's why you get back more than 3 results

tired veldt
#

How can we get the required limited payouts in a single request?

#

I thought If I applied the limit to 3, List should return only 3 objects but I guess when I am iterating over the list, it's actually doing each request one by one

chrome ore
#

Just remove the autopagination

#

If you only want to run one request and return 3 results

tired veldt
#

got it, let me try

#

it worked, thankyou

#

now if I want to fetch the next payout, how would I do that?

#

and how do we apply skip?

chrome ore
#

What do you mean by next payout?

#

Just the next one in the list after those 3?

tired veldt
#

yes, in the documentation I see if has_more is true, we should get next_page, which object returns next_page ?
I don't see it in meta

next_page
string
A cursor for use in pagination. If has_more is true, you can pass the value of next_page to a subsequent call to fetch the next page of results.

chrome ore
tired veldt
#

thankyou

#

is there a way we can filter the payouts on the basis of amount, I see other filters like date and status

chrome ore
#

Unfortunately not