[][src]Struct stripe::CreatePlan

pub struct CreatePlan<'a> {
    pub active: Option<bool>,
    pub aggregate_usage: Option<PlanAggregateUsage>,
    pub amount: Option<i64>,
    pub billing_scheme: Option<PlanBillingScheme>,
    pub currency: Currency,
    pub expand: &'a [&'a str],
    pub id: Option<&'a str>,
    pub interval: PlanInterval,
    pub interval_count: Option<u64>,
    pub metadata: Option<Metadata>,
    pub nickname: Option<&'a str>,
    pub tiers: Option<Vec<CreatePlanTiers>>,
    pub tiers_mode: Option<PlanTiersMode>,
    pub transform_usage: Option<CreatePlanTransformUsage>,
    pub trial_period_days: Option<u32>,
    pub usage_type: Option<PlanUsageType>,
}

The parameters for Plan::create.

Fields

active: Option<bool>

Whether the plan is currently available for new subscriptions.

Defaults to true.

aggregate_usage: Option<PlanAggregateUsage>

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.

amount: Option<i64>

A positive integer in %s (or 0 for a free plan) representing how much to charge on a recurring basis.

billing_scheme: Option<PlanBillingScheme>

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.

currency: Currency

Three-letter ISO currency code, in lowercase.

Must be a supported currency.

expand: &'a [&'a str]

Specifies which fields in the response should be expanded.

id: Option<&'a str>

An identifier randomly generated by Stripe.

Used to identify this plan when subscribing a customer. You can optionally override this ID, but the ID must be unique across all plans in your Stripe account. You can, however, use the same plan ID in both live and test modes.

interval: PlanInterval

Specifies billing frequency.

Either day, week, month or year.

interval_count: Option<u64>

The number of intervals between subscription billings.

For example, interval=month and interval_count=3 bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks).

metadata: Option<Metadata>

A set of key-value pairs that you can attach to a plan object.

It can be useful for storing additional information about the plan in a structured format.

nickname: Option<&'a str>

A brief description of the plan, hidden from customers.

tiers: Option<Vec<CreatePlanTiers>>

Each element represents a pricing tier.

This parameter requires billing_scheme to be set to tiered. See also the documentation for billing_scheme.

tiers_mode: Option<PlanTiersMode>

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.

transform_usage: Option<CreatePlanTransformUsage>

Apply a transformation to the reported usage or set quantity before computing the billed price.

Cannot be combined with tiers.

trial_period_days: Option<u32>

Default number of trial days when subscribing a customer to this plan using trial_from_plan=true.

usage_type: Option<PlanUsageType>

Configures how the quantity per period should be determined, can be either metered or licensed.

licensed will automatically bill the quantity set for a plan when adding it to a subscription, metered will aggregate the total usage based on usage records. Defaults to licensed.

Methods

impl<'a> CreatePlan<'a>[src]

pub fn new(currency: Currency, interval: PlanInterval) -> Self[src]

Trait Implementations

impl<'a> Clone for CreatePlan<'a>[src]

impl<'a> Debug for CreatePlan<'a>[src]

impl<'a> Serialize for CreatePlan<'a>[src]

Auto Trait Implementations

impl<'a> Sync for CreatePlan<'a>

impl<'a> Unpin for CreatePlan<'a>

impl<'a> Send for CreatePlan<'a>

impl<'a> UnwindSafe for CreatePlan<'a>

impl<'a> RefUnwindSafe for CreatePlan<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

impl<T> Same<T> for T

type Output = T

Should always be Self