There must be at least one valid key-value pair in metadata.
You can add a maximum of 20 primary key-value pairs to metadata. However, if you need additional entries, you can use nested keys.
A key's name can't contain more than 40 characters, and its assigned value can't exceed 500 characters. If you have values longer than this, store them in an external database and use a key-value pair in metadata to reference that external object’s identifier.
Add metadata
In applicable create and update API operations, you can add one or more key-value pairs to metadata.
Update metadata
When updating certain API resources, you can replace the value of an existing key in metadata. For example, if a shopper agrees to start receiving newsletters from your organization, you could handle that by flipping your metadata.marketingConsents.newsLetter in the customer object to true.
You can also add new key-value pairs without affecting existing data. For example, if a checkout'smetadata contains a key1 and a key2 and you add a key3, Digital River merges the new data into the existing data.
Delete metadata
To remove a key from metadata, assign it an empty string value.
Metadata in events
Digital River adds an object's metadata to related events before sending them to your webhooks. For example, when creating a checkout-session, you might decide to add a cartId to metadata.
After the customer provides payment and completes checkout, Digital River creates an event with a typeof checkout_session.order.created, adds that cartId to metadata in its data.object, and then pushes that event to any of your webhooks that have subscribed to it. Your webhook handlers can use this data in product fulfillment and other downstream processes.
Copying metadata
Digital River doesn't always transfer metadata from one related object to another. For example, if an order contains metadata, and that order is refunded, then we don't add its metadata to the refund. To do this, you'd need to write your own code that moves this data from one object to the other.
In some cases, however, Digital River handles this transfer. For example:
Checkouts to orders: When a checkoutId is passed in a create order request, then any metadata that exists in that checkout is added to the order.
Orders to fulfillments: When a fulfillment is created, any metadata in its upstream order is added to its orderDetails. If you then later update the order'smetadata, those updates are reflected in the fulfillment's orderDetails.