#Constant-prices

1 messages ยท Page 1 of 1 (latest)

wooden rock
#

๐Ÿ‘‹ How can I help?

#

Can you share the function and error that you're facing?

brave geode
#

It seems like stripe does not get initialised

wooden rock
brave geode
#

Yes it is, I just removed it from the question.

#

Double checked to make sure it's the right key and still same issue.

wooden rock
brave geode
#

Nope got this error: ย Cannot read properties of undefined (reading 'retrieve')

wooden rock
#

If you log with console.log(stripe), does it return undefined?

brave geode
#

No it returns the whole stripe object. Really weird!

wooden rock
#

Are you using TypeScript?

brave geode
#

Yes I am

wooden rock
#

Can you try following?

import Stripe from 'stripe';
const stripe = new Stripe('sk_test_...', {
  apiVersion: '2022-08-01',
});

const prices = await stripe.prices.list({limit: 3,});
brave geode
#

I'm getting this error: Failed to load function definition from source: FirebaseError: Failed to load function definition from source: Failed to generate manifest from function source: TypeError: stripe_1.default is not a constructor

#

It's really weird because all my other stripe functions are working

wooden rock
#

That's really strange

#

Could you compare those that are working with this?

#

Is there any difference?

brave geode
#

Everything is the same. So I just ran:

const customerList = await stripe.customers.list({limit: 1});

And that worked!

wooden rock
#

So it only doesn't work on prices?

brave geode
#

Yes

wooden rock
#

Which version of Stripe Node do you use?

brave geode
#

v10

#

That's weird, in my root folder's package.json I have v10, but in my functions folder I have v6.

#

I've update v6 to v10, but still getting the same error

#

Got IT!!

wooden rock
#

Amazing! What did you do?

brave geode
#

Sorry run the update again restarted everything and is now working! Thanks for your help!

wooden rock
#

No problem! Happy to help. Glad to hear that it works now ๐Ÿ˜„

brave geode
#

I should probably check for breaking changes from v6 to v10 right?๐Ÿ˜†

wooden rock
brave geode
#

Thanks! Sorry one last question, the prices only seem to return one currency, the location I'm currently at. How would get all currencies for my prices?

wooden rock
#

It should return prices with all currencies

#

Could you give an example?

#

Constant-prices

brave geode
#

So my product has a price in AUD and GBP, but the prices that are returned only gives AUD prices.

wooden rock
#

Let me check

#

To retrieve other currency options, expanding data.currency_options should include other currencies. For example,

const prices = stripe.prices.list({
  limit: 3, 
  product: 'prod_xxx', 
  expand: ['data.currency_options'],
});
#

Other currency options are under the default price of a product

brave geode
#

Ah awesome thank you!

wooden rock
#

No problem ๐Ÿ˜„