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 classPlan.Tierstatic classPlan.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 booleancanEqual(java.lang.Object other)static Plancreate(PlanCreateParams params)You can now model subscriptions more flexibly using the Prices API.static Plancreate(PlanCreateParams params, RequestOptions options)You can now model subscriptions more flexibly using the Prices API.static Plancreate(java.util.Map<java.lang.String,java.lang.Object> params)You can now model subscriptions more flexibly using the Prices API.static Plancreate(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)You can now model subscriptions more flexibly using the Prices API.Plandelete()Deleting plans means new subscribers can’t be added.Plandelete(RequestOptions options)Deleting plans means new subscribers can’t be added.Plandelete(java.util.Map<java.lang.String,java.lang.Object> params)Deleting plans means new subscribers can’t be added.Plandelete(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)Deleting plans means new subscribers can’t be added.booleanequals(java.lang.Object o)java.lang.BooleangetActive()Whether the plan can be used for new purchases.java.lang.StringgetAggregateUsage()Specifies a usage aggregation strategy for plans ofusage_type=metered.java.lang.LonggetAmount()The unit amount in %s to be charged, represented as a whole integer if possible.java.math.BigDecimalgetAmountDecimal()The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places.java.lang.StringgetBillingScheme()Describes how to compute the price per period.java.lang.LonggetCreated()Time at which the object was created.java.lang.StringgetCurrency()Three-letter ISO currency code, in lowercase.java.lang.BooleangetDeleted()Always true for a deleted object.java.lang.StringgetId()Unique identifier for the object.java.lang.StringgetInterval()The frequency at which a subscription is billed.java.lang.LonggetIntervalCount()The number of intervals (specified in theintervalattribute) between subscription billings.java.lang.BooleangetLivemode()Has the valuetrueif the object exists in live mode or the valuefalseif 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.StringgetNickname()A brief description of the plan, hidden from customers.java.lang.StringgetObject()String representing the object's type.java.lang.StringgetProduct()Get ID of expandableproductobject.ProductgetProductObject()Get expandedproduct.java.util.List<Plan.Tier>getTiers()Each element represents a pricing tier.java.lang.StringgetTiersMode()Defines if the tiering price should begraduatedorvolumebased.Plan.TransformUsagegetTransformUsage()Apply a transformation to the reported usage or set quantity before computing the amount billed.java.lang.LonggetTrialPeriodDays()Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true.java.lang.StringgetUsageType()Configures how the quantity per period should be determined.inthashCode()static PlanCollectionlist(PlanListParams params)Returns a list of your plans.static PlanCollectionlist(PlanListParams params, RequestOptions options)Returns a list of your plans.static PlanCollectionlist(java.util.Map<java.lang.String,java.lang.Object> params)Returns a list of your plans.static PlanCollectionlist(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)Returns a list of your plans.static Planretrieve(java.lang.String plan)Retrieves the plan with the given ID.static Planretrieve(java.lang.String plan, RequestOptions options)Retrieves the plan with the given ID.static Planretrieve(java.lang.String plan, PlanRetrieveParams params, RequestOptions options)Retrieves the plan with the given ID.static Planretrieve(java.lang.String plan, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)Retrieves the plan with the given ID.voidsetActive(java.lang.Boolean active)Whether the plan can be used for new purchases.voidsetAggregateUsage(java.lang.String aggregateUsage)Specifies a usage aggregation strategy for plans ofusage_type=metered.voidsetAmount(java.lang.Long amount)The unit amount in %s to be charged, represented as a whole integer if possible.voidsetAmountDecimal(java.math.BigDecimal amountDecimal)The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places.voidsetBillingScheme(java.lang.String billingScheme)Describes how to compute the price per period.voidsetCreated(java.lang.Long created)Time at which the object was created.voidsetCurrency(java.lang.String currency)Three-letter ISO currency code, in lowercase.voidsetDeleted(java.lang.Boolean deleted)Always true for a deleted object.voidsetId(java.lang.String id)Unique identifier for the object.voidsetInterval(java.lang.String interval)The frequency at which a subscription is billed.voidsetIntervalCount(java.lang.Long intervalCount)The number of intervals (specified in theintervalattribute) between subscription billings.voidsetLivemode(java.lang.Boolean livemode)Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.voidsetMetadata(java.util.Map<java.lang.String,java.lang.String> metadata)Set of key-value pairs that you can attach to an object.voidsetNickname(java.lang.String nickname)A brief description of the plan, hidden from customers.voidsetObject(java.lang.String object)String representing the object's type.voidsetProduct(java.lang.String id)voidsetProductObject(Product expandableObject)voidsetTiers(java.util.List<Plan.Tier> tiers)Each element represents a pricing tier.voidsetTiersMode(java.lang.String tiersMode)Defines if the tiering price should begraduatedorvolumebased.voidsetTransformUsage(Plan.TransformUsage transformUsage)Apply a transformation to the reported usage or set quantity before computing the amount billed.voidsetTrialPeriodDays(java.lang.Long trialPeriodDays)Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true.voidsetUsageType(java.lang.String usageType)Configures how the quantity per period should be determined.Planupdate(PlanUpdateParams params)Updates the specified plan by setting the values of the parameters passed.Planupdate(PlanUpdateParams params, RequestOptions options)Updates the specified plan by setting the values of the parameters passed.Planupdate(java.util.Map<java.lang.String,java.lang.Object> params)Updates the specified plan by setting the values of the parameters passed.Planupdate(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 expandableproductobject.
-
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:
updatein 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:
updatein 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 aresumfor summing up all usage during a period,last_during_periodfor using the last usage record reported within a period,last_everfor using the last usage record ever (across period bounds) ormaxwhich 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_unitortiered.per_unitindicates 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).tieredindicates that the unit pricing will be computed using a tiering strategy as defined using thetiersandtiers_modeattributes.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,monthoryear.
-
getIntervalCount
public java.lang.Long getIntervalCount()
The number of intervals (specified in theintervalattribute) between subscription billings. For example,interval=monthandinterval_count=3bills every 3 months.
-
getLivemode
public java.lang.Boolean getLivemode()
Has the valuetrueif the object exists in live mode or the valuefalseif 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_schemeto be set totiered. See also the documentation forbilling_scheme.
-
getTiersMode
public java.lang.String getTiersMode()
Defines if the tiering price should begraduatedorvolumebased. Involume-based tiering, the maximum quantity within a period determines the per unit price. Ingraduatedtiering, 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 eithermeteredorlicensed.licensedautomatically bills thequantityset when adding it to a subscription.meteredaggregates 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 aresumfor summing up all usage during a period,last_during_periodfor using the last usage record reported within a period,last_everfor using the last usage record ever (across period bounds) ormaxwhich 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_unitortiered.per_unitindicates 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).tieredindicates that the unit pricing will be computed using a tiering strategy as defined using thetiersandtiers_modeattributes.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,monthoryear.
-
setIntervalCount
public void setIntervalCount(java.lang.Long intervalCount)
The number of intervals (specified in theintervalattribute) between subscription billings. For example,interval=monthandinterval_count=3bills every 3 months.
-
setLivemode
public void setLivemode(java.lang.Boolean livemode)
Has the valuetrueif the object exists in live mode or the valuefalseif 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_schemeto be set totiered. See also the documentation forbilling_scheme.
-
setTiersMode
public void setTiersMode(java.lang.String tiersMode)
Defines if the tiering price should begraduatedorvolumebased. Involume-based tiering, the maximum quantity within a period determines the per unit price. Ingraduatedtiering, 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 eithermeteredorlicensed.licensedautomatically bills thequantityset when adding it to a subscription.meteredaggregates the total usage based on usage records. Defaults tolicensed.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCodein 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:
getMetadatain interfaceMetadataStore<Plan>
-
-