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
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Plan()
-
Method Summary
Modifier and Type Method Description protected boolean
canEqual(java.lang.Object other)
static Plan
create(PlanCreateParams params)
You can create plans using the API, or in the Stripe Dashboard.static Plan
create(PlanCreateParams params, RequestOptions options)
You can create plans using the API, or in the Stripe Dashboard.static Plan
create(java.util.Map<java.lang.String,java.lang.Object> params)
You can create plans using the API, or in the Stripe Dashboard.static Plan
create(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
You can create plans using the API, or in the Stripe Dashboard.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 is currently available for new subscriptions.java.lang.String
getAggregateUsage()
Specifies a usage aggregation strategy for plans of `usage_type=metered`.java.lang.Long
getAmount()
The amount in %s to be charged on the interval specified.java.math.BigDecimal
getAmountDecimal()
Same as `amount`, but contains a decimal value 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](https://www.iso.org/iso-4217-currency-codes.html), 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()
One of `day`, `week`, `month` or `year`.java.lang.Long
getIntervalCount()
The number of intervals (specified in the `interval` property) between subscription billings.java.lang.Boolean
getLivemode()
Has the value `true` if the object exists in live mode or the value `false` 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 expandable `product` object.Product
getProductObject()
Get expanded `product`.java.util.List<Plan.Tier>
getTiers()
Each element represents a pricing tier.java.lang.String
getTiersMode()
Defines if the tiering price should be `graduated` or `volume` based.Plan.TransformUsage
getTransformUsage()
Apply a transformation to the reported usage or set quantity before computing the billed price.java.lang.Long
getTrialPeriodDays()
Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan).java.lang.String
getUsageType()
Configures how the quantity per period should be determined, can be either `metered` or `licensed`.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 is currently available for new subscriptions.void
setAggregateUsage(java.lang.String aggregateUsage)
Specifies a usage aggregation strategy for plans of `usage_type=metered`.void
setAmount(java.lang.Long amount)
The amount in %s to be charged on the interval specified.void
setAmountDecimal(java.math.BigDecimal amountDecimal)
Same as `amount`, but contains a decimal value 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](https://www.iso.org/iso-4217-currency-codes.html), 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)
One of `day`, `week`, `month` or `year`.void
setIntervalCount(java.lang.Long intervalCount)
The number of intervals (specified in the `interval` property) between subscription billings.void
setLivemode(java.lang.Boolean livemode)
Has the value `true` if the object exists in live mode or the value `false` 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 be `graduated` or `volume` based.void
setTransformUsage(Plan.TransformUsage transformUsage)
Apply a transformation to the reported usage or set quantity before computing the billed price.void
setTrialPeriodDays(java.lang.Long trialPeriodDays)
Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan).void
setUsageType(java.lang.String usageType)
Configures how the quantity per period should be determined, can be either `metered` or `licensed`.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
-
Constructor Details
-
Plan
public Plan()
-
-
Method Details
-
getProduct
public java.lang.String getProduct()Get id of expandable `product` object. -
setProduct
public void setProduct(java.lang.String id) -
getProductObject
Get expanded `product`. -
setProductObject
-
list
public static PlanCollection list(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeExceptionReturns 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 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 StripeExceptionReturns a list of your plans.- Throws:
StripeException
-
create
public static Plan create(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeExceptionYou can create plans using the API, or in the Stripe Dashboard.- Throws:
StripeException
-
create
public static Plan create(java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeExceptionYou can create plans using the API, or in the Stripe Dashboard.- Throws:
StripeException
-
create
You can create plans using the API, or in the Stripe Dashboard.- Throws:
StripeException
-
create
You can create plans using the API, or in the Stripe Dashboard.- 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(java.lang.String plan, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeExceptionRetrieves the plan with the given ID.- Throws:
StripeException
-
retrieve
public static Plan retrieve(java.lang.String plan, PlanRetrieveParams params, RequestOptions options) throws StripeExceptionRetrieves the plan with the given ID.- Throws:
StripeException
-
update
public Plan update(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeExceptionUpdates 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 StripeExceptionUpdates 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
-
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
public Plan delete(java.util.Map<java.lang.String,java.lang.Object> params) throws StripeExceptionDeleting 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 StripeExceptionDeleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.- Throws:
StripeException
-
getActive
public java.lang.Boolean getActive()Whether the plan is currently available for new subscriptions. -
getAggregateUsage
public java.lang.String getAggregateUsage()Specifies a usage aggregation strategy for plans of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for picking the last usage record reported within a period, `last_ever` for picking the last usage record ever (across period bounds) or `max` which picks the usage record with the maximum reported usage during a period. Defaults to `sum`.One of `last_during_period`, `last_ever`, `max`, or `sum`.
-
getAmount
public java.lang.Long getAmount()The amount in %s to be charged on the interval specified. -
getAmountDecimal
public java.math.BigDecimal getAmountDecimal()Same as `amount`, but contains a decimal value with at most 12 decimal places. -
getBillingScheme
public java.lang.String getBillingScheme()Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes.One of `per_unit`, or `tiered`.
-
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](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). -
getDeleted
public java.lang.Boolean getDeleted()Always true for a deleted object. -
getInterval
public java.lang.String getInterval()One of `day`, `week`, `month` or `year`. The frequency with which a subscription should be billed. -
getIntervalCount
public java.lang.Long getIntervalCount()The number of intervals (specified in the `interval` property) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. -
getLivemode
public java.lang.Boolean getLivemode()Has the value `true` if the object exists in live mode or the value `false` 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
Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. -
getTiersMode
public java.lang.String getTiersMode()Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows.One of `graduated`, or `volume`.
-
getTransformUsage
Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`. -
getTrialPeriodDays
public java.lang.Long getTrialPeriodDays()Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan). -
getUsageType
public java.lang.String getUsageType()Configures how the quantity per period should be determined, can be either `metered` or `licensed`. `licensed` will automatically bill the `quantity` set when adding it to a subscription, `metered` will aggregate the total usage based on usage records. Defaults to `licensed`.One of `licensed`, or `metered`.
-
setActive
public void setActive(java.lang.Boolean active)Whether the plan is currently available for new subscriptions. -
setAggregateUsage
public void setAggregateUsage(java.lang.String aggregateUsage)Specifies a usage aggregation strategy for plans of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for picking the last usage record reported within a period, `last_ever` for picking the last usage record ever (across period bounds) or `max` which picks the usage record with the maximum reported usage during a period. Defaults to `sum`.One of `last_during_period`, `last_ever`, `max`, or `sum`.
-
setAmount
public void setAmount(java.lang.Long amount)The amount in %s to be charged on the interval specified. -
setAmountDecimal
public void setAmountDecimal(java.math.BigDecimal amountDecimal)Same as `amount`, but contains a decimal value with at most 12 decimal places. -
setBillingScheme
public void setBillingScheme(java.lang.String billingScheme)Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes.One of `per_unit`, or `tiered`.
-
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](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). -
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)One of `day`, `week`, `month` or `year`. The frequency with which a subscription should be billed. -
setIntervalCount
public void setIntervalCount(java.lang.Long intervalCount)The number of intervals (specified in the `interval` property) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. -
setLivemode
public void setLivemode(java.lang.Boolean livemode)Has the value `true` if the object exists in live mode or the value `false` 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
Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. -
setTiersMode
public void setTiersMode(java.lang.String tiersMode)Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows.One of `graduated`, or `volume`.
-
setTransformUsage
Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`. -
setTrialPeriodDays
public void setTrialPeriodDays(java.lang.Long trialPeriodDays)Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan). -
setUsageType
public void setUsageType(java.lang.String usageType)Configures how the quantity per period should be determined, can be either `metered` or `licensed`. `licensed` will automatically bill the `quantity` set when adding it to a subscription, `metered` will aggregate the total usage based on usage records. Defaults to `licensed`.One of `licensed`, or `metered`.
-
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>
-