Add metadata on customer
Customer metadata stores additional structured information on a customer to provide more context. For example, you could store a customer’s full name and unique identifier from your system on a Customer object by defining a key-value pair. A key cannot exist without its corresponding value, and vice versa. Metadata is set through themetadata array on the customer, using the key, value and display_in_invoice fields:
Edit and delete metadata on customer
After adding metadata to a customer, you can edit or delete it. To edit metadata, you have two options:- Use the user interface to update the information displayed in the “Edit customer” drawer, and then save the customer changes.
- Use the API to target the key-value pair information with the metadata ID in your code snippet and edit the key and value.
id. Any pair you omit is removed, so include every pair you want to keep:
- Clicking on the trash icon in the user interface, and then saving the customer changes.
- Removing the key-value metadata object from your code snippet when using the API.
Display metadata in invoice object
To display customer metadata on invoices, switch on the option in the customer creation/edition drawer or setdisplay_in_invoice to true. Once this option is activated, metadata is displayed on all new finalized and downloaded invoices.
When the customer’s metadata is added/edited/removed, the change only applies to new PDF files. Existing documents are not affected.
Customer metadata limitations
- A customer can have up to 5 metadata key-value pairs.
- Keys must be strings of up to 20 characters.
- Values must be strings of up to 100 characters.