diff --git a/stripe.go b/stripe.go index 9bec505def..ba113a97d8 100644 --- a/stripe.go +++ b/stripe.go @@ -1116,8 +1116,7 @@ func Int64Slice(v []int64) []*int64 { return out } -// NewBackends creates a new set of backends with the given HTTP client. You -// should only need to use this for testing purposes or on App Engine. +// NewBackends creates a new set of backends with the given HTTP client. func NewBackends(httpClient *http.Client) *Backends { apiConfig := &BackendConfig{HTTPClient: httpClient} connectConfig := &BackendConfig{HTTPClient: httpClient} @@ -1129,6 +1128,16 @@ func NewBackends(httpClient *http.Client) *Backends { } } +// NewBackendsWithConfig creates a new set of backends with the given config for all backends. +// Useful for setting up client with a custom logger and http client. +func NewBackendsWithConfig(config *BackendConfig) *Backends { + return &Backends{ + API: GetBackendWithConfig(APIBackend, config), + Connect: GetBackendWithConfig(ConnectBackend, config), + Uploads: GetBackendWithConfig(UploadsBackend, config), + } +} + // ParseID attempts to parse a string scalar from a given JSON value which is // still encoded as []byte. If the value was a string, it returns the string // along with true as the second return value. If not, false is returned as the