#matthew_pagination-order
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/1481771739879837896
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
You mean this integration, right? https://docs.stripe.com/invoicing/customer/balance
yes
As far as I know, our APIs do not expose a simple way to retrieve the customer's balance as of a specific date/time. You would need to examine the current balance and then walk backwards through the list of transactions to determine the changes that were applied.
So I've found that with the list endpoint I can add query parameters to fetch transactions less than a date https://docs.stripe.com/api/customer_balance_transactions/list#list_customer_balance_transactions-created then limit by 1
which seems to do what we want but only if the endpoint is sorting transactions
by date descending
do you know if that endpoint has sorting?
All our List APIs sort descending (newest first)
is that in the docs anywhere?
I can see for balance transactions it says they are sorted here https://docs.stripe.com/api/balance_transactions/list
but I couldn't find it for customer transactions and the ai help was saying the endpoint was unsorted
I would never trust an AI for Stripe API advice. It's the thing they seem to get wrong the most
They love to invent endpoints and parameters that don't exist
The sorting is a core piece of our List API infrastructure
All the pagination features depend on it
So it would be a big problem if that wasn't true.
But you can also test this for yourself.
Thanks, we did test with one customer and the results were as expected but we just couldn't see anywhere that guaranteed order
Yeah. I wish we wrote in more generally. We could add a section to the top of the API reference doc to call this out here
Basically, this became so "baked in" people writing our docs stopped referencing it to avoid unnecessary clutter
I can file that feedback
matthewwoodruff_customer-balance-transactions
Feedback filed
matthew_pagination-order