Class Plan
- All Implemented Interfaces:
HasId
,MetadataStore<Plan>
,StripeActiveObject
,StripeObjectInterface
Plans define the base price, currency, and billing cycle for recurring purchases of products. Products help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.
For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.
Related guides: Set up a subscription and more about products and prices.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod
-
Field Summary
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON, INTERNAL_GSON
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
static Plan
create
(PlanCreateParams params) You can now model subscriptions more flexibly using the Prices API.static Plan
create
(PlanCreateParams params, RequestOptions options) You can now model subscriptions more flexibly using the Prices API.static Plan
You can now model subscriptions more flexibly using the Prices API.static Plan
create
(Map<String, Object> params, RequestOptions options) You can now model subscriptions more flexibly using the Prices API.delete()
Deleting plans means new subscribers can’t be added.delete
(RequestOptions options) Deleting plans means new subscribers can’t be added.Deleting plans means new subscribers can’t be added.delete
(Map<String, Object> params, RequestOptions options) Deleting plans means new subscribers can’t be added.boolean
Whether the plan can be used for new purchases.Specifies a usage aggregation strategy for plans ofusage_type=metered
.The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible.The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places.Describes how to compute the price per period.Time at which the object was created.Three-letter ISO currency code, in lowercase.Always true for a deleted object.getId()
Unique identifier for the object.The frequency at which a subscription is billed.The number of intervals (specified in theinterval
attribute) between subscription billings.Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.Set of key-value pairs that you can attach to an object.getMeter()
The meter tracking the usage of a metered price.A brief description of the plan, hidden from customers.String representing the object's type.Get ID of expandableproduct
object.Get expandedproduct
.getTiers()
Each element represents a pricing tier.Defines if the tiering price should begraduated
orvolume
based.Apply a transformation to the reported usage or set quantity before computing the amount billed.Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true
.Configures how the quantity per period should be determined.int
hashCode()
static PlanCollection
list
(PlanListParams params) Returns a list of your plans.static PlanCollection
list
(PlanListParams params, RequestOptions options) Returns a list of your plans.static PlanCollection
Returns a list of your plans.static PlanCollection
list
(Map<String, Object> params, RequestOptions options) Returns a list of your plans.static Plan
Retrieves the plan with the given ID.static Plan
retrieve
(String plan, RequestOptions options) Retrieves the plan with the given ID.static Plan
retrieve
(String plan, PlanRetrieveParams params, RequestOptions options) Retrieves the plan with the given ID.static Plan
Retrieves the plan with the given ID.void
Whether the plan can be used for new purchases.void
setAggregateUsage
(String aggregateUsage) Specifies a usage aggregation strategy for plans ofusage_type=metered
.void
The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible.void
setAmountDecimal
(BigDecimal amountDecimal) The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places.void
setBillingScheme
(String billingScheme) Describes how to compute the price per period.void
setCreated
(Long created) Time at which the object was created.void
setCurrency
(String currency) Three-letter ISO currency code, in lowercase.void
setDeleted
(Boolean deleted) Always true for a deleted object.void
Unique identifier for the object.void
setInterval
(String interval) The frequency at which a subscription is billed.void
setIntervalCount
(Long intervalCount) The number of intervals (specified in theinterval
attribute) between subscription billings.void
setLivemode
(Boolean livemode) Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
setMetadata
(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.void
The meter tracking the usage of a metered price.void
setNickname
(String nickname) A brief description of the plan, hidden from customers.void
String representing the object's type.void
setProduct
(String id) void
setProductObject
(Product expandableObject) void
setResponseGetter
(StripeResponseGetter responseGetter) Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.void
Each element represents a pricing tier.void
setTiersMode
(String tiersMode) Defines if the tiering price should begraduated
orvolume
based.void
setTransformUsage
(Plan.TransformUsage transformUsage) Apply a transformation to the reported usage or set quantity before computing the amount billed.void
setTrialPeriodDays
(Long trialPeriodDays) Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true
.void
setUsageType
(String usageType) Configures how the quantity per period should be determined.update
(PlanUpdateParams params) Updates the specified plan by setting the values of the parameters passed.update
(PlanUpdateParams params, RequestOptions options) Updates the specified plan by setting the values of the parameters passed.Updates the specified plan by setting the values of the parameters passed.update
(Map<String, Object> params, RequestOptions options) Updates the specified plan by setting the values of the parameters passed.Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, getGlobalResponseGetter, getResponseGetter, setExpandableFieldId, setStripeResponseGetter, urlEncode, urlEncodeId
Methods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
Plan
public Plan()
-
-
Method Details
-
getProduct
Get ID of expandableproduct
object. -
setProduct
-
getProductObject
Get expandedproduct
. -
setProductObject
-
create
You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.- Throws:
StripeException
-
create
You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.- Throws:
StripeException
-
create
You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.- Throws:
StripeException
-
create
You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.- Throws:
StripeException
-
delete
Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.- Throws:
StripeException
-
delete
Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.- Throws:
StripeException
-
delete
Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.- Throws:
StripeException
-
delete
Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.- Throws:
StripeException
-
list
Returns a list of your plans.- Throws:
StripeException
-
list
public static PlanCollection list(Map<String, Object> params, RequestOptions options) throws StripeExceptionReturns a list of your plans.- Throws:
StripeException
-
list
Returns a list of your plans.- Throws:
StripeException
-
list
public static PlanCollection list(PlanListParams params, RequestOptions options) throws StripeException Returns a list of your plans.- Throws:
StripeException
-
retrieve
Retrieves the plan with the given ID.- Throws:
StripeException
-
retrieve
Retrieves the plan with the given ID.- Throws:
StripeException
-
retrieve
public static Plan retrieve(String plan, Map<String, Object> params, RequestOptions options) throws StripeExceptionRetrieves the plan with the given ID.- Throws:
StripeException
-
retrieve
public static Plan retrieve(String plan, PlanRetrieveParams params, RequestOptions options) throws StripeException Retrieves the plan with the given ID.- Throws:
StripeException
-
update
Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or billing cycle.- Specified by:
update
in interfaceMetadataStore<Plan>
- Throws:
StripeException
-
update
Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or billing cycle.- Specified by:
update
in interfaceMetadataStore<Plan>
- Throws:
StripeException
-
update
Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or billing cycle.- Throws:
StripeException
-
update
Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or billing cycle.- Throws:
StripeException
-
setResponseGetter
Description copied from interface:StripeActiveObject
Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.- Specified by:
setResponseGetter
in interfaceStripeActiveObject
- Overrides:
setResponseGetter
in classApiResource
- Parameters:
responseGetter
- theStripeResponseGetter
instance to use for making further requests.
-
getActive
Whether the plan can be used for new purchases. -
getAggregateUsage
Specifies a usage aggregation strategy for plans ofusage_type=metered
. Allowed values aresum
for summing up all usage during a period,last_during_period
for using the last usage record reported within a period,last_ever
for using the last usage record ever (across period bounds) ormax
which uses the usage record with the maximum reported usage during a period. Defaults tosum
.One of
last_during_period
,last_ever
,max
, orsum
. -
getAmount
The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set ifbilling_scheme=per_unit
. -
getAmountDecimal
The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set ifbilling_scheme=per_unit
. -
getBillingScheme
Describes how to compute the price per period. Eitherper_unit
ortiered
.per_unit
indicates that the fixed amount (specified inamount
) will be charged per unit inquantity
(for plans withusage_type=licensed
), or per unit of total usage (for plans withusage_type=metered
).tiered
indicates that the unit pricing will be computed using a tiering strategy as defined using thetiers
andtiers_mode
attributes.One of
per_unit
, ortiered
. -
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
getCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
getDeleted
Always true for a deleted object. -
getInterval
The frequency at which a subscription is billed. One ofday
,week
,month
oryear
. -
getIntervalCount
The number of intervals (specified in theinterval
attribute) between subscription billings. For example,interval=month
andinterval_count=3
bills every 3 months. -
getLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
getMeter
The meter tracking the usage of a metered price. -
getNickname
A brief description of the plan, hidden from customers. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
plan
. -
getTiers
Each element represents a pricing tier. This parameter requiresbilling_scheme
to be set totiered
. See also the documentation forbilling_scheme
. -
getTiersMode
Defines if the tiering price should begraduated
orvolume
based. Involume
-based tiering, the maximum quantity within a period determines the per unit price. Ingraduated
tiering, pricing can change as the quantity grows.One of
graduated
, orvolume
. -
getTransformUsage
Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined withtiers
. -
getTrialPeriodDays
Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true
. -
getUsageType
Configures how the quantity per period should be determined. Can be eithermetered
orlicensed
.licensed
automatically bills thequantity
set when adding it to a subscription.metered
aggregates the total usage based on usage records. Defaults tolicensed
. -
setActive
Whether the plan can be used for new purchases. -
setAggregateUsage
Specifies a usage aggregation strategy for plans ofusage_type=metered
. Allowed values aresum
for summing up all usage during a period,last_during_period
for using the last usage record reported within a period,last_ever
for using the last usage record ever (across period bounds) ormax
which uses the usage record with the maximum reported usage during a period. Defaults tosum
.One of
last_during_period
,last_ever
,max
, orsum
. -
setAmount
The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set ifbilling_scheme=per_unit
. -
setAmountDecimal
The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set ifbilling_scheme=per_unit
. -
setBillingScheme
Describes how to compute the price per period. Eitherper_unit
ortiered
.per_unit
indicates that the fixed amount (specified inamount
) will be charged per unit inquantity
(for plans withusage_type=licensed
), or per unit of total usage (for plans withusage_type=metered
).tiered
indicates that the unit pricing will be computed using a tiering strategy as defined using thetiers
andtiers_mode
attributes.One of
per_unit
, ortiered
. -
setCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
setCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
setDeleted
Always true for a deleted object. -
setId
Unique identifier for the object. -
setInterval
The frequency at which a subscription is billed. One ofday
,week
,month
oryear
. -
setIntervalCount
The number of intervals (specified in theinterval
attribute) between subscription billings. For example,interval=month
andinterval_count=3
bills every 3 months. -
setLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
setMetadata
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. -
setMeter
The meter tracking the usage of a metered price. -
setNickname
A brief description of the plan, hidden from customers. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
plan
. -
setTiers
Each element represents a pricing tier. This parameter requiresbilling_scheme
to be set totiered
. See also the documentation forbilling_scheme
. -
setTiersMode
Defines if the tiering price should begraduated
orvolume
based. Involume
-based tiering, the maximum quantity within a period determines the per unit price. Ingraduated
tiering, pricing can change as the quantity grows.One of
graduated
, orvolume
. -
setTransformUsage
Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined withtiers
. -
setTrialPeriodDays
Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true
. -
setUsageType
Configures how the quantity per period should be determined. Can be eithermetered
orlicensed
.licensed
automatically bills thequantity
set when adding it to a subscription.metered
aggregates the total usage based on usage records. Defaults tolicensed
. -
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object. -
getMetadata
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.- Specified by:
getMetadata
in interfaceMetadataStore<Plan>
-