Blog

Partager cet article sur Twitter

Adding context with metadata

Kiran Bhattaram on October 30, 2013

We’ve long supported a description parameter on Stripe objects like charges and customers—it’s a convenient place to add human-readable info. Since descriptions can be searched and viewed in the dashboard, they generally make Stripe easier to use.

We’ve noticed a lot of users resorting to embedding JSON in the description to annotate Stripe objects with more robust data such as user IDs, product sizing or color, delivery dates, shipping status, tax information, etc.

Now, we’re making it easier to associate structured data with Stripe objects. With our new metadata support, you can directly attach key-value pairs to charges, customers, and most other objects. As with descriptions, this data can be searched and viewed in the dashboard. The API is straightforward:

curl https://api.stripe.com/v1/charges/charge_id \
   -u api_key: \
   -d "metadata[order_id]=132ad31" \
   -d "metadata[shipping_tracking]=1Z9498297793814938"

Metadata helps you store the info that’s most useful for your business, and we hope that it makes it easier to reconcile Stripe objects with your databases and systems. Please let us know what you think!