#diesel_price-reconciliation

1 messages ยท Page 1 of 1 (latest)

last radishBOT
#

๐Ÿ‘‹ 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/1300504090257653760

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

fresh crest
#

More accurately, I need all transactions on that product, their price, and the name of the customer.

final ivy
#

diesel_price-reconciliation

#

@fresh crest the easiest would be to use Sigma since all the data is in there with Checkout Sessions and their line items and you can look up all the Price(s) in those Session(s) and map them to their Product id

fresh crest
#

It's asking for money to pay for an AI. Is there a non-ai option?

final ivy
#

Sigma is a paid product (unrelated to the AI) but it's also going to make you do that report in minutes instead of spending 2 days writing the code for it

fresh crest
#

Once I've been pointed to the right objects I can write reports in minutes. We're a volunteer organization and our money goes to rent. It's frustrating but that's what we have.

final ivy
#

sounds good! Then use the List Checkout Sessions API and the Expand feature (see https://stripe.com/docs/expand and https://www.youtube.com/watch?v=m8Vj_CEWyQc) to understand how it works.
You can pass expand: ['data.line_items'] to get all the line items in that Session and for each one it will have the Price object which has product: 'prod_123' and you can loop over all Sessions to figure out which ones used Price(s) from specific Product(s)

fresh crest
#

OK, I'll try that. I've done this before.

#

How do i get the product from a session?

final ivy
#

what part of what I explained above is unclear?

fresh crest
#

Is there a way to expand the price name in a line item?

final ivy
#

no there isn't. Best approach is to cache this information in your own database

fresh crest
#

Report complete. Thanks. Not sure who would take 2 days to write this.

#

It's just slow because I loop over all checkout sessions.

final ivy
#

you'd be surprised how many hours I spend just explaining the concept of Expand to devs here ๐Ÿ˜…

#

And then they would go into how to know what is paid, how to handle refunds, etc. It rarely ends with just that one question you had

fresh crest
#

Maybe someone should hire me. haha. This stuff is fun to work with.

#

I solved the looping problem by caching the sessions.