TopGit
GitHub Repo Review

Stripe Go SDK: Official Go Client for Stripe API

stripe/stripe-go
STopGit review image for stripe/stripe-go
Review by Topgit.dev for stripe/stripe-go, with GitHub repository stats and README context.
Quick verdict

Stripe Go SDK is the official Go client library Stripe maintains for its payment API, built today for Go 1.22 and newer. It wraps Stripe's REST surface in typed structs behind one stripe.Client, so retries and idempotency come built in, not hand-rolled. Reach for it if you're building a Go service that talks to Stripe directly; skip it if a higher-level platform already handles Stripe for you.

Stars
★ 2.7k
Forks
⑂ 539
Language
Go
License
MIT
Topic
—
Updated
Nov 2026
Homepage
GitHub

What is the Official Stripe Go SDK?

Stripe Go SDK is the official stripe/stripe-go repository, a Go module that wraps Stripe's REST API in typed request and response structs. It offers two ways to call the API: a newer stripe.Client, introduced in v82.1, that groups resources under fields like V1Customers and V1PaymentIntents, and an older per-resource pattern that Stripe now marks deprecated but still supports.

Streamlining Stripe API Integration in Go

Calling Stripe's REST API straight from Go without a client library means owning your own HTTP layer: setting the Stripe-Account header for Connect requests, retrying safely when a charge attempt gets a 409 Conflict instead of double-billing a card, and hand-updating structs every time Stripe adds a field to a resource. That's real, recurring work. stripe-go replaces it with versioned, typed packages, currently pinned to v86 in the import path, so a Customer, PaymentIntent, or Event decodes straight into a Go struct, and idempotency keys get attached to retried requests without you writing that logic yourself.

Core Capabilities of the Stripe Go Library

  • ✓Two call patterns: the current stripe.Client, introduced in v82.1, groups resources under fields like V1Customers and V1PaymentIntents, while the older per-package pattern (customer.New, customer.Get) still runs but is marked deprecated.
  • ✓Automatic retries on connection errors, timeouts, and 409 Conflict responses, with idempotency keys attached so a retried request can't double-charge a card; the default is two retries, configurable through MaxNetworkRetries.
  • ✓AddExpand pulls in a full nested resource, like a Customer attached to a Charge, instead of leaving you with just its ID.
  • ✓AddExtra sends parameters the typed structs don't cover yet, straight through to Stripe's API.
  • ✓Beta and alpha preview releases, with version suffixes like v83.1.0-beta.1, plus stripe.AddBetaVersion for setting a named beta header on preview features.
  • ✓A rawrequest package, available from version 80 onward, for sending requests to endpoints the typed client doesn't wrap.
  • ✓Configurable leveled logging that plugs into Logrus or Zap's SugaredLogger, plus a LastResponse field on every APIResource for pulling the request ID Stripe assigned.
  • ✓Telemetry covering request latency and feature usage ships on by default and can be turned off through BackendConfig.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history ↗

Installing the Stripe Go SDK

stripe-go distributes as a Go module, so once your project has a go.mod file you can import it directly, for example import "github.com/stripe/stripe-go/v86" and "github.com/stripe/stripe-go/v86/customer", then build, install, or test as usual and the Go toolchain fetches the module on its own. If you want it fetched ahead of time, run go get -u github.com/stripe/stripe-go/v86. Note the major version lives inside the import path itself (v86 here), so moving to a new major version later means editing that path, not just a version number in go.mod.

Working with Stripe Resources in Go

With the current stripe.Client pattern, you build one client and call typed methods off it, for example client := stripe.NewClient(secretKey) followed by cust, err := client.V1Customers.Retrieve(context.TODO(), customerID, &stripe.CustomerRetrieveParams{}). Iterating a list uses Go's newer range-over-func iterators, so you range straight over client.V1Events.List(context.TODO(), &stripe.EventListParams{}) and check the error inside the loop body, instead of calling a separate .Err() method afterward the way the older client.API pattern requires. Sending an authenticated Stripe-Account header on a Connect call works the same way: call SetStripeAccount() on the params struct before making the call.

Ideal Users for Stripe Go

Stripe Go SDK fits a Go team integrating Stripe payments directly into their own backend, not through a low-code or hosted-checkout layer. It's a good match if you're already on Go 1.22 or newer and want typed request and response structs plus built-in retry and idempotency handling instead of writing that yourself. This isn't a beginner tool. Skip it if your project is stuck on an older Go release the current SDK doesn't support, or if you'd rather have Stripe's hosted Checkout or a higher-level platform handle the integration for you.

Strengths

  • ✓Typed structs for every resource mean a wrong field name fails at compile time instead of surfacing as a JSON surprise in production.
  • ✓Retries and idempotency keys are handled for you on connection errors and 409 Conflict responses, which is easy to get wrong when you write that logic by hand.
  • ✓AddExtra and the rawrequest package give you a path to undocumented or preview endpoints without waiting for the typed client to catch up.
  • ✓MIT license, so there's no copyleft concern about linking stripe-go into a proprietary Go backend.
  • ✓A Discord server puts you in touch with Stripe engineers directly, not just a support ticket queue.

Important Considerations and Deprecations

  • △The repository's Development section carries a warning that new, first-time contributors currently can't submit outside pull requests; opening an issue is the suggested path instead.
  • △New code and fixes land only on the current major version; once Stripe ships a newer major, older ones keep working but stop getting updates, security patches included.
  • △The legacy client.API resource pattern still works but is marked deprecated in favor of stripe.Client, introduced in v82.1, and the README says it doesn't cover Stripe's V2 APIs at all.
  • △Preview releases carry real risk: the README notes breaking changes can land between two preview builds without a major-version bump.
  • △Telemetry ships on by default; opting out means explicitly setting EnableTelemetry to false on BackendConfig yourself.

Other Go Options for Payment Processing

Adyen Go API Library — Adyen's own official Go client for its payment platform, a direct official-SDK alternative if you're comparing processors rather than committing to Stripe.Square's Go SDK — Square publishes its own official Go client for its payments API, worth a look if your business already runs on Square in-person or online.PayPal — Go support comes from community-maintained clients rather than an official PayPal SDK, so expect less polish and slower updates than stripe-go's first-party support.Braintree — PayPal's other processor; like PayPal itself, Go access runs through community libraries instead of an official client.

Common Questions About Stripe Go

What Go versions does stripe-go support?

Per Stripe's own Language Version Support Policy, stripe-go tracks 4 of the most recently released Go versions at any given time; right now that floor is Go 1.22+.

How do I test Stripe webhooks in Go?

Call stripe.GenerateTestSignedPayload to build a mock signed webhook event against a test secret, then run the result through stripe.ConstructEvent the same way your real handler would, and check the returned event before processing it.

Can I disable telemetry in the Stripe Go SDK?

Yes. Stripe Go SDK sends request-latency and feature-usage telemetry by default, but setting EnableTelemetry to false on BackendConfig turns it off.

What is the license for stripe-go?

stripe-go is released under the MIT license, as shown on its GitHub repository page.

How do I use preview features in the Stripe Go SDK?

Install a beta or alpha suffixed release, such as v83.1.0-beta.1, from the repository's releases page, then call stripe.AddBetaVersion for any feature that needs a named beta header; on a release version you can instead set that header by hand per request.

Is the legacy client pattern still supported in stripe-go?

Yes, the older client.API resource pattern still runs and hasn't been removed, but Stripe marks it deprecated in favor of stripe.Client and points to a migration guide for moving off it.

Best use cases

  • •A Go backend that creates PaymentIntents and Customers directly against Stripe's API instead of going through a hosted checkout page.
  • •A marketplace or platform app using Stripe Connect, where SetStripeAccount() lets a call run under a connected account's ID instead of your own.
  • •A webhook receiver that needs to verify Stripe's signature on incoming events before trusting the payload.
  • •A Google AppEngine service, where the README documents building a per-request client with urlfetch.Client instead of the default HTTP client.
  • •Testing Stripe integration logic locally against stripe-mock instead of hitting Stripe's real API in CI.

Related repositories

Source & attribution

Facts and code patterns sourced from the stripe/stripe-go GitHub repository and its README.

GitHub data · last synced Aug 14, 2026Reviewed by Henry
← Back to TopGit

Curious whether stripe-go is right for you?

Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about stripe-go.

GitHub