#rezamirzad
1 messages · Page 1 of 1 (latest)
I'm not sure I understand. There aren't different Price objects depending on the quantity, it's just a single price_xxx ID
You can't pass quantity as its not a field on the Price object
What is it you're actually trying to do?
Hi,
so, how to retrieve the amount for a multi tiered product?
like, the client is ordering 7 items, i want to be able to retrieve the amount for 6 items, which should be 6*4=24 euros
this is the actual tiers table
Probably just retrieve the Price object somehow and then use the data from the tiers field: https://stripe.com/docs/api/prices/object#price_object-tiers
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
But those fields aren't supported with the Search API: https://stripe.com/docs/search#query-fields-for-prices
If you're trying to display a preview invoice of the cost of a subscription, then use this API: https://stripe.com/docs/api/invoices/upcoming
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
this is exactly where I am blocked.
my query
const price = await stripe.prices.search({ query: "active:'true' AND product:'" + ctx.request.body?.productId + "' ", });
retrieves price, but I am not seeing the amount or unit_amount in the response (screen shot)
You need to pass expand: ['tiers']. It's not returned in the repsonse by default
await stripe.prices.search({
query: "active:'true' AND product:'" + ctx.request.body?.productId + "' ",
expand: ['tiers']
});
great!
i got the data i was looking for
thank you
np!