njosefbeck / gatsby-source-stripe

Gatsby source plugin for building websites using Stripe as a data source
74 stars 17 forks source link

Get Price in stripeProduct query #60

Closed vSterlin closed 4 years ago

vSterlin commented 4 years ago

It would be very useful to be able to extract prices while querying allStripeProducts or stripeProduct. It is currently possible to get products from price query, but not other way around.

njosefbeck commented 4 years ago

Yeah, this seems to be a limitation of the Stripe API. At least, I don't see a price or prices key on the Product object: https://stripe.com/docs/api/products/object.

But, you should get back the fully expanded Product object when querying for all prices, so you could do some data massaging to add relevant prices to each product. I don't have a good example of doing this, but in theory it'd be possible to either do this in the frontend code or in gatsby-node.js via like.. expanding or linking nodes.