#127.0.0.1
1 messages · Page 1 of 1 (latest)
45 is just a test number of course
Hi there, your code adds the metadata to the checkout session. If you wish to see the metadata in Payments Dashboard, you should add the metadata to its payment_intent_data (https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ah, that makes sense. So something like:
const session = await stripe.checkout.sessions.create({
line_items: [
{
price_data: {
currency: "usd",
product_data: {
name: "[redacted]",
},
unit_amount: Math.round(total * 100)
},
quantity: 1,
},
],
payment_intent_data: {
metadata: {
order_id: 45,
},
}
customer_email: customerInfo.email,
mode: "payment",
success_url: `${process.env.HOSTNAME}/checkout?success=true`,
cancel_url: `${process.env.HOSTNAME}/checkout?canceled=true`,
});
Yes it looks good to me