#gecko-metadata-problem
1 messages · Page 1 of 1 (latest)
hi there
'req_z5LYUpLpFpBMKx',
I'm getting an error that it must be a string
I'm in a create-checout-session
and trying to figure out if this is a problem with meadata, or with response URLs
can you share your code?
I thought i had this working....
basically you're not passing metadata properly
metadata: [
{
'cid': `${cid}`,
},
{
'sid': `${sid}`,
},
{
'tier': `${tier}`,
},
{
'price': `${price}`,
},
],
```
as I understood it takes an array of key/val pairs
yep remove those curly brackets!
no objects?
line_items is an "array of objects" where each line item is an object so you pass line_items: [ {price: 'price_123', quantity: 1}, {price: 'price_456', quantity: 1}]
but metadata is an "array of keys" or a hash (every language has their own vocabulary) so you do metadata: [ 'key1': 'value1', 'key2': 'value2']
and yeah since you use node you want a hash sorry
https://stripe.com/docs/api/metadata?lang=node stripe.charges.create({ amount: 2000, currency: "usd", source: "tok_mastercard", // obtained with Stripe.js metadata: {'order_id': '6735'} });
so for you you want metadata: { 'cid': `${cid}`, 'sid': `${sid}`, 'tier': `${tier}`, 'price': `${price}`, },
yes that's it, works fine now, thanks! I think I copied the model from line_items or something
didn't realize that it's not an array of objects for metadata
one last question....when the session returns, metadata is still available, yes?