We’re fans of Go (both the language and the
game) here at Stripe, and
it seems we’re not the only ones. In recent months, we’ve seen Go’s popularity
rise amongst our users and more generally in the open-source community, so we
decided to add an official Stripe library for Go.

Requests made to Stripe using Go in 2014

We’ve also started using more Go at Stripe internally. For example, parts of
the system that power Checkout are built in Go (and use
this library). When porting some existing services to Go, we’ve noticed 2-4x
increases in throughput (and our engineers were pretty happy with the
development process).

To get started with our Go library, go get github.com/stripe/stripe-go and then import it in your code. Here’s how you’d create a charge:

Given Go’s lack of built-in versioning, we highly recommend you use a
package management tool to avoid any unforeseen upgrades.

The library features iterator-based listing,
which handles pagination for you automatically.
We’ve also added support for injecting mocks to make testing easier.
And if you need more control, the library allows you to inject your ownhttpClient for transport-level customizations.