#josephmaxim
1 messages · Page 1 of 1 (latest)
Hello
hi
There are a few places to set metadata for your Checkout Session. You can either set it top-level (https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata) which will pass it to checkout.session.completed or you could set it within payment_intent_data (https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata) or subscription_data (https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-metadata) which passes it to the underlying objects that are created due to the Checkout Session.
const session = await stripe.checkout.sessions.create({ mode: "subscription", payment_method_types: ["card"], line_items: [ { price: priceId, // For metered billing, do not pass quantity quantity: 1, }, ], customer: stripeCustomerId, metadata: { userId: _id, }, success_url: ${appUrl}?notify=subSuccess, cancel_url: ${appUrl}/, });
Yep that looks fine. Do you have an example Checkout Session that you can share that I can look at? And have you logged out _id to ensure that is set?
this code returns an empty metadata on checkout.session.completed
Can I see an example Event ID or Checkout Session ID?
okay give me one sec
evt_1NpFMSFrA9OQgg2I4huEuO4y
[1] 2023-09-11 15:01:28 --> checkout.session.completed [evt_1NpFMSFrA9OQgg2I4huEuO4y]
Okay so https://dashboard.stripe.com/test/logs/req_c52LH0iUEjFfnN is the creation request for that and you can see that there is no metadata passed in the POST params