Stripe's 30 Little Secrets to Payment Automation

Adam DuVander
Aug. 01 2012, 10:00AM EDT

In a relatively short time, the Stripe API has become a popular choice amongst developers wanting to incorporate payments into their apps. While its simple documentation and quick setup have received most of the attention, it's also a robust platform. Among the features that have endeared it to developers are events, which use webhooks to update apps on incidents of note.

"These are not payment notifications, these are change notifications for the object that you're interested in," said Stripe's Anurag Goel. There are at least 30 event types that Stripe sends to developers who have configured webhooks. The events all occur on particular resources, such as a customer, an invoice or a charge.

Knowing that a charge is approved is an integral part of any payment platform. That is part of Stripe's event system, but it took a more generic approach when it re-wrote its webhook implementation early this year. Announced in February, Goel said the new system was motivated by recurring billing feature requests from its users.

In addition to Stripe pushing events via webhook, developers can also pull events via the API. The company keeps at least 30 days of events in its archive. Every event is timestamped and has a unique identifier, as well as a considerable amount of meta-data.

Even with webhooks, developers end up using the events object in Stripe. That's due to the concern about authenticity of notifications. If someone has your webhook URL, they could spoof events. However, every time Stripe sends an event to your webhook, you're expected to reply back to get the details of the event, closing the loop and ensuring accurate data.

At least two of the Stripe events are seemingly unrelated to payments, but show how the company is taking a holistic view of automation. On a regular schedule, Stripe deposits money directly into developers' bank accounts. At that point, it becomes real money. There's an event for new transfers and, perhaps more important, for failed transfers.

Stripe understands that developers are building companies on top of its API. Automation is something that both developers and businesspeople understand. Stripe's webhooks and events systems are bound to please both groups.

Adam DuVander -- Adam heads developer relations at Orchestrate, a database-as-a-service company. He's spent many years analyzing APIs and developer tools. Previously he worked at SendGrid, edited ProgrammableWeb and wrote for Wired and Webmonkey. Adam is also the author of mapping API cookbook Map Scripting 101.

Comments