#matrix-product-error
1 messages · Page 1 of 1 (latest)
for (var i = 0; i < name.length; i++) {
const product = await stripe.products.create({
name: name[i],
description: description[i],
statement_descriptor: 'xxx',
metadata: {
category: category[i],
categoryNumber:categoryNumber[i],
itemNumber: itemNumber[i],
readyForSale: 'yes'
},
}, {
stripeAccount: 'xxx',
});
const price = await stripe.prices.create({
unit_amount: price[i],
currency: 'gbp',
product: product.id,
}, {
stripeAccount: 'xxx',
});
}
this is the code
and this is the price declared before the for
const price = [1050]
so it seems to crash on unit_amount: price[i], right?
yes
hmmm sorry I don't really get your question
like this isn't a Stripe error as far as I can tell, it's just an error/typo in your language no? If you remove all Stripe code and just print the price does it work?
ok will try to print the price
i was not sure if there was another way to create product and price in one go
that's the right way, create a product and then a price and that just works. The bug right now is in your own code/initialization
well the price is initiatilized
yeah you have 2 variables called price and it just breaks your code