#hedjnik
1 messages · Page 1 of 1 (latest)
Unfortunately the metadata from the line_items can't be automatically copied over to the subscription. The two main ways to do this would be to:
- Set the metadata for those items both on the line item and in
subscription_data.metadata - Listen for the
checkout.session.completedevent and copy the metadata from the line items to the subscription from there
Alright, thank you, just one other thing, when I get the subscription data back and I want to update the subscription items to add the metadata or change quantity or whatever else, is there any easier way to know what the items actually are or do I just need to loop over them and compare the price ids to the known ids for each product to know what the items were? This was the main reason I wanted the metadata added so I could include the item name, internal ids and such to it.
Thinking on this and will get back to you but nothing is immediately coming to mind. It can also help to cache these ID->name mappings on your side for easier lookup
Alright, thank you very much. Its fine if thats what I need to do, just wanted to make sure I wasn't missing something obvious and doing it wrong 🙂
Yeah it is looking like that would be the best way to assosciate them at the moment. Not finding a more automatic way to use metadata or something else