Back to

Package plan

Latest Go to latest

The latest major version is .

Published: Apr 2, 2020 | License: BSD-2-Clause | Module:


Package plan provides APIs related to plans.



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

A list of acceptable billing types.

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.

Package Files

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

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier