| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## Stripe API - ~/lib/Net/API/Stripe/Billing/Invoice/LineItem.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/invoices/line_item | ||
| 11 | package Net::API::Stripe::Billing::Invoice::LineItem; | ||
| 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 description { shift->_set_get_scalar( 'description', @_ ); } |
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 28 | |||
| 29 | 0 | ▶ | sub discountable { shift->_set_get_boolean( 'discountable', @_ ); } |
|
Subroutine
discountable: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 30 | |||
| 31 | 0 | ▶ | sub invoice_item { shift->_set_get_scalar( 'invoice_item', @_ ); } |
|
Subroutine
invoice_item: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 32 | |||
| 33 | 0 | ▶ | sub livemode { shift->_set_get_boolean( 'livemode', @_ ); } |
|
Subroutine
livemode: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 34 | |||
| 35 | 0 | ▶ | sub metadata { shift->_set_get_hash( 'metadata', @_ ); } |
|
Subroutine
metadata: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 36 | |||
| 37 | 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
| |||
| 38 | |||
| 39 | 0 | ▶ | sub plan { shift->_set_get_object( 'plan', 'Net::API::Stripe::Billing::Plan', @_ ); } |
|
Subroutine
plan: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 40 | |||
| 41 | 0 | ▶ | sub proration { shift->_set_get_boolean( 'proration', @_ ); } |
|
Subroutine
proration: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | |||
| 43 | 0 | ▶ | sub quantity { shift->_set_get_number( 'quantity', @_ ); } |
|
Subroutine
quantity: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 44 | |||
| 45 | 0 | ▶ | sub subscription { shift->_set_get_scalar( 'subscription', @_ ); } |
|
Subroutine
subscription: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | |||
| 47 | 0 | ▶ | sub subscription_item { shift->_set_get_scalar( 'subscription_item', @_ ); } |
|
Subroutine
subscription_item: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 48 | |||
| 49 | 0 | ▶ | sub tax_amounts { return( shift->_set_get_object_array( 'tax_amounts', 'Net::API::Stripe::Billing::Invoice::TaxAmount', @_ ) ); } |
|
Subroutine
tax_amounts: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 50 | |||
| 51 | 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
| |||
| 52 | |||
| 53 | ## The source type: invoiceitem or subscription | ||
| 54 | 0 | ▶ | sub type { shift->_set_get_scalar( 'type', @_ ); } |
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 55 | |||
| 56 | 0 | ▶ | sub unified_proration { return( shift->_set_get_scalar( 'unified_proration', @_ ) ); } |
|
Subroutine
unified_proration: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 57 | |||
| 58 | 0 | ▶ | sub unique_id { return( shift->_set_get_scalar( 'unique_id', @_ ) ); } |
|
Subroutine
unique_id: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 59 | |||
| 60 | 1 | 1; | |
| 61 | |||
| 62 | __END__ | ||
| 63 | |||
| 64 | =encoding utf8 | ||
| 65 | |||
| 66 | =head1 NAME | ||
| 67 | |||
| 68 | Net::API::Stripe::Billing::Invoice::LineItem - A Stripe Invoice Line Item Object | ||
| 69 | |||
| 70 | =head1 SYNOPSIS | ||
| 71 | |||
| 72 | my $line_item = $stripe->invoice_line_item({ | ||
| 73 | amount => 2000, | ||
| 74 | currency => 'jpy', | ||
| 75 | description 'Professional service work', | ||
| 76 | discountable => 0, | ||
| 77 | metadata => { transaction_id => 1212, customer_id => 987 }, | ||
| 78 | plan => $plan_object, | ||
| 79 | proration => 0, | ||
| 80 | quantity => 7, | ||
| 81 | subscription => 'sub_fake123456789', | ||
| 82 | type => 'subscription', | ||
| 83 | }); | ||
| 84 | |||
| 85 | =head1 VERSION | ||
| 86 | |||
| 87 | v0.100.0 | ||
| 88 | |||
| 89 | =head1 DESCRIPTION | ||
| 90 | |||
| 91 | This is a Stripe L<Net::API::Stripe::Billing::Invoice::LineItem> object as documented here: L<https://stripe.com/docs/api/invoices/line_item> | ||
| 92 | |||
| 93 | =head1 CONSTRUCTOR | ||
| 94 | |||
| 95 | =over 4 | ||
| 96 | |||
| 97 | =item B<new>( %ARG ) | ||
| 98 | |||
| 99 | Creates a new L<Net::API::Stripe::Billing::Invoice::LineItem> object. | ||
| 100 | |||
| 101 | =back | ||
| 102 | |||
| 103 | =head1 METHODS | ||
| 104 | |||
| 105 | =over 4 | ||
| 106 | |||
| 107 | =item B<id> string | ||
| 108 | |||
| 109 | Unique identifier for the object. | ||
| 110 | |||
| 111 | =item B<object> string, value is "line_item" | ||
| 112 | |||
| 113 | String representing the object’s type. Objects of the same type share the same value. | ||
| 114 | |||
| 115 | =item B<amount> integer | ||
| 116 | |||
| 117 | The amount, in JPY. | ||
| 118 | |||
| 119 | =item B<currency> currency | ||
| 120 | |||
| 121 | Three-letter ISO currency code, in lowercase. Must be a supported currency. | ||
| 122 | |||
| 123 | =item B<description> string | ||
| 124 | |||
| 125 | An arbitrary string attached to the object. Often useful for displaying to users. | ||
| 126 | |||
| 127 | =item B<discountable> boolean | ||
| 128 | |||
| 129 | If true, discounts will apply to this line item. Always false for prorations. | ||
| 130 | |||
| 131 | =item B<invoice_item> string | ||
| 132 | |||
| 133 | =item B<livemode> boolean | ||
| 134 | |||
| 135 | Whether this is a test line item. | ||
| 136 | |||
| 137 | =item B<metadata> hash | ||
| 138 | |||
| 139 | 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. Note that for line items with type=subscription this will reflect the metadata of the subscription that caused the line item to be created. | ||
| 140 | |||
| 141 | =item B<period> hash | ||
| 142 | |||
| 143 | The timespan covered by this invoice item. | ||
| 144 | |||
| 145 | This is a L<Net::API::Stripe::Billing::Invoice::Period> object. | ||
| 146 | |||
| 147 | =item B<plan> hash, plan object | ||
| 148 | |||
| 149 | The plan of the subscription, if the line item is a subscription or a proration. | ||
| 150 | |||
| 151 | This is a L<Net::API::Stripe::Billing::Plan> object. | ||
| 152 | |||
| 153 | =item B<proration> boolean | ||
| 154 | |||
| 155 | Whether this is a proration. | ||
| 156 | |||
| 157 | =item B<quantity> integer | ||
| 158 | |||
| 159 | The quantity of the subscription, if the line item is a subscription or a proration. | ||
| 160 | |||
| 161 | =item B<subscription> string | ||
| 162 | |||
| 163 | The subscription that the invoice item pertains to, if any. | ||
| 164 | |||
| 165 | =item B<subscription_item> string | ||
| 166 | |||
| 167 | The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription. | ||
| 168 | |||
| 169 | =item B<tax_amounts> array of hashes | ||
| 170 | |||
| 171 | The amount of tax calculated per tax rate for this line item | ||
| 172 | |||
| 173 | This is an array of L<Net::API::Stripe::Billing::Invoice::TaxAmount> objects. | ||
| 174 | |||
| 175 | =item B<tax_rates> array of hashes | ||
| 176 | |||
| 177 | The tax rates which apply to the line item. | ||
| 178 | |||
| 179 | This is an array of L<Net::API::Stripe::Tax::Rate> objects. | ||
| 180 | |||
| 181 | =item B<type> string | ||
| 182 | |||
| 183 | A string identifying the type of the source of this line item, either an invoiceitem or a subscription. | ||
| 184 | |||
| 185 | =item B<unified_proration> boolean | ||
| 186 | |||
| 187 | For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item. | ||
| 188 | |||
| 189 | =back | ||
| 190 | |||
| 191 | =head1 API SAMPLE | ||
| 192 | |||
| 193 | { | ||
| 194 | "id": "ii_fake123456789", | ||
| 195 | "object": "line_item", | ||
| 196 | "amount": -2000, | ||
| 197 | "currency": "jpy", | ||
| 198 | "description": "Unused time on Provider, Inc entrepreneur monthly membership after 02 Mar 2019", | ||
| 199 | "discountable": false, | ||
| 200 | "invoice_item": "ii_fake123456789", | ||
| 201 | "livemode": false, | ||
| 202 | "metadata": {}, | ||
| 203 | "period": { | ||
| 204 | "end": 1554171359, | ||
| 205 | "start": 1551493020 | ||
| 206 | }, | ||
| 207 | "plan": { | ||
| 208 | "id": "entrepreneur-monthly-jpy", | ||
| 209 | "object": "plan", | ||
| 210 | "active": true, | ||
| 211 | "aggregate_usage": null, | ||
| 212 | "amount": 2000, | ||
| 213 | "amount_decimal": "2000", | ||
| 214 | "billing_scheme": "per_unit", | ||
| 215 | "created": 1541833424, | ||
| 216 | "currency": "jpy", | ||
| 217 | "interval": "month", | ||
| 218 | "interval_count": 1, | ||
| 219 | "livemode": false, | ||
| 220 | "metadata": {}, | ||
| 221 | "nickname": null, | ||
| 222 | "product": "prod_fake123456789", | ||
| 223 | "tiers": null, | ||
| 224 | "tiers_mode": null, | ||
| 225 | "transform_usage": null, | ||
| 226 | "trial_period_days": null, | ||
| 227 | "usage_type": "licensed" | ||
| 228 | }, | ||
| 229 | "proration": true, | ||
| 230 | "quantity": 1, | ||
| 231 | "subscription": "sub_fake123456789", | ||
| 232 | "subscription_item": "si_fake123456789", | ||
| 233 | "tax_amounts": [], | ||
| 234 | "tax_rates": [], | ||
| 235 | "type": "invoiceitem" | ||
| 236 | } | ||
| 237 | |||
| 238 | =head1 HISTORY | ||
| 239 | |||
| 240 | =head2 v0.1 | ||
| 241 | |||
| 242 | Initial version | ||
| 243 | |||
| 244 | =head1 STRIPE HISTORY | ||
| 245 | |||
| 246 | =head2 2019-12-03 | ||
| 247 | |||
| 248 | The id field of all invoice line items have changed and are now prefixed with il_. The new id has consistent prefixes across all line items, is globally unique, and can be used for pagination. | ||
| 249 | |||
| 250 | =over 4 | ||
| 251 | |||
| 252 | =item You can no longer use the prefix of the id to determine the source of the line item. Instead use the type field for this purpose. | ||
| 253 | |||
| 254 | =item For lines with type=invoiceitem, use the invoice_item field to reference or update the originating Invoice Item object. | ||
| 255 | |||
| 256 | =item The Invoice Line Item object on earlier API versions also have a unique_id field to be used for migrating internal references before upgrading to this version. | ||
| 257 | |||
| 258 | =item When setting a tax rate to individual line items, use the new id. Users on earlier API versions can pass in either a line item id or unique_id. | ||
| 259 | |||
| 260 | =back | ||
| 261 | |||
| 262 | =head1 AUTHOR | ||
| 263 | |||
| 264 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 265 | |||
| 266 | =head1 SEE ALSO | ||
| 267 | |||
| 268 | Stripe API documentation: | ||
| 269 | |||
| 270 | L<https://stripe.com/docs/api/invoices/line_item> | ||
| 271 | |||
| 272 | =head1 COPYRIGHT & LICENSE | ||
| 273 | |||
| 274 | Copyright (c) 2019-2020 DEGUEST Pte. Ltd. | ||
| 275 | |||
| 276 | You can use, copy, modify and redistribute this package and associated | ||
| 277 | files under the same terms as Perl itself. | ||
| 278 | |||
| 279 | =cut | ||