#jcalentine

1 messages · Page 1 of 1 (latest)

pulsar oliveBOT
late rover
#

Hello

stable fog
#

Hi, how can we help?

late rover
#

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

stable fog
#

Are you using Terminal for tips? Or are you just creating a Checkout Session that allows the user to self-select an amount?

late rover
#

I mean I could just skip it with an conditional but I want to provide the user with a receipt

stable fog
#

Do you have a Checkout Session ID I can look at?

late rover
#

I believe the latter

#

cs_live_a1jI9ChDhFw8BLzZHOVxApxBlGrALDGLTV4giXtfZPEv7i2elGgIcMcN7O

#

Yes I am allowing the User to self-select an amount

stable fog
#

What error are you getting specifically? And what are you trying to retrieve?

late rover
#

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

late rover
#

I think it is because the .price.unit_amount is NaN

#

when it is user-defined

stable fog
#

If you console log the entire Checkout Session object from that API call, what does the payload look like?

late rover
#

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

stable fog
#

No worries! Feel free to pop back in the main channel when you have that

late rover
#

Tips are not a commonly selected product, so the error went under the radar for a while

#

Thanks for your time