#kd - metadata

1 messages · Page 1 of 1 (latest)

royal palm
#

Hello. Can you share the request ID where you set the metadata (checkout session creation)?

heavy tree
#

sure, one min

#

req_0GiEnn5dA4WFCd

royal palm
#

Ok let me look

royal palm
#

So setting the metadata there would attach metadata to the product, not the checkout session. If you want metadata on the checkout session object itselfhttps://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-metadata, you need to provide it here:

heavy tree
#

So the metadata that can be passed in to the line item here: 'line_items.price_data.product_data.metadata' is not intended to be returned on the response when calling 'retrieve a checkout session line item' is that correct?

royal palm
#

Yes that's correct

heavy tree
#

That is the command I'm using but its not returning the 'metadata'. More accurately, it is not returning the 'price_data' attribute within which the 'metadata' can be found. And yes, I did create the checkout session with 'price_data'.

royal palm
#

Can you share what the response body is here?

heavy tree
#

{
"object": "list",
"data": [
{
"id": "li_1Kfm56IdeRq6Wv7sYykhyvHI",
"object": "item",
"amount_subtotal": 366,
"amount_total": 366,
"currency": "eur",
"description": "porids",
"price": {
"id": "price_1Kfm56IdeRq6Wv7sfYMqfNlL",
"object": "price",
"active": false,
"billing_scheme": "per_unit",
"created": 1647872376,
"currency": "eur",
"livemode": false,
"lookup_key": null,
"metadata": {
},
"nickname": null,
"product": "prod_LMV57y9xX7SVpY",
"recurring": null,
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "one_time",
"unit_amount": 122,
"unit_amount_decimal": "122"
},
"quantity": 3
}
],
"has_more": false,
"url": "/v1/checkout/sessions/cs_test_b1SxRWrSl0ggwSQ08hI4HqwtLRfZlc6ydVdGmAcNuSIdg1Pe5hcfpvH2Ba/line_items"
}

royal palm
#

If you retrieve that product id, it will show the metadata on that product object

heavy tree
#

Yup I see it. And the behavior I'm seeing which is that 'price_data' is not being returned in the retrieve line items call when I did include it in the original create session call; this is expected behavior, yeah?