#MasterJiMm - Checkout Metadata

1 messages ยท Page 1 of 1 (latest)

elfin ravine
shut vault
#

req_etyDnvQhHniQpX

#

not sure if thats the correct one

elfin ravine
#

No metadata here.

#

You should be able to see the arguments you provided in your logs

shut vault
#

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
      },
elfin ravine
#

Yup. metadata needs to be {key: value}. It looks like you're just providing the values

shut vault
#

key userUID value userUID ?

#

that shorthand userUID wont work?

elfin ravine
#

I don't think so.

shut vault
#

why lmao

#

do i need it strignified?

elfin ravine
shut vault
#

yes so

#
metadata: {
        'uid': userUID,
        'deviceID': device_id
      },
#

this thing works?

#

no it doesnt

elfin ravine
#

That should. Send in a request and see if it's present in the Body

shut vault
#

it doesnt work

elfin ravine
#

Can you share your full syntax and request ID?

shut vault
#
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

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

shut vault
#

what could be wrong then

elfin ravine
shut vault
#

UnhandledPromiseRejectionWarning: Error: No such price: 'price_H5ggYwtDq4fbrJ'

#

ahh nice it got applied here

#

req_l5tmyua6fkfJmo

elfin ravine
#

Okay, progress!

#

Now try incrementally adding specific parameters from your original function definition and see if/when the metadata drops.