NAME

Net::API::Stripe::Billing::Plan - A Stripe Plan Object

SYNOPSIS

my $plan = $stripe->plan({
    # Or you can just use 1. $stripe->true returns a Module::Generic::Boolean object
    active => $stripe->true,
    amount => 2000,
    billing_scheme => 'per_unit',
    count => 12,
    currency => 'jpy',
    interval => 'month',
    interval_count => 1,
    metadata => { transaction_id => 1212, customer_id => 123 },
    name => 'Professional services subscription gold plan',
    statement_description => 'Provider, Inc Pro Services',
});

VERSION

v0.100.0

DESCRIPTION

Plans define the base price, currency, and billing cycle for subscriptions. For example, you might have a ¥5/month plan that provides limited access to your products, and a ¥15/month plan that allows full access.

CONSTRUCTOR

new( %ARG )

Creates a new Net::API::Stripe::Billing::Plan object.

METHODS

id string

Unique identifier for the object.

object string, value is "plan"

String representing the object’s type. Objects of the same type share the same value.

active boolean

Whether the plan is currently available for new subscriptions.

aggregate_usage string

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 positive integer or zero

The amount in JPY to be charged on the interval specified.

amount_decimal decimal string

Same as amount, but contains a decimal value with at most 12 decimal places.

billing_scheme string

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.

count integer

For fixed_count installment plans, this is the number of installment payments your customer will make to their credit card.

Not part of the official api documentation, but found in sub object data like in here https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-installments

created timestamp

Time at which the object was created. Measured in seconds since the Unix epoch.

currency currency

Three-letter ISO currency code, in lowercase. Must be a supported currency.

deleted boolean

Appears only when the plan has been deleted.

interval string

One of day, week, month or year. The frequency with which a subscription should be billed.

interval_count positive integer

The number of intervals (specified in the interval property) between subscription billings. For example, interval=month and interval_count=3 bills every 3 months.

livemode boolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

metadata hash

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.

name string

This is an undocumented property, which appears in data returned by Stripe. This contains the name of the plan.

nickname string

A brief description of the plan, hidden from customers.

product string (expandable)

The product whose pricing this plan determines. When expanded, this is a Net::API::Stripe::Product object.

statement_description string

This is an undocumented property, which appears in data returned by Stripe. This contains a description of the plan.

statement_descriptor string

This is an undocumented property, which appears in data returned by Stripe. This contains a description of the plan.

tiers array of hashes

Each element represents a pricing tier. This parameter requires billing_scheme to be set to tiered. See also the documentation for billing_scheme.

This is an array of Net::API::Stripe::Billing::Plan::Tiers objects.

tiers_mode string

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 hash

Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with tiers.

This is a Net::API::Stripe::Billing::Plan::TransformUsage object.

trial_period_days positive integer

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

type string

Type of installment plan, one of fixed_count.

Not part of the official api documentation, but found in sub object data like in here https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-installments

usage_type string

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.

API SAMPLE

{
  "id": "expert-monthly-jpy",
  "object": "plan",
  "active": true,
  "aggregate_usage": null,
  "amount": 8000,
  "amount_decimal": "8000",
  "billing_scheme": "per_unit",
  "created": 1507273129,
  "currency": "jpy",
  "interval": "month",
  "interval_count": 1,
  "livemode": false,
  "metadata": {},
  "nickname": null,
  "product": "prod_fake123456789",
  "tiers": null,
  "tiers_mode": null,
  "transform_usage": null,
  "trial_period_days": null,
  "usage_type": "licensed"
}

ACTUAL API DATA RETURNED

As you can see, there are extra properties: name, statement_description and statement_descriptior

{
    "id": "professional-monthly-jpy",
    "object": "plan",
    "active": true,
    "aggregate_usage": null,
    "amount": 8000,
    "amount_decimal": "8000",
    "billing_scheme": "per_unit",
    "created": 1541833564,
    "currency": "jpy",
    "interval": "month",
    "interval_count": 1,
    "livemode": false,
    "metadata": {},
    "name": "MyShop, Inc monthly membership",
    "nickname": null,
    "product": "prod_fake123456789",
    "statement_description": null,
    "statement_descriptor": null,
    "tiers": null,
    "tiers_mode": null,
    "transform_usage": null,
    "trial_period_days": null,
    "usage_type": "licensed"
}

HISTORY

v0.1

Initial version

STRIPE HISTORY

2018-02-05

Each plan object is now linked to a product object with type=service. The plan object fields statement_descriptor and name attributes have been moved to product objects. Creating a plan now requires passing a product attribute to POST /v1/plans. This may be either an existing product ID or a dictionary of product fields, so that you may continue to create plans without separately creating products.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/plans, https://stripe.com/docs/billing/subscriptions/products-and-plans

COPYRIGHT & LICENSE

Copyright (c) 2019-2020 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.