what is stripe metadata

What is Stripe Metadata?

I am in love with stripe. It’s featured-packed, easy to set-up, has a simple pricing, and mobile friendly to. As a web developer, it’s well documented and have lot of third party add-ons too.

One of the most salient feature that strip have is the metadata. Metadata provides an easy to associate structured data, more like an array with key-value pairing. These key-value pairs can be attached to most of the object including charges and customers.

A real world example of using stripe metadata would be getting the user’s full address after the completion of the successful charges. Address can be broken down into various fields and can be passed as follows:

"metadata" => array(
	"house_number" => "42",
	"street_name" => "XYZ Avenue", 
	"post_code" => "1111",
	"state" => "NSW" 
)

These metadata information can be stored in stripe’s server. Depending upon the requirement of your project you can either store metadata information in Stripe’s Server or store in the database too.

These metadata values can be used to filter out set of row for examples in the case above, if you need to find the charges that made by user in specific postcode area, we can query based on the post_code key and filter out the results.

Note: Stripe by default supports up to 20 keys, with key names up to 40 characters long and values up to 500 characters long.


About Author

I am Robin - WordPress Developer based in Sydney. I work as Digital Developer. I do some projects now and then, and love blogging about WordPress and Web Design.