-
Notifications
You must be signed in to change notification settings - Fork 448
/
plan.go
62 lines (56 loc) · 2.62 KB
/
plan.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package stripe
// PlanInterval is the list of allowed values for a plan's interval.
// Allowed values are "day", "week", "month", "year".
type PlanInterval string
// Plan is the resource representing a Stripe plan.
// For more details see https://stripe.com/docs/api#plans.
type Plan struct {
Amount uint64 `json:"amount"`
Created int64 `json:"created"`
Currency Currency `json:"currency"`
Deleted bool `json:"deleted"`
ID string `json:"id"`
Interval PlanInterval `json:"interval"`
IntervalCount uint64 `json:"interval_count"`
Live bool `json:"livemode"`
Meta map[string]string `json:"metadata"`
Nickname string `json:"nickname"`
Product string `json:"product"`
TrialPeriod uint64 `json:"trial_period_days"`
}
// PlanList is a list of plans as returned from a list endpoint.
type PlanList struct {
ListMeta
Values []*Plan `json:"data"`
}
// PlanListParams is the set of parameters that can be used when listing plans.
// For more details see https://stripe.com/docs/api#list_plans.
type PlanListParams struct {
ListParams `form:"*"`
Created int64 `form:"created"`
CreatedRange *RangeQueryParams `form:"created"`
}
// PlanParams is the set of parameters that can be used when creating or updating a plan.
// For more details see https://stripe.com/docs/api#create_plan and https://stripe.com/docs/api#update_plan.
type PlanParams struct {
Params `form:"*"`
Amount uint64 `form:"amount"`
AmountZero bool `form:"amount,zero"`
Currency Currency `form:"currency"`
ID string `form:"id"`
Interval PlanInterval `form:"interval"`
IntervalCount uint64 `form:"interval_count"`
Nickname string `form:"nickname"`
Product *PlanProductParams `form:"product"`
ProductID *string `form:"product"`
TrialPeriod uint64 `form:"trial_period_days"`
}
// PlanProductParams is the set of parameters that can be used when creating a product inside a plan
// This can only be used on plan creation and won't work on plan update.
// For more details see https://stripe.com/docs/api#create_plan-product and https://stripe.com/docs/api#update_plan-product
type PlanProductParams struct {
ID string `form:"id"`
Name string `form:"name"`
Meta map[string]string `form:"metadata"`
StatementDescriptor string `form:"statement_descriptor"`
}