#kd - metadata
1 messages · Page 1 of 1 (latest)
Hello. Can you share the request ID where you set the metadata (checkout session creation)?
Ok let me look
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:
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?
Yes that's correct
I believe if you do the retrieve line items call though the metadata (where you set it) should show: https://stripe.com/docs/api/checkout/sessions/line_items
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'.
Can you share what the response body is here?
{
"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"
}
If you retrieve that product id, it will show the metadata on that product object
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?