#nanzepanze - list balance transactions

1 messages ยท Page 1 of 1 (latest)

frozen grove
#

which the basic curl request is not using

spark hazel
#

ok does that mean that setting the filter param "limit" to 3 has no affect unless I disable the client's auto-pagination or have I misunderstood how the filter works with the Go client?

frozen grove
#

the limit will apply "per request" but with auto pagination this is mostly invisible to you

#

What are you trying to do?

spark hazel
#

I want to get the list of transactions for a 24h period

#

if the transaction is of type: charge, adjustment or refund the transaction's description and amount will be sent to an accounting application

#

fairly straightforward I think in theory

#

@full hazel suggested earlier that I use the filter ending_before instead of the created gte and lte filters to look at what transactions were processed the day before #930500521939337226 message

frozen grove
#

sure, you can use ending_before if you have the ID of the last transaction you processed the day before, this would let you limit to just new ones you haven't seen yet

spark hazel
#

I'm still unclear on whether I should use the limit filter. When I turned off auto pagination I got back 3 transactions in the same way as I did with curl. What's stripe's best practice with regards to the limit with auto pagination?

frozen grove
#

The limit is not as relevant when using autopagination. What is your goal?

spark hazel
#

let's say my stripe account is fresh today and there are no transactions. from tomorrow everyday at midnight get the transactions that have occurred in the previous 24h period

#

so tomorrow we know the results would be zero. but let's say there are 10 transactions the next day my Go app will retrieve those 10 transactions and do whatever it needs. the next 24 hour period when the app runs it will retrieve any transactions that happens from those 10, e.g. starting at 11

#

does that make sense?

frozen grove
#

Sure, so if you keep track of the latest one you know about you can iterate until you hit that then abort. For the first day you would just exhaust the iterator.

spark hazel
#

I think I got the basics working ๐Ÿ™‚

#

Another silly question it may not be specific to the stripe go sdk but I'm not sure. If I want to output the response from the balance_transactions/list endpoint as JSON instead of the balanceTransaction.List go object does the sdk offer an easy way to do that?

frozen grove
spark hazel
#

very cool! I thought I'd have to make my own struct etc but using LastResponse on the BalanceTransactionList().LastResponse was way easier ๐Ÿ™‚

#

thank you very much for your help!

frozen grove
#

Quite welcome!

frozen grove
#

anything else you need help with @spark hazel or all set?

spark hazel
#

I think I'm good for now. I'll probably be back soon enough ๐Ÿ˜›

#

thanks again!

frozen grove
#

NP! have a good one