#MasterJiMm - Checkout Metadata
1 messages ยท Page 1 of 1 (latest)
Hi ๐
We generally prefer to keep even unrelated questions from the same asker in one thread but I've got it here.
Can you share a request ID for a Checkout Session creation where you passed metadata?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
No metadata here.
You should be able to see the arguments you provided in your logs
this is my code, is it something wrong here?
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
mode: 'subscription',
metadata: {
userUID,
device_id
},
Yup. metadata needs to be {key: value}. It looks like you're just providing the values
I don't think so.
You are passing arguments to a function that will create an API call. If you need an example in Node.JS we have it here:
https://stripe.com/docs/api/metadata?lang=node
yes so
metadata: {
'uid': userUID,
'deviceID': device_id
},
this thing works?
no it doesnt
That should. Send in a request and see if it's present in the Body
it doesnt work
Can you share your full syntax and request ID?
const session = await stripe.checkout.sessions.create({
payment_method_types: ['card'],
mode: 'subscription',
metadata: {
'order_id': '6735'
},
subscription_data: {
trial_period_days: 14,
},
line_items: req.body.items.map((item) => {
const storeItem = storeItems.get(item.id);
return {
price_data: {
currency: 'usd',
product_data: {
name: storeItem.name
},
unit_amount: storeItem.priceInCents,
recurring: {interval: 'month'},
},
quantity: item.quantity,
}
}),
success_url: `http://localhost:3000/payment/success?session_id={CHECKOUT_SESSION_ID}&device_id=${device_id}`,
cancel_url: "http://localhost:3000/payment/cancel"
})
req_YjSvdOBXxn4BxK
i have a quite old version not sure if that matters
"stripe": "^8.165.0"
@elfin ravine
It's a bit busy on the channel today. responses may be slow.
The syntax looks alright but it's clear that the Node.js stripe library is not passing any metadata to the API
what could be wrong then
Can you try making a stupid simple request? Like just copying the example in the code snippet here: https://stripe.com/docs/api/checkout/sessions/create?lang=node
and add in your metadata key:value pairs?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.