Version: v0.0.3 Latest Latest

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

Go to latest
Published: Apr 2, 2020 License: BSD-2-Clause Imports: 6 Imported by: 0



Package plan provides APIs related to plans.



View Source
const (
	BillingDaily   = "day"
	BillingWeekly  = "week"
	BillingMonthly = "month"
	BillingYearly  = "year"

A list of acceptable billing types.


This section is empty.


This section is empty.


type BillingType

type BillingType string

BillingType represents a frequency at which the plan can be billed.

type Client

type Client struct {

Client performs API operations.

func (Client) Create

func (c Client) Create(plan *Plan) (id uint64, err error)

Create makes a new plan.

func (Client) Get

func (c Client) Get(plan uint64) (*Plan, error)

Get returns a single plan by its ID.

func (Client) List

func (c Client) List() (Iter, error)

List returns an iterator over all of the existing plans.

type Iter

type Iter struct {
	// contains filtered or unexported fields

Iter provides a mechanism for lazily decoding and iterating over a list of plans.

func (Iter) Decode

func (c Iter) Decode() (*Plan, error)

Decode returns the next plan.

func (Iter) Next

func (c Iter) Next() bool

Next returns true if there are more plans to decode.

type Plan

type Plan struct {
	ID             uint64                      `json:"id"`
	Name           string                      `json:"name"`
	BillingType    BillingType                 `json:"billing_type"`
	BillingPeriod  uint                        `json:"billing_period"`
	InitialPrice   map[paddle.Currency]float64 `json:"initial_price"`
	RecurringPrice map[paddle.Currency]float64 `json:"recurring_price"`
	TrialDays      uint                        `json:"trial_days"`

	// Used to pick an InitialPrice and RecurringPrice when creating a plan.
	// Not part of the plan list response.
	MainCurrency paddle.Currency `json:"-"`

Plan represents a subscription plan.

Source Files

Jump to

Keyboard shortcuts

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