| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## Stripe API - ~/lib/Net/API/Stripe/Billing/Invoice/Item.pm | ||
| 3 | ## Version v0.100.0 | ||
| 4 | ## Copyright(c) 2019 DEGUEST Pte. Ltd. | ||
| 5 | ## Author: Jacques Deguest <@sitael.tokyo.deguest.jp> | ||
| 6 | ## Created 2019/11/02 | ||
| 7 | ## Modified 2020/05/15 | ||
| 8 | ## | ||
| 9 | ##---------------------------------------------------------------------------- | ||
| 10 | ## https://stripe.com/docs/api/invoiceitems | ||
| 11 | package Net::API::Stripe::Billing::Invoice::Item; | ||
| 12 | BEGIN | ||
| 13 | { | ||
| 14 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | ▶ | use parent qw( Net::API::Stripe::Generic ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 1 | ▶ | our( $VERSION ) = 'v0.100.0'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | }; | ||
| 18 | |||
| 19 | 0 | ▶ | sub id { shift->_set_get_scalar( 'id', @_ ); } |
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 20 | |||
| 21 | 0 | ▶ | sub object { shift->_set_get_scalar( 'object', @_ ); } |
|
Subroutine
object: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 22 | |||
| 23 | 0 | ▶ | sub amount { shift->_set_get_number( 'amount', @_ ); } |
|
Subroutine
amount: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 24 | |||
| 25 | 0 | ▶ | sub currency { shift->_set_get_scalar( 'currency', @_ ); } |
|
Subroutine
currency: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 26 | |||
| 27 | 0 | ▶ | sub customer { shift->_set_get_scalar_or_object( 'customer', 'Net::API::Stripe::Customer', @_ ); } |
|
Subroutine
customer: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 28 | |||
| 29 | 0 | ▶ | sub date { shift->_set_get_datetime( 'date', @_ ); } |
|
Subroutine
date: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 30 | |||
| 31 | 0 | ▶ | sub description { shift->_set_get_scalar( 'description', @_ ); } |
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 32 | |||
| 33 | 0 | ▶ | sub discountable { shift->_set_get_boolean( 'discountable', @_ ); } |
|
Subroutine
discountable: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 34 | |||
| 35 | 0 | ▶ | sub invoice { shift->_set_get_scalar_or_object( 'invoice', 'Net::API::Stripe::Billing::Invoice', @_ ); } |
|
Subroutine
invoice: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 36 | |||
| 37 | 0 | ▶ | sub livemode { shift->_set_get_boolean( 'livemode', @_ ); } |
|
Subroutine
livemode: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 38 | |||
| 39 | 0 | ▶ | sub metadata { shift->_set_get_hash( 'metadata', @_ ); } |
|
Subroutine
metadata: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 40 | |||
| 41 | 0 | ▶ | sub period { shift->_set_get_object( 'period', 'Net::API::Stripe::Billing::Invoice::Period', @_ ); } |
|
Subroutine
period: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | |||
| 43 | 0 | ▶ | sub plan { shift->_set_get_object( 'plan', 'Net::API::Stripe::Billing::Plan', @_ ); } |
|
Subroutine
plan: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 44 | |||
| 45 | 0 | ▶ | sub proration { shift->_set_get_boolean( 'proration', @_ ); } |
|
Subroutine
proration: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | |||
| 47 | 0 | ▶ | sub quantity { shift->_set_get_number( 'quantity', @_ ); } |
|
Subroutine
quantity: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 48 | |||
| 49 | 0 | ▶ | sub subscription { shift->_set_get_scalar_or_object( 'subscription', 'Net::API::Stripe::Billing::Subscription', @_ ); } |
|
Subroutine
subscription: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 50 | |||
| 51 | 0 | ▶ | sub subscription_item { shift->_set_get_scalar( 'subscription_item', @_ ); } |
|
Subroutine
subscription_item: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 52 | |||
| 53 | 0 | ▶ | sub tax_rates { return( shift->_set_get_object_array( 'tax_rates', 'Net::API::Stripe::Tax::Rate', @_ ) ); } |
|
Subroutine
tax_rates: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 54 | |||
| 55 | 0 | ▶ | sub unified_proration { return( shift->_set_get_scalar( 'unified_proration', @_ ) ); } |
|
Subroutine
unified_proration: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 56 | |||
| 57 | 0 | ▶ | sub unit_amount { shift->_set_get_number( 'unit_amount', @_ ); } |
|
Subroutine
unit_amount: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 58 | |||
| 59 | 0 | ▶ | sub unit_amount_decimal { return( shift->_set_get_number( 'unit_amount_decimal', @_ ) ); } |
|
Subroutine
unit_amount_decimal: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 60 | |||
| 61 | 1 | 1; | |
| 62 | |||
| 63 | __END__ | ||
| 64 | |||
| 65 | =encoding utf8 | ||
| 66 | |||
| 67 | =head1 NAME | ||
| 68 | |||
| 69 | Net::API::Stripe::Billing::Invoice::Item - A Stripe Invoice Item Object | ||
| 70 | |||
| 71 | =head1 SYNOPSIS | ||
| 72 | |||
| 73 | my $invoice_item = $stripe->invoice_item({ | ||
| 74 | amount => 2000, | ||
| 75 | currency => 'jpy', | ||
| 76 | customer => $customer_object, | ||
| 77 | date => '2020-03-17', | ||
| 78 | description => 'Support services', | ||
| 79 | invoice => $invoice_object, | ||
| 80 | metadata => { transaction_id => 1212, customer_id => 987 }, | ||
| 81 | plan => $plan_object, | ||
| 82 | proration => 1, | ||
| 83 | quantity => 7, | ||
| 84 | subscription => $subscription_object, | ||
| 85 | }); | ||
| 86 | |||
| 87 | =head1 VERSION | ||
| 88 | |||
| 89 | v0.100.0 | ||
| 90 | |||
| 91 | =head1 DESCRIPTION | ||
| 92 | |||
| 93 | Sometimes you want to add a charge or credit to a customer, but actually charge or credit the customer's card only at the end of a regular billing cycle. This is useful for combining several charges (to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals. | ||
| 94 | |||
| 95 | =head1 CONSTRUCTOR | ||
| 96 | |||
| 97 | =over 4 | ||
| 98 | |||
| 99 | =item B<new>( %ARG ) | ||
| 100 | |||
| 101 | Creates a new L<Net::API::Stripe::Billing::Invoice::Item> object. | ||
| 102 | |||
| 103 | =back | ||
| 104 | |||
| 105 | =head1 METHODS | ||
| 106 | |||
| 107 | =over 4 | ||
| 108 | |||
| 109 | =item B<id> string | ||
| 110 | |||
| 111 | Unique identifier for the object. | ||
| 112 | |||
| 113 | =item B<object> string, value is "invoiceitem" | ||
| 114 | |||
| 115 | String representing the object’s type. Objects of the same type share the same value. | ||
| 116 | |||
| 117 | =item B<amount> integer | ||
| 118 | |||
| 119 | Amount (in the I<currency> specified) of the invoice item. This should always be equal to I<unit_amount * quantity>. | ||
| 120 | |||
| 121 | =item B<currency> currency | ||
| 122 | |||
| 123 | Three-letter ISO currency code, in lowercase. Must be a supported currency (L<https://stripe.com/docs/currencies>). | ||
| 124 | |||
| 125 | =item B<customer> string (expandable) | ||
| 126 | |||
| 127 | The ID of the customer who will be billed when this invoice item is billed. When expanded, this is a L<Net::API::Stripe::Customer> object. | ||
| 128 | |||
| 129 | =item B<date> timestamp | ||
| 130 | |||
| 131 | Time at which the object was created. Measured in seconds since the Unix epoch. | ||
| 132 | |||
| 133 | =item B<description> string | ||
| 134 | |||
| 135 | An arbitrary string attached to the object. Often useful for displaying to users. | ||
| 136 | |||
| 137 | =item B<discountable> boolean | ||
| 138 | |||
| 139 | If true, discounts will apply to this invoice item. Always false for prorations. | ||
| 140 | |||
| 141 | =item B<invoice> string (expandable) | ||
| 142 | |||
| 143 | The ID of the invoice this invoice item belongs to. When expanded, this is a L<Net::API::Stripe::Billing::Invoice> object. | ||
| 144 | |||
| 145 | =item B<livemode> boolean | ||
| 146 | |||
| 147 | Has the value true if the object exists in live mode or the value false if the object exists in test mode. | ||
| 148 | |||
| 149 | =item B<metadata> hash | ||
| 150 | |||
| 151 | 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. | ||
| 152 | |||
| 153 | =item B<period> hash | ||
| 154 | |||
| 155 | The period associated with with this invoice item. | ||
| 156 | |||
| 157 | This is a L<Net::API::Stripe::Billing::Invoice::Period> object. | ||
| 158 | |||
| 159 | =item B<plan> hash, plan object | ||
| 160 | |||
| 161 | If the invoice item is a proration, the plan of the subscription that the proration was computed for. | ||
| 162 | |||
| 163 | This is a L<Net::API::Stripe::Billing::Plan> object. | ||
| 164 | |||
| 165 | =item B<proration> boolean | ||
| 166 | |||
| 167 | Whether the invoice item was created automatically as a proration adjustment when the customer switched plans. | ||
| 168 | |||
| 169 | =item B<quantity> integer | ||
| 170 | |||
| 171 | Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for. | ||
| 172 | |||
| 173 | =item B<subscription> string (expandable) | ||
| 174 | |||
| 175 | The subscription that this invoice item has been created for, if any. When expanded, this is a L<Net::API::Stripe::Billing::Subscription> object. | ||
| 176 | |||
| 177 | =item B<subscription_item> string | ||
| 178 | |||
| 179 | The subscription item that this invoice item has been created for, if any. | ||
| 180 | |||
| 181 | =item B<tax_rates> array of hashes | ||
| 182 | |||
| 183 | The tax rates which apply to the invoice item. When set, the default_tax_rates on the invoice do not apply to this invoice item. | ||
| 184 | |||
| 185 | This is an array of L<Net::API::Stripe::Tax::Rate> objects. | ||
| 186 | |||
| 187 | =item B<unified_proration> boolean | ||
| 188 | |||
| 189 | For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item. | ||
| 190 | |||
| 191 | =item B<unit_amount> integer | ||
| 192 | |||
| 193 | Unit Amount (in the currency specified) of the invoice item. | ||
| 194 | |||
| 195 | =item B<unit_amount_decimal> decimal string | ||
| 196 | |||
| 197 | Same as unit_amount, but contains a decimal value with at most 12 decimal places. | ||
| 198 | |||
| 199 | =back | ||
| 200 | |||
| 201 | =head1 API SAMPLE | ||
| 202 | |||
| 203 | { | ||
| 204 | "id": "ii_fake123456789", | ||
| 205 | "object": "invoiceitem", | ||
| 206 | "amount": 8000, | ||
| 207 | "currency": "jpy", | ||
| 208 | "customer": "cus_fake123456789", | ||
| 209 | "date": 1551493020, | ||
| 210 | "description": "Unused time on Provider, Inc entrepreneur monthly membership after 02 Mar 2019", | ||
| 211 | "discountable": false, | ||
| 212 | "invoice": "in_fake123456789", | ||
| 213 | "livemode": false, | ||
| 214 | "metadata": {}, | ||
| 215 | "period": { | ||
| 216 | "end": 1554171359, | ||
| 217 | "start": 1551493020 | ||
| 218 | }, | ||
| 219 | "plan": { | ||
| 220 | "id": "entrepreneur-monthly-jpy", | ||
| 221 | "object": "plan", | ||
| 222 | "active": true, | ||
| 223 | "aggregate_usage": null, | ||
| 224 | "amount": 2000, | ||
| 225 | "amount_decimal": "2000", | ||
| 226 | "billing_scheme": "per_unit", | ||
| 227 | "created": 1541833424, | ||
| 228 | "currency": "jpy", | ||
| 229 | "interval": "month", | ||
| 230 | "interval_count": 1, | ||
| 231 | "livemode": false, | ||
| 232 | "metadata": {}, | ||
| 233 | "nickname": null, | ||
| 234 | "product": "prod_fake123456789", | ||
| 235 | "tiers": null, | ||
| 236 | "tiers_mode": null, | ||
| 237 | "transform_usage": null, | ||
| 238 | "trial_period_days": null, | ||
| 239 | "usage_type": "licensed" | ||
| 240 | }, | ||
| 241 | "proration": true, | ||
| 242 | "quantity": 1, | ||
| 243 | "subscription": "sub_fake123456789", | ||
| 244 | "subscription_item": "si_fake123456789", | ||
| 245 | "tax_rates": [], | ||
| 246 | "unit_amount": 8000, | ||
| 247 | "unit_amount_decimal": "8000" | ||
| 248 | } | ||
| 249 | |||
| 250 | =head1 HISTORY | ||
| 251 | |||
| 252 | =head2 v0.1 | ||
| 253 | |||
| 254 | Initial version | ||
| 255 | |||
| 256 | =head1 AUTHOR | ||
| 257 | |||
| 258 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 259 | |||
| 260 | =head1 SEE ALSO | ||
| 261 | |||
| 262 | Stripe API documentation: | ||
| 263 | |||
| 264 | L<https://stripe.com/docs/api/invoiceitems>, L<https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items> | ||
| 265 | |||
| 266 | =head1 COPYRIGHT & LICENSE | ||
| 267 | |||
| 268 | Copyright (c) 2019-2020 DEGUEST Pte. Ltd. | ||
| 269 | |||
| 270 | You can use, copy, modify and redistribute this package and associated | ||
| 271 | files under the same terms as Perl itself. | ||
| 272 | |||
| 273 | =cut | ||