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>,StripeActiveObject,StripeObjectInterface
You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is
backwards compatible to simplify your migration.
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 ClassesModifier and TypeClassDescriptionstatic classFor more details about Tier, please refer to the API Reference.static classFor more details about TransformUsage, please refer to the API Reference.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_GSONFields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanstatic 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 PlanYou can now model subscriptions more flexibly using the Prices API.static Plancreate(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.booleanWhether the plan can be used for new purchases.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 theintervalattribute) between subscription billings.Has the valuetrueif the object exists in live mode or the valuefalseif 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 expandableproductobject.Get expandedproduct.getTiers()Each element represents a pricing tier.Defines if the tiering price should begraduatedorvolumebased.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.inthashCode()static PlanCollectionlist(PlanListParams params) Returns a list of your plans.static PlanCollectionlist(PlanListParams params, RequestOptions options) Returns a list of your plans.static PlanCollectionReturns a list of your plans.static PlanCollectionlist(Map<String, Object> params, RequestOptions options) Returns a list of your plans.static PlanRetrieves the plan with the given ID.static Planretrieve(String plan, RequestOptions options) Retrieves the plan with the given ID.static Planretrieve(String plan, PlanRetrieveParams params, RequestOptions options) Retrieves the plan with the given ID.static PlanRetrieves the plan with the given ID.voidWhether the plan can be used for new purchases.voidThe unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible.voidsetAmountDecimal(BigDecimal amountDecimal) The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places.voidsetBillingScheme(String billingScheme) Describes how to compute the price per period.voidsetCreated(Long created) Time at which the object was created.voidsetCurrency(String currency) Three-letter ISO currency code, in lowercase.voidsetDeleted(Boolean deleted) Always true for a deleted object.voidUnique identifier for the object.voidsetInterval(String interval) The frequency at which a subscription is billed.voidsetIntervalCount(Long intervalCount) The number of intervals (specified in theintervalattribute) between subscription billings.voidsetLivemode(Boolean livemode) Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.voidsetMetadata(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.voidThe meter tracking the usage of a metered price.voidsetNickname(String nickname) A brief description of the plan, hidden from customers.voidString representing the object's type.voidsetProduct(String id) voidsetProductObject(Product expandableObject) voidsetResponseGetter(StripeResponseGetter responseGetter) Method is used by the containing object orStripeResponseGetterimplementations to set theStripeResponseGetterinstance used to make further requests.voidEach element represents a pricing tier.voidsetTiersMode(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(Long trialPeriodDays) Default number of trial days when subscribing a customer to this plan usingtrial_from_plan=true.voidsetUsageType(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, setGlobalResponseGetter, urlEncode, urlEncodeIdMethods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
Plan
public Plan()
-
-
Method Details
-
getProduct
Get ID of expandableproductobject. -
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:
updatein 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:
updatein 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:StripeActiveObjectMethod is used by the containing object orStripeResponseGetterimplementations to set theStripeResponseGetterinstance used to make further requests.- Specified by:
setResponseGetterin interfaceStripeActiveObject- Overrides:
setResponseGetterin classApiResource- Parameters:
responseGetter- theStripeResponseGetterinstance to use for making further requests.
-
getActive
Whether the plan can be used for new purchases. -
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_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
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,monthoryear. -
getIntervalCount
The number of intervals (specified in theintervalattribute) between subscription billings. For example,interval=monthandinterval_count=3bills every 3 months. -
getLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif 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_schemeto be set totiered. See also the documentation forbilling_scheme. -
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
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 eithermeteredorlicensed.licensedautomatically bills thequantityset when adding it to a subscription.meteredaggregates the total usage based on usage records. Defaults tolicensed. -
setActive
Whether the plan can be used for new purchases. -
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_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
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,monthoryear. -
setIntervalCount
The number of intervals (specified in theintervalattribute) between subscription billings. For example,interval=monthandinterval_count=3bills every 3 months. -
setLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif 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_schemeto be set totiered. See also the documentation forbilling_scheme. -
setTiersMode
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
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 eithermeteredorlicensed.licensedautomatically bills thequantityset when adding it to a subscription.meteredaggregates 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:
getMetadatain interfaceMetadataStore<Plan>
-