Package com.stripe.model
Class Plan
- java.lang.Object
-
- com.stripe.model.StripeObject
-
- com.stripe.net.ApiResource
-
- com.stripe.model.Plan
-
- All Implemented Interfaces:
HasId
,MetadataStore<Plan>
,StripeObjectInterface
public class Plan extends ApiResource implements HasId, MetadataStore<Plan>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Plan.Tier
static class
Plan.TransformUsage
-
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod
-
-
Field Summary
-
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON
-
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
-
Constructor Summary
Constructors Constructor Description Plan()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(java.lang.Object other)
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
create(java.util.Map<java.lang.String,java.lang.Object> params)
You can now model subscriptions more flexibly using the Prices API.static Plan
create(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
You can now model subscriptions more flexibly using the Prices API.Plan
delete()
Deleting plans means new subscribers can’t be added.Plan
delete(RequestOptions options)
Deleting plans means new subscribers can’t be added.Plan
delete(java.util.Map<java.lang.String,java.lang.Object> params)
Deleting plans means new subscribers can’t be added.Plan
delete(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
Deleting plans means new subscribers can’t be added.boolean
equals(java.lang.Object o)
java.lang.Boolean
getActive()
Whether the plan can be used for new purchases.java.lang.String
getAggregateUsage()
Specifies a usage aggregation strategy for plans ofusage_type=metered
.java.lang.Long
getAmount()
The unit amount in %s to be charged, represented as a whole integer if possible.java.math.BigDecimal
getAmountDecimal()
The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places.java.lang.String
getBillingScheme()
Describes how to compute the price per period.java.lang.Long
getCreated()
Time at which the object was created.java.lang.String
getCurrency()
Three-letter ISO currency code, in lowercase.java.lang.Boolean
getDeleted()
Always true for a deleted object.java.lang.String
getId()
Unique identifier for the object.java.lang.String
getInterval()
The frequency at which a subscription is billed.java.lang.Long
getIntervalCount()
The number of intervals (specified in theinterval
attribute) between subscription billings.java.lang.Boolean
getLivemode()
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.java.util.Map<java.lang.String,java.lang.String>
getMetadata()
Set of key-value pairs that you can attach to an object.java.lang.String
getNickname()
A brief description of the plan, hidden from customers.java.lang.String
getObject()
String representing the object's type.java.lang.String
getProduct()
Get ID of expandableproduct
object.Product
getProductObject()
Get expandedproduct
.java.util.List<Plan.Tier>
getTiers()
Each element represents a pricing tier.java.lang.String
getTiersMode()
Defines if the tiering price should begraduated
orvolume
based.Plan.TransformUsage
getTransformUsage()
Apply a transformation to the reported usage or set quantity before computing the amount billed.java.lang.Long
getTrialPeriodDays()
Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true
.java.lang.String
getUsageType()
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
list(java.util.Map<java.lang.String,java.lang.Object> params)
Returns a list of your plans.static PlanCollection
list(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
Returns a list of your plans.static Plan
retrieve(java.lang.String plan)
Retrieves the plan with the given ID.static Plan
retrieve(java.lang.String plan, RequestOptions options)
Retrieves the plan with the given ID.static Plan
retrieve(java.lang.String plan, PlanRetrieveParams params, RequestOptions options)
Retrieves the plan with the given ID.static Plan
retrieve(java.lang.String plan, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
Retrieves the plan with the given ID.void
setActive(java.lang.Boolean active)
Whether the plan can be used for new purchases.void
setAggregateUsage(java.lang.String aggregateUsage)
Specifies a usage aggregation strategy for plans ofusage_type=metered
.void
setAmount(java.lang.Long amount)
The unit amount in %s to be charged, represented as a whole integer if possible.void
setAmountDecimal(java.math.BigDecimal amountDecimal)
The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places.void
setBillingScheme(java.lang.String billingScheme)
Describes how to compute the price per period.void
setCreated(java.lang.Long created)
Time at which the object was created.void
setCurrency(java.lang.String currency)
Three-letter ISO currency code, in lowercase.void
setDeleted(java.lang.Boolean deleted)
Always true for a deleted object.void
setId(java.lang.String id)
Unique identifier for the object.void
setInterval(java.lang.String interval)
The frequency at which a subscription is billed.void
setIntervalCount(java.lang.Long intervalCount)
The number of intervals (specified in theinterval
attribute) between subscription billings.void
setLivemode(java.lang.Boolean livemode)
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
Set of key-value pairs that you can attach to an object.void
setNickname(java.lang.String nickname)
A brief description of the plan, hidden from customers.void
setObject(java.lang.String object)
String representing the object's type.void
setProduct(java.lang.String id)
void
setProductObject(Product expandableObject)
void
setTiers(java.util.List<Plan.Tier> tiers)
Each element represents a pricing tier.void
setTiersMode(java.lang.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(java.lang.Long trialPeriodDays)
Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true
.void
setUsageType(java.lang.String usageType)
Configures how the quantity per period should be determined.Plan
update(PlanUpdateParams params)
Updates the specified plan by setting the values of the parameters passed.Plan
update(PlanUpdateParams params, RequestOptions options)
Updates the specified plan by setting the values of the parameters passed.Plan
update(java.util.Map<java.lang.String,java.lang.Object> params)
Updates the specified plan by setting the values of the parameters passed.Plan
update(java.util.Map<java.lang.String,java.lang.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, classUrl, classUrl, instanceUrl, instanceUrl, request, request, requestCollection, requestCollection, setExpandableFieldId, setStripeResponseGetter, singleClassUrl, singleClassUrl, subresourceUrl, urlEncode, urlEncodeId
-
Methods inherited from class com.stripe.model.StripeObject
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
-
-
-
-
Method Detail
-
getProduct
public java.lang.String getProduct()
Get ID of expandableproduct
object.
-
setProduct
public void setProduct(java.lang.String id)
-
getProductObject
public Product getProductObject()
Get expandedproduct
.
-
setProductObject
public void setProductObject(Product expandableObject)
-
list
public static PlanCollection list(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
Returns a list of your plans.- Throws:
StripeException
-
list
public static PlanCollection list(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Returns a list of your plans.- Throws:
StripeException
-
list
public static PlanCollection list(PlanListParams params) throws StripeException
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
-
create
public static Plan create(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
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
public static Plan create(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
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
public static Plan create(PlanCreateParams params) throws StripeException
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
public static Plan create(PlanCreateParams params, RequestOptions options) throws StripeException
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
-
retrieve
public static Plan retrieve(java.lang.String plan) throws StripeException
Retrieves the plan with the given ID.- Throws:
StripeException
-
retrieve
public static Plan retrieve(java.lang.String plan, RequestOptions options) throws StripeException
Retrieves the plan with the given ID.- Throws:
StripeException
-
retrieve
public static Plan retrieve(java.lang.String plan, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Retrieves the plan with the given ID.- Throws:
StripeException
-
retrieve
public static Plan retrieve(java.lang.String plan, PlanRetrieveParams params, RequestOptions options) throws StripeException
Retrieves the plan with the given ID.- Throws:
StripeException
-
update
public Plan update(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
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
public Plan update(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
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
public Plan update(PlanUpdateParams params) throws StripeException
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
public Plan update(PlanUpdateParams params, RequestOptions options) throws StripeException
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
-
delete
public Plan delete() throws StripeException
Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.- Throws:
StripeException
-
delete
public Plan delete(RequestOptions options) throws StripeException
Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.- Throws:
StripeException
-
delete
public Plan delete(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeException
Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.- Throws:
StripeException
-
delete
public Plan delete(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.- Throws:
StripeException
-
getActive
public java.lang.Boolean getActive()
Whether the plan can be used for new purchases.
-
getAggregateUsage
public java.lang.String 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
public java.lang.Long getAmount()
The unit amount in %s to be charged, represented as a whole integer if possible. Only set ifbilling_scheme=per_unit
.
-
getAmountDecimal
public java.math.BigDecimal getAmountDecimal()
The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set ifbilling_scheme=per_unit
.
-
getBillingScheme
public java.lang.String 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
public java.lang.Long getCreated()
Time at which the object was created. Measured in seconds since the Unix epoch.
-
getCurrency
public java.lang.String getCurrency()
Three-letter ISO currency code, in lowercase. Must be a supported currency.
-
getDeleted
public java.lang.Boolean getDeleted()
Always true for a deleted object.
-
getInterval
public java.lang.String getInterval()
The frequency at which a subscription is billed. One ofday
,week
,month
oryear
.
-
getIntervalCount
public java.lang.Long getIntervalCount()
The number of intervals (specified in theinterval
attribute) between subscription billings. For example,interval=month
andinterval_count=3
bills every 3 months.
-
getLivemode
public java.lang.Boolean getLivemode()
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.
-
getNickname
public java.lang.String getNickname()
A brief description of the plan, hidden from customers.
-
getObject
public java.lang.String getObject()
String representing the object's type. Objects of the same type share the same value.Equal to
plan
.
-
getTiers
public java.util.List<Plan.Tier> getTiers()
Each element represents a pricing tier. This parameter requiresbilling_scheme
to be set totiered
. See also the documentation forbilling_scheme
.
-
getTiersMode
public java.lang.String 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
public Plan.TransformUsage getTransformUsage()
Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined withtiers
.
-
getTrialPeriodDays
public java.lang.Long getTrialPeriodDays()
Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true
.
-
getUsageType
public java.lang.String 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
public void setActive(java.lang.Boolean active)
Whether the plan can be used for new purchases.
-
setAggregateUsage
public void setAggregateUsage(java.lang.String aggregateUsage)
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
public void setAmount(java.lang.Long amount)
The unit amount in %s to be charged, represented as a whole integer if possible. Only set ifbilling_scheme=per_unit
.
-
setAmountDecimal
public void setAmountDecimal(java.math.BigDecimal amountDecimal)
The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set ifbilling_scheme=per_unit
.
-
setBillingScheme
public void setBillingScheme(java.lang.String billingScheme)
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
public void setCreated(java.lang.Long created)
Time at which the object was created. Measured in seconds since the Unix epoch.
-
setCurrency
public void setCurrency(java.lang.String currency)
Three-letter ISO currency code, in lowercase. Must be a supported currency.
-
setDeleted
public void setDeleted(java.lang.Boolean deleted)
Always true for a deleted object.
-
setId
public void setId(java.lang.String id)
Unique identifier for the object.
-
setInterval
public void setInterval(java.lang.String interval)
The frequency at which a subscription is billed. One ofday
,week
,month
oryear
.
-
setIntervalCount
public void setIntervalCount(java.lang.Long intervalCount)
The number of intervals (specified in theinterval
attribute) between subscription billings. For example,interval=month
andinterval_count=3
bills every 3 months.
-
setLivemode
public void setLivemode(java.lang.Boolean livemode)
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.
-
setMetadata
public void setMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)
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.
-
setNickname
public void setNickname(java.lang.String nickname)
A brief description of the plan, hidden from customers.
-
setObject
public void setObject(java.lang.String object)
String representing the object's type. Objects of the same type share the same value.Equal to
plan
.
-
setTiers
public void setTiers(java.util.List<Plan.Tier> tiers)
Each element represents a pricing tier. This parameter requiresbilling_scheme
to be set totiered
. See also the documentation forbilling_scheme
.
-
setTiersMode
public void setTiersMode(java.lang.String tiersMode)
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
public void setTransformUsage(Plan.TransformUsage transformUsage)
Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined withtiers
.
-
setTrialPeriodDays
public void setTrialPeriodDays(java.lang.Long trialPeriodDays)
Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true
.
-
setUsageType
public void setUsageType(java.lang.String usageType)
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
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getId
public java.lang.String getId()
Unique identifier for the object.
-
getMetadata
public java.util.Map<java.lang.String,java.lang.String> 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>
-
-