#Pain - Invoice metadata

1 messages ยท Page 1 of 1 (latest)

barren condor
#

Hi ๐Ÿ‘‹

tranquil acorn
#

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

barren condor
#

On the respective price object.

tranquil acorn
barren condor
#

And these are in the line items for an invoice, correct?

tranquil acorn
#

Correct

#

Would I specify the metadata there for the price?

barren condor
#

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

tranquil acorn
#

I see, I already set some meta data on the product. Would it be best to just expand the parameter on the product?

barren condor
#

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.

tranquil acorn
#

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?

barren condor
#

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.

tranquil acorn
#

Got it, thank you again.