Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

163
Vistas
How to access items metadata in Stripe checkout session

When I create a Checkout session, I am creating prices on the fly with price_data and product_data properties. For each item, I am putting metadata in the product_data.metadata property.

After payment is successfully finished, I fetch the session data in order to display Payment Successful page to the customer. But for some reason, metadata of the items are empty. Metadata of the items are present when I check it in the Dashboard, but they are empty when I fetch it with API.

I tried to fetch whole session data with expanded line_items property:

const session = await stripe.checkout.sessions.retrieve(session_id, { expand: ['line_items'] });

And I also tried to fetch the items directly:

const line_items = await stripe.checkout.sessions.listLineItems(session_id);

In both scenarios, metadata of each item is empty.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

When creating the items on the fly, metadata ends up in the product property, and not in the price property.

So I solved the issue with expanding the items with product data:

const line_items = await stripe.checkout.sessions.listLineItems(session_id, {
  expand: ['data.price.product'],
});

The response have the metadata inside product property.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda