The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::API::Stripe::Billing::Subscription::Item - A Stripe Subscription Item Object

SYNOPSIS

    my $item = $stripe->subscription_item({
        clear_usage => 1,
        metadata => { transaction_id => 1212, customer_id => 123 },
        quantity => 1,
        subscription => 'sub_fake123456789',
    });

VERSION

    v0.1.1

DESCRIPTION

Subscription items allow you to create customer subscriptions with more than one plan, making it easy to represent complex billing relationships.

CONSTRUCTOR

new( %ARG )

Creates a new Net::API::Stripe::Billing::Subscription::Item object.

METHODS

id string

Unique identifier for the object.

object string, value is "subscription_item"

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

billing_thresholds hash

Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period

This is a Net::API::Stripe::Billing::Thresholds object.

usage_gte integer

Usage threshold that triggers the subscription to create an invoice

clear_usage() optional

Delete all usage for a given subscription item. Allowed only when deleted is set to true and the current plan’s usage_type is metered.

This is used in making upcoming invoice items api calls as described here: https://stripe.com/docs/api/invoices/upcoming_invoice_lines

created integer

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

deleted optional

A flag that, if set to true, will delete the specified item.

This is used in making upcoming invoice items api calls as described here: https://stripe.com/docs/api/invoices/upcoming_invoice_lines

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.

plan hash, plan object

Hash describing the plan the customer is subscribed to.

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

quantity positive integer or zero

The quantity of the plan to which the customer should be subscribed.

subscription string

The subscription this subscription_item belongs to.

tax_rates array of hashes

The tax rates which apply to this subscription_item. When set, the default_tax_rates on the subscription do not apply to this subscription_item.

This is an array of Net::API::Stripe::Tax::Rate objects.

API SAMPLE

        {
          "id": "si_fake123456789",
          "object": "subscription_item",
          "billing_thresholds": null,
          "created": 1571397912,
          "metadata": {},
          "plan": {
                "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"
          },
          "quantity": 1,
          "subscription": "sub_fake123456789",
          "tax_rates": []
        }

HISTORY

v0.1

Initial version

v0.1.1

Added the methods clear_usage and deleted used in making upcoming invoice item api calls as explained here https://stripe.com/docs/api/invoices/upcoming_invoice_lines

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/subscription_items

COPYRIGHT & LICENSE

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

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