#g105b

1 messages · Page 1 of 1 (latest)

silver locustBOT
hidden steeple
#

I think I'm misunderstanding how prices and products relate.

deep fable
#

Hello! Looking...

hidden steeple
#

Sorry to bombard you, but I think I can refine my question. It seems I was mistaking unit_amount for the number of items being purchased, but I think unit_amount should actually be the price, in cents? The problem I'm having is that I already have a Product in the Stripe dashboard, with an associated Price. I don't want to be hard-coding prices in my code, as it's already defined in the dashboard.

deep fable
#

Ah, yep, that's correct.

#

You should pass the Price ID instead of specifying price_data in that case.

hidden steeple
#

Oh, that sounds like a simple fix.

#

Oh, I picked price_data because it was the only way to supply a product_id... but do I not need to reference the product if I reference the price?

deep fable
#

You do not specify the Product ID. The Price is nested under the Product and, thus, specifies the Product implicitly.

hidden steeple
#

Ah, that's perfect, thank you - I didn't realise it would automatically allocate.

#

Thank you so much for your support - you're literally the best company at this whole thing, it's super that you help out so much. Have a great day!