#martin-gaibisso_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1425502915694694441
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- martin-gaibisso_api, 6 days ago, 24 messages
why a search query would return different outputs with a defined time window?
query: 'created>=1758409200 AND created<=1759273199 AND customer:NULL'
You are passing a page in the request
correct
Try without
Because page should only be used on subsequent requests
Did you first run the query without page
And then grab the page value from the first's results?
Because if you use an old page value you could get some weird results
yes, i'm trying to get all. added the page to demostrate the problem otherwise it'd take 100 pages
let pageLimit = 100
let charges = []
let has_more = true
let next_page = null
while(has_more){
let params = {
limit: pageLimit,
query: query,
expand: expand
}
if(next_page){
params['page'] = next_page
}
const apiResponse = await stripeHelper.getStripeApi(liveMode).charges.search(params)
next_page = apiResponse.next_page ?? null
has_more = apiResponse.has_more
charges = charges.concat(apiResponse.data)
}
return charges
this is my code
returning different amount of charges everytime
I see https://docs.stripe.com/search#pagination in the docs
In the two requests you sent I see 36 items were returned in one and 37 items returned in the other
So likely it's this issue
correct