#zach_meters-v2

1 messages ¡ Page 1 of 1 (latest)

north glacierBOT
#

👋 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/1300982319737340037

📝 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.

hasty plinth
#

zach_meters-v2

#

welcome back!

#

Can you share more details about the error? Sadly this is brand new and I can't even look up those objects myself internally

tranquil stump
#

Haha

#

Error sending usage to stripe: Request req_v2Qxd7KOAjwblFXcZ: You must submit a customer reference in the payload value of stripe_customer_id as defined in the meter.

#

this is what i get, but i am sending stripe_customer_id

#

which is where i am lost

hasty plinth
#

is this the same exact error as yesterday with no progress? Or did you figure out that value thing?

tranquil stump
#

value thing was figured out

hasty plinth
#

Can you share
The exact code you use to create the Meter
The exact code you use to create the MeterEvent

tranquil stump
#

it had to be "unit" : "quantity"

#

sure

#

you have no way to see that payload though?

#

I see this, but no details

#

is there any logging on your end? it very well could be an issue on my end, but this is that generic error you and i were getting as well, so I am confused

hasty plinth
#

there's no way for my team to view logs. I'm sure the people who built this can see logs but they haven't built the tool needed to help us yet. You're like the second dev I ever see trying to use this sadly

tranquil stump
#

I can send you the code, i just have a feeling something else is going on, because it works locally

hasty plinth
#

My gut is that it's like yesterday, you have a typo or move too fast

tranquil stump
#

fair enough.

hasty plinth
#

like you passed customer: 'cus_123' instead of stripe_customer_id: 'cus_123'

#

But it's a guess because those APIs are brand new so my usual intuition isn't well exercised yet. but if I see your code I can either spot it or reproduce

tranquil stump
#

client = stripe.StripeClient(stripe.api_key) response = client.v2.billing.meter_events.create({
"identifier": record['idempotency_key'],
"event_name": record['event_name'],
"timestamp": timestamp,
"payload": { record['unit_of_measure']: record['quantity'], "stripe_customer_id": record['customer_id'] },
})

#

this is what I am doing

hasty plinth
#

Cool, can you hardcode all the values to something random and share the exact code after that change, then run and share the exact request id for the error?

tranquil stump
#

I can, but the problem is its working on my local machine, its only when i deploy to a server that it doesnt work.

#

So i am just trying to identify what is wrong with the payload, unfortunatley it all looks the same with a print statement

hasty plinth
#

which is highly likely to be because some of those variables are empty/null honestly

tranquil stump
#

yea, but in the print it shows it as good.

hasty plinth
#

So I'd recommend carefully logging the payload/params before calling the API and it is highly likely to be the problem

tranquil stump
#

if you have no logs, then ill go back to the drawing board on my end

#

yea, i did that, unfortunatley.

#

its definitley filled, but something else is going on.

#

No wories @hasty plinth thanks for the help

#

i would bother you on this more, but will try and do work on my end, i thought it might be easy for you to have pulled some log I dont have access to.

hasty plinth
#

I asked an engineer internally to look up the log and you passed {"event_name":"token_*****","identifier":"949***","payload":{"tokens":"69","customer_id":"cus_QE***"},"timestamp":"2024-10-30T****"}",

tranquil stump
#

But seems you are in same boat as me

hasty plinth
#

so to me you clearly passed customer_id instead of stripe_customer_id

tranquil stump
#

hmm, that is so strange

#

i sent you the code, but it must be some form of deployment issue then.

#

Thank you so much, this is actually super helpful..

hasty plinth
#

I'm really sorry. This should take seconds to debug if we had good tooling, good error messages so this is definitely not on you

tranquil stump
#

Yea, but this is helpful, it means its something going on on my end, because locally i send stripe_customer_id.

#

thanks for taking the time.

hasty plinth
#

sure thing!