How metadata works with related objects

Metadata which has been set on an object generally is not “inherited” by or copied to associated objects which are created at the same time. For example, a Balance Transaction will not inherit the metadata which has been previously set on the Charge that created the Balance Transaction.

There are some important exceptions. When a PaymentIntent is confirmed, Stripe will copy its metadata, along with some other fields, to the Charge that is created by the PaymentIntent. This is a one-time event, however, and subsequent updates to the PaymentIntent’s metadata will not update the metadata of the Charge, which must be updated separately.

Additionally, the metadata of an Invoice’s Line Items will be copied from the metadata of the Subscription the Invoice belongs to, for Invoice Line Items where type: ‘subscription.’

There are also some Stripe objects that have dedicated parameters for setting metadata of associated objects. Examples include: