#robert_subscription-invoice-metadata
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1353753425317462138
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐ I'd suggest setting your metadata at the Subscription level.
When a Subscription generates an Invoice, the Invoice will take a snapshot of the Subscription's metadata and store that in the subscription_details.metadata hash:
https://docs.stripe.com/api/invoices/object#invoice_object-subscription_details
This is one of the few exceptions where metadata is automatically copied from one object to a related object:
https://docs.stripe.com/metadata#copy-metadata
Let me know if that doesn't work for your flow though.
Interesting, wasn't aware of that property. I'll need to check, but I would imagine they don't support it. If we can't use that and I'd need to put the metadata directly on the invoice, what would you recommend? Right now it seems like a cron which checks for invoices with a certain product id (and runs some backend code to find & fill metadata) is the best solution
Yeah, otherwise updating it via an explicit request to update the Invoice, triggered however makes sense for your flow (though listening for invoice.created Events with a webhook endpoint could be a good option), would be the approach I'd suggest exploring.
Right, of course - all very useful, thank you! Don't have any more questions for the time being
Happy to help!