Back to

package paddle

Latest Go to latest
Published: Apr 2, 2020 | License: BSD-2-Clause | Module:


Package paddle is an HTTP API client for the Paddle payment processing service.

Be advised

This package is unmaintained. It does not receive support or security updates. Please do not attempt to use it in production.



const Version = "2.0"

Version is the Paddle API version that this package supports. It is exported for convenience.

func NewRoundTripper

func NewRoundTripper(transport http.RoundTripper, vendorID int, vendorAuthCode string) http.RoundTripper

NewRoundTripper wraps an existing http.RoundTripper so that any POST request using content-type application/x-www-form-urlencoded sent through it to "" will include authentication information. If a transport is nil, http.DefaultTransport is used instead.

This is a lower level API exposed for advanced users; most of the time, users will want to create a Client and then use it with one of the subpackages instead.

type Client

type Client struct {
	// contains filtered or unexported fields

Client is a paddle HTTP API client.

func NewClient

func NewClient(c *http.Client, vendorID int, vendorAuthCode string) *Client

NewClient returns a Paddle API client that wraps an existing HTTP client and adds auth support for all POST requests to the API endpoint.

func (*Client) Do

func (c *Client) Do(path string, v url.Values) (json.RawMessage, error)

Do sends an HTTP POST request to the server and decodes common response fields.

type Currency

type Currency string

Currency is an ISO 4217 currency designator.

const (
	// G10 currencies
	USD Currency = "USD"
	EUR Currency = "EUR"
	GBP Currency = "GBP"

Reexport of currencies currently supported by Paddle.

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`

Error can unmarshal the "error" field of an API response.

func (Error) Error

func (err Error) Error() string

Error implements the error interface for the Error type.

type Time

type Time time.Time

Time is a custom time type that supports marshaling and unmarshaling Paddle's custom time format that ignores the standard JSON format.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

UnmarshalJSON satisfies the json.Unmarshaler interface for Time.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier