NAME
Net::API::Stripe::Price - A Stripe Price Object
SYNOPSIS
my $prod = $stripe->product({
active => $stripe->true,
unit_amount => 2000,
currency => 'jpy',
metadata => { product_id => 123, customer_id => 456 },
nickname => 'jpy premium price',
product => 'prod_fake123456789',
recurring =>
{
interval => 'month',
interval_count => 1,
trial_period_days => 14,
usage_type => 'licensed',
},
livemode => $stripe->false,
});
See documentation in Net::API::Stripe for example to make api calls to Stripe to create those objects.
VERSION
v0.1.0
DESCRIPTION
Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.
For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.
Related guides: Set up a subscription, create an invoice, and more about products and prices.
Documentation on Products for use with Subscriptions can be found at Subscription Products.
CONSTRUCTOR
- new( %ARG )
-
Creates a new Net::API::Stripe::Price object.
METHODS
- id string
-
Unique identifier for the object.
- object string, value is "price"
-
String representing the object’s type. Objects of the same type share the same value.
- active boolean
-
Whether the price can be used for new purchases.
- billing_scheme string
-
Describes how to compute the price per period. Either per_unit or tiered. I≤per_unit> indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in
quantity
(for prices withusage_type=licensed
), or per unit of total usage (for prices withusage_type=metered
). tiered indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers and tiers_mode attributes. - created timestamp
-
Time at which the object was created. Measured in seconds since the Unix epoch.
- currency string
-
Three-letter ISO currency code, in lowercase. Must be a supported currency.
- deleted boolean
-
Set to true when the price has been deleted.
- livemode boolean
-
Has the value true if the object exists in live mode or the value false if the object exists in test mode.
- lookup_key string
-
A lookup key used to retrieve prices dynamically from a static string.
- 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.
- nickname string
-
A brief description of the plan, hidden from customers.
- product string (expandable)
-
The ID of the product this price is associated with. When expanded, this is a Net::API::Stripe::Product object.
- product_data hash
-
These fields can be used to create a new product that this price will belong to. This is a Net::API::Stripe::Product object
This is used when creating a Stripe price object, and to create a product in the process as well.
- recurring hash
-
The recurring components of a price such as interval and usage_type.
This has the following properties, that look very much like a Net::API::Stripe::Billing::Plan:
- interval
-
Specifies billing frequency. Either
day
,week
,month
oryear
. - aggregate_usage
-
Specifies a usage aggregation strategy for prices of
usage_type=metered
. Allowed values are sum for summing up all usage during a period,last_during_period
for using the last usage record reported within a period, last_ever for using the last usage record ever (across period bounds) or max which uses the usage record with the maximum reported usage during a period. Defaults to sum. - interval_count
-
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).
- trial_period_days
-
Default number of trial days when subscribing a customer to this price using
trial_from_plan=true
. - usage_type
-
Configures how the quantity per period should be determined. Can be either
metered
orlicensed
.licensed
automatically bills the quantity set when adding it to a subscription. metered aggregates the total usage based on usage records. Defaults tolicensed
.
- tiers hash
-
Each element represents a pricing tier. This parameter requires
billing_scheme
to be set totiered
. See also the documentation forbilling_scheme
.The possible properties are:
- up_to number
-
Specifies the upper bound of this tier. The lower bound of a tier is the upper bound of the previous tier adding one. Use
inf
to define a fallback tier. - flat_amount number
-
The flat billing amount for an entire tier, regardless of the number of units in the tier.
- flat_amount_decimal
-
Same as C≤flat_amount>, but accepts a decimal value representing an integer in the minor units of the currency. Only one of C≤flat_amount> and
flat_amount_decimal
can be set. - unit_amount
-
The per unit billing amount for each individual unit for which this tier applies.
- unit_amount_decimal
-
Same as C≤unit_amount>, but accepts a decimal value with at most 12 decimal places. Only one of
unit_amount
andunit_amount_decimal
can be set.
- tiers_mode string
-
Defines if the tiering price should be
graduated
orvolume
based. In C≤volume>-based tiering, the maximum quantity within a period determines the per unit price, ingraduated
tiering pricing can successively change as the quantity grows. - transform_quantity hash
-
Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with
tiers
.Possible properties are:
- type string
-
One of
one_time
orrecurring
depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. - unit_amount number
-
The unit amount in JPY to be charged, represented as a whole integer if possible.
- unit_amount_decimal number
-
The unit amount in JPY to be charged, represented as a decimal string with at most 12 decimal places.
API SAMPLE
{
"id": "gold",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1589335030,
"currency": "jpy",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_fake123456789",
"recurring": {
"aggregate_usage": null,
"interval": "month",
"interval_count": 1,
"trial_period_days": null,
"usage_type": "licensed"
},
"tiers": null,
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 2000,
"unit_amount_decimal": "2000"
}
HISTORY
v0.1
Initial version
STRIPE HISTORY
This was released some time in early 2020.
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
Stripe API documentation:
https://stripe.com/docs/api/prices#prices, https://stripe.com/docs/billing/subscriptions/set-up-subscription, https://stripe.com/docs/billing/invoices/create
COPYRIGHT & LICENSE
Copyright (c) 2020 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.