#Pain - Invoice metadata
1 messages ยท Page 1 of 1 (latest)
Hello, I have some metadata set for a price but it's not being exposed back to be on the invoice.paid event.
Oh hang on, my mistake this is for product metadata not price.
I can see that the plan result has some metadata where would I set this?
Price does too
On the respective price object.
And these are in the line items for an invoice, correct?
No
You would want to do that on the Price object itself since they are distinct from the Invoices
A price can exist on many invoices.
And if you wanted to see the product information you would need to retrieve the Invoice object and use the Expand parameter to get the full product object instead of just the ID
I see, I already set some meta data on the product. Would it be best to just expand the parameter on the product?
The product is what gets expanded when you retrieve the invoice. It's a parameter in the API call that basically tells Stripe to fetch and return the full object rather than just the ID for that API call.
We discuss it here: https://stripe.com/docs/api/expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Got it, I appreciate the clearance.
Have a great rest of your day.
Just a quick question,
I would have to retrieve this data? Because currently I am listening to the webhook events, is there a way to expand it from there without retrieving again?
Unfortunately you cannot specify which fields to expand by default for the webhook. In that case you would need to make a second API call to retrieve the object once you receive the webhook event.
Got it, thank you again.