#jcalentine
1 messages · Page 1 of 1 (latest)
Hello
Hi, how can we help?
so I have several products but I notice I run into an error of none for .price.unit_amount in the line product_cost = (stripe.checkout.Session.list_line_items(session_id, limit=1).data[0].price.unit_amount)/100 when it is a tip that is paid because by default the tip does not have a default unit_amount
So I am wondering is there a way to extract the tip amount without .price.unit_amount
because this causes an error in my database logs
Are you using Terminal for tips? Or are you just creating a Checkout Session that allows the user to self-select an amount?
I mean I could just skip it with an conditional but I want to provide the user with a receipt
Do you have a Checkout Session ID I can look at?
I believe the latter
cs_live_a1jI9ChDhFw8BLzZHOVxApxBlGrALDGLTV4giXtfZPEv7i2elGgIcMcN7O
Yes I am allowing the User to self-select an amount
What error are you getting specifically? And what are you trying to retrieve?
here is an example
so this works when it is a product with a defined default cost
but when it is a tip in my python code it returns as None
vs
product_cost = (stripe.checkout.Session.list_line_items(session_id, limit=1).data[0].price.unit_amount)/100
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
I think it is because the .price.unit_amount is NaN
when it is user-defined
If you console log the entire Checkout Session object from that API call, what does the payload look like?
well I just noticed the error today, it has not caused any glaring problems. I will look at the payload and get back to you. Sorry for not having more information
No worries! Feel free to pop back in the main channel when you have that