#maxhenson

1 messages · Page 1 of 1 (latest)

sudden patioBOT
stoic perch
#

hi, do you have more details like some exact code you're using, product IDs prod_xxx, raw JSON, etc?

hallow plaza
#

Of course!

I am doing this:

stripe.products.retrieve(data.metadata.buyingItem)
console.log(product)```

and it returns
```json
Promise {
  {
    ...
   }
}
``` but when I do
```js
console.log(product.name)
``` it returns `undefined`
#

just imagine all the data is in the Promise

stoic perch
#

yeah because it's async

#

let product = await stripe.products.retrieve(data.metadata.buyingItem)

hallow plaza
#

oh my god im so sorry for wasting your time

#

im so stupid

stoic perch
#

it's no problem!

#

you can also do stripe.products.retrieve(data.metadata.buyingItem).then(function(product){console.log(product.name)});