#deme-checkout-metadata

1 messages ยท Page 1 of 1 (latest)

severe lionBOT
wraith haven
pearl cloak
#

Nice, thank you I will read into it

wraith haven
#

NP! ๐Ÿ™‚ Happy to help

pearl cloak
#

I'm assuming after getting the line items value I can use that value to retrieve it using products?

wraith haven
#

Yeah, you'd likely need to retrieve the product in a separate API call. I was thinking you might be able to expand it in the same call but the product information would be too deep

pearl cloak
#

It's only one product. I think I may be able to expand it in the same call.

The problem now is that using the line items retrieval, I don't see the metadata object in the return, even though I have metadata in the dashboard view

#

Is that a security feature/do I need to retrieve that meta data some other way?

Here's my router call:

  getStripeSession: protectedProcedure.input(
    z.object({
      sessionId: z.string(),
    })
  ).query(async ({ ctx, input }) => {
 
    const { stripe } = ctx;

    const session = await stripe.checkout.sessions.retrieve(input.sessionId);

    // list the session line items
    const lineItems = await stripe.checkout.sessions.listLineItems(
      input.sessionId
    );

    if (!session) {
      throw new Error("Could not find session");
    }

    return { session, lineItems };
  }),
wraith haven
#

It depends where the metadata is set. Are you setting it on the Checkout Session OR the PaymentIntent object?

The dashboard might be showing the metadata from the PaymentIntent

pearl cloak
#

I placed the link in the metadata using the dashboard, so I'm not sure which one it's setting it through in the backend

wraith haven
#

Can you share the PaymentIntent ID? I can take a quick look

pearl cloak
#

Sure one sec

#
payment_intent
: 
"pi_3NNhvBHWv7KKbqqE00igzXtS"
wraith haven
#

huh I don't think setting it on the dashboard is updating the underlying objects ๐Ÿค”
Seems like it's only rendering it on the dashboard

pearl cloak
#

hmm is that a bug? Or is there some other way to access that metadata?

wraith haven
#

Not sure! let me check

pearl cloak
#

Sounds good! Thanks

wraith haven
#

Oh wait, are you looking at the product view?

pearl cloak
#

Yes

wraith haven
#

Ah yeah, you've set the metadata on the product

pearl cloak
#

So I'm guessing I should use the line_items and get the product value and then retrieve that product + the metadata?

wraith haven
#

You need to retrieve the Product object in order to see the metadata

#

yup

pearl cloak
#

Awesome, that should work

Thanks

wraith haven
#

NP! ๐Ÿ™‚ Sorry for the confusion

severe lionBOT