#tymm-Invoice
1 messages ยท Page 1 of 1 (latest)
Hi there, so you want to add some metadata to an invoice when customer.subscription.updated event is fired?
preferably i would want to add the metadata during creation/ before customer.subscription.updated callback to facilitate the checking
anyway if i were to add metadata to invoice i should do it in customer.subscription.updated?
It's up to you, you can always update the invoice with metadata before it's finalized.
so i'll have to query the invoice using Invoice.search? or is there other way that i can get the invoice object using the subscription object?
Can you tell me a bit more about the use case? so I can advise the best possible solution.
im trying to facilitate data extraction on the event object i get in invoice.payment_succeeded after a customer has paid. so i was trying to put the information i need upon creation of the subscription update
And where is the metadata coming from?
i have them when i call subscriptionItem.update
OK, the problem is that the invoice may not even be created when your subscription item is updated. Can I suggest you to update the metadata to the subscription item instead?
yeah ive tried that, but i cant seem to find it in the event object of invoice.payment_succeeded callback
You should first retrieve the subscription object, and check the subscription item https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, got it, thanks ๐