Documentation ¶
Index ¶
- Variables
- func BaseURL() string
- func CleanAccounts(ctx context.Context, c *Client, f func(Account) bool) error
- func Dedup(ctx context.Context, key string, logf func(string, ...any), ...) (winner bool, err error)
- func IsLiveKey(key string) bool
- func Link(live bool, accountID string, parts ...string) (string, error)
- func MakeID(parts ...string) string
- func MaybeSet[T comparable](f *Form, key string, val T)
- func Slurp[I Identifiable](ctx context.Context, c *Client, method, path string, f Form) ([]I, error)
- type Account
- type AccountParams
- type Client
- type Error
- type Form
- type ID
- type Identifiable
- type Iterator
- type JustID
- type Meta
Constants ¶
This section is empty.
Variables ¶
var (
)var (
ErrInvalidAPIKey = errors.New("stripe: Invalid API Key")
)
var ErrNotFound = errors.New("stripe: not found")
Functions ¶
func CleanAccounts ¶ added in v0.5.2
func Link ¶ added in v0.5.2
Link creates and returns a link to the Stripe dashboard for the provided accountID followed by parts.
If live is true, a link to the live dashboard is returned, otherwise a test link is returned.
func MaybeSet ¶ added in v0.6.0
func MaybeSet[T comparable](f *Form, key string, val T)
Types ¶
type Account ¶ added in v0.5.0
func CreateAccount ¶ added in v0.5.0
CreateAccount creates a new connected standard account.
type AccountParams ¶ added in v0.5.2
type Client ¶
type Client struct { APIKey string BaseURL string HTTPClient *http.Client AccountID string Logf func(format string, args ...any) // KeyPrefix is prepended to all idempotentcy keys. Use a new key prefix // after deleting test data. It is not recommended for use with live mode. KeyPrefix string Version string // default is 2022-11-15 }
type Error ¶
type Form ¶
type Form struct {
// contains filtered or unexported fields
}
Form maps a string key to a list of values. It is intended for use when building request bodies for Stripe requests.
func (*Form) Add ¶
Add creates a key and value from args and adds the value to the key. The key is constructed from all values in args up until the final, which will be used as the value.
Values are converted to strings according to fmt.Sprint rules, with the exception of time.Time values, which are converted to unix time (seconds since epoch).
Example mapping:
f.Add("tiers", 0, "up_to", 3) // => "tiers[0][up_to]=3" f.Add("metadata", "link", "http://example.com") // => "metadata[link]=http://example.com" f.Add("product[name]", "foo") // => "product[name]=foo" f.Add("started", time.Unix(10, 0)) // => "started=10"
func (*Form) Encode ¶
Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux") sorted by key.
func (*Form) SetIdempotencyKey ¶
type Identifiable ¶
type Identifiable interface {
ProviderID() string
}
type Iterator ¶
type Iterator[I Identifiable] struct { // contains filtered or unexported fields }