stripe

package
v0.0.0-...-3024301 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version         = "2018-09-24"
	DefaultCurrency = "usd"
	DefaultBaseURL  = "https://api.stripe.com/v1"
)
View Source
const (
	ErrTypeCardError      = "card_error"
	ErrTypeInvalidRequest = "invalid_request_error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoGenerated

type AutoGenerated struct {
	Error struct {
		Code    string `json:"code"`
		DocURL  string `json:"doc_url"`
		Message string `json:"message"`
		Param   string `json:"param"`
		Type    string `json:"type"`
	} `json:"error"`
}

type Charge

type Charge struct {
	ID             string `json:"id"`
	Amount         int    `json:"amount"`
	FailureCode    string `json:"failure_code"`
	FailureMessage string `json:"failure_message"`
	Paid           bool   `json:"paid"`
	Status         string `json:"status"`
}

type Client

type Client struct {
	Key        string
	BaseURL    string
	HttpClient interface {
		Do(*http.Request) (*http.Response, error)
	}
}

func (*Client) Charge

func (c *Client) Charge(customerID string, amount int) (*Charge, error)

func (*Client) Customer

func (c *Client) Customer(token, email string) (*Customer, error)

type Customer

type Customer struct {
	ID            string `json:"id"`
	DefaultSource string `json:"default_source"`
	Email         string `json:"email"`
}

type Error

type Error struct {
	Code    string `json:"code"`
	DocURL  string `json:"doc_url"`
	Message string `json:"message"`
	Param   string `json:"param"`
	Type    string `json:"type"`
}

func (Error) Error

func (err Error) Error() string

func (Error) MarshalJSON

func (err Error) MarshalJSON() ([]byte, error)

func (*Error) UnmarshalJSON

func (err *Error) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL