| 1 | ##---------------------------------------------------------------------------- | ||
| 2 | ## Stripe API - ~/lib/Net/API/Stripe/Customer/BalanceTransaction.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/customer_balance_transactions | ||
| 11 | package Net::API::Stripe::Customer::BalanceTransaction; | ||
| 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 { return( shift->_set_get_scalar( 'id', @_ ) ); } |
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 20 | |||
| 21 | 0 | ▶ | sub object { return( shift->_set_get_scalar( 'object', @_ ) ); } |
|
Subroutine
object: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 22 | |||
| 23 | 0 | ▶ | sub amount { return( shift->_set_get_number( 'amount', @_ ) ); } |
|
Subroutine
amount: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 24 | |||
| 25 | 0 | ▶ | sub created { return( shift->_set_get_datetime( 'created', @_ ) ); } |
|
Subroutine
created: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 26 | |||
| 27 | 0 | ▶ | sub credit_note { return( shift->_set_get_scalar_or_object( 'credit_note', 'Net::API::Stripe::Billing::CreditNote', @_ ) ); } |
|
Subroutine
credit_note: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 28 | |||
| 29 | 0 | ▶ | sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); } |
|
Subroutine
currency: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 30 | |||
| 31 | 0 | ▶ | sub customer { return( shift->_set_get_scalar_or_object( 'customer', 'Net::API::Stripe::Customer', @_ ) ); } |
|
Subroutine
customer: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 32 | |||
| 33 | 0 | ▶ | sub description { return( shift->_set_get_scalar( 'description', @_ ) ); } |
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 34 | |||
| 35 | 0 | ▶ | sub ending_balance { return( shift->_set_get_number( 'ending_balance', @_ ) ); } |
|
Subroutine
ending_balance: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 36 | |||
| 37 | 0 | ▶ | sub invoice { return( shift->_set_get_scalar_or_object( 'invoice', 'Net::API::Stripe::Billing::Invoice', @_ ) ); } |
|
Subroutine
invoice: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 38 | |||
| 39 | 0 | ▶ | sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); } |
|
Subroutine
livemode: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 40 | |||
| 41 | 0 | ▶ | sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); } |
|
Subroutine
metadata: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | |||
| 43 | 0 | ▶ | sub type { return( shift->_set_get_scalar( 'type', @_ ) ); } |
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 44 | |||
| 45 | 1 | 1; | |
| 46 | |||
| 47 | __END__ | ||
| 48 | |||
| 49 | =encoding utf8 | ||
| 50 | |||
| 51 | =head1 NAME | ||
| 52 | |||
| 53 | Net::API::Stripe::Customer::BalanceTransaction - A Stripe Customer Balance Tranaction Object | ||
| 54 | |||
| 55 | =head1 SYNOPSIS | ||
| 56 | |||
| 57 | my $bt = $stripe->balance_transaction({ | ||
| 58 | amount => 2000, | ||
| 59 | currency => 'jpy', | ||
| 60 | customer => $customer_object, | ||
| 61 | description => 'Payment for professional service', | ||
| 62 | invoice => $invoice_object, | ||
| 63 | metadata => { transaction_id => 123 }, | ||
| 64 | type => 'initial', | ||
| 65 | }); | ||
| 66 | |||
| 67 | Crediting the customer: | ||
| 68 | |||
| 69 | my $bt = $stripe->balance_transaction({ | ||
| 70 | amount => -2000, | ||
| 71 | credit_note => $credit_note_object, | ||
| 72 | currency => 'jpy', | ||
| 73 | customer => $customer_object, | ||
| 74 | description => 'Credit note for cancelled invoice', | ||
| 75 | invoice => $invoice_object, | ||
| 76 | metadata => { transaction_id => 123 }, | ||
| 77 | type => 'credit_note', | ||
| 78 | }); | ||
| 79 | |||
| 80 | See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects. | ||
| 81 | |||
| 82 | =head1 VERSION | ||
| 83 | |||
| 84 | v0.100.0 | ||
| 85 | |||
| 86 | =head1 DESCRIPTION | ||
| 87 | |||
| 88 | Each customer has a I<balance> value, which denotes a debit or credit that's automatically applied to their next invoice upon finalization. You may modify the value directly by using the update customer API (L<https://stripe.com/docs/api/customers/update>), or by creating a Customer Balance Transaction, which increments or decrements the customer's I<balance> by the specified I<amount>. | ||
| 89 | |||
| 90 | =head1 CONSTRUCTOR | ||
| 91 | |||
| 92 | =over 4 | ||
| 93 | |||
| 94 | =item B<new>( %ARG ) | ||
| 95 | |||
| 96 | Creates a new L<Net::API::Stripe::Customer::BalanceTransaction> object. | ||
| 97 | It may also take an hash like arguments, that also are method of the same name. | ||
| 98 | |||
| 99 | =back | ||
| 100 | |||
| 101 | =head1 METHODS | ||
| 102 | |||
| 103 | =over 4 | ||
| 104 | |||
| 105 | =item B<id> string | ||
| 106 | |||
| 107 | Unique identifier for the object. | ||
| 108 | |||
| 109 | =item B<object> string, value is "customer_balance_transaction" | ||
| 110 | |||
| 111 | String representing the object’s type. Objects of the same type share the same value. | ||
| 112 | |||
| 113 | =item B<amount> integer | ||
| 114 | |||
| 115 | The amount of the transaction. A negative value is a credit for the customer’s balance, and a positive value is a debit to the customer’s balance. | ||
| 116 | |||
| 117 | =item B<created> timestamp | ||
| 118 | |||
| 119 | Time at which the object was created. Measured in seconds since the Unix epoch. | ||
| 120 | |||
| 121 | =item B<credit_note> string (expandable) | ||
| 122 | |||
| 123 | The ID of the credit note (if any) related to the transaction. When expanded this is a L<Net::API::Stripe::Billing::CreditNote> object. | ||
| 124 | |||
| 125 | =item B<currency> currency | ||
| 126 | |||
| 127 | Three-letter ISO currency code, in lowercase. Must be a supported currency. | ||
| 128 | |||
| 129 | =item B<customer> string (expandable) | ||
| 130 | |||
| 131 | The ID of the customer the transaction belongs to. When expanded, this is a L<Net::API::Stripe::Customer> object. | ||
| 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<ending_balance> integer | ||
| 138 | |||
| 139 | The customer’s balance after the transaction was applied. A negative value decreases the amount due on the customer’s next invoice. A positive value increases the amount due on the customer’s next invoice. | ||
| 140 | |||
| 141 | =item B<invoice> string (expandable) | ||
| 142 | |||
| 143 | The ID of the invoice (if any) related to the transaction. 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<type> string | ||
| 154 | |||
| 155 | Transaction type: adjustment, applied_to_invoice, credit_note, initial, invoice_too_large, invoice_too_small, unapplied_from_invoice, or unspent_receiver_credit. See the Customer Balance page to learn more about transaction types. | ||
| 156 | |||
| 157 | =back | ||
| 158 | |||
| 159 | =head1 API SAMPLE | ||
| 160 | |||
| 161 | { | ||
| 162 | "object": "balance", | ||
| 163 | "available": [ | ||
| 164 | { | ||
| 165 | "amount": 0, | ||
| 166 | "currency": "jpy", | ||
| 167 | "source_types": { | ||
| 168 | "card": 0 | ||
| 169 | } | ||
| 170 | } | ||
| 171 | ], | ||
| 172 | "connect_reserved": [ | ||
| 173 | { | ||
| 174 | "amount": 0, | ||
| 175 | "currency": "jpy" | ||
| 176 | } | ||
| 177 | ], | ||
| 178 | "livemode": false, | ||
| 179 | "pending": [ | ||
| 180 | { | ||
| 181 | "amount": 7712, | ||
| 182 | "currency": "jpy", | ||
| 183 | "source_types": { | ||
| 184 | "card": 7712 | ||
| 185 | } | ||
| 186 | } | ||
| 187 | ] | ||
| 188 | } | ||
| 189 | |||
| 190 | =head1 HISTORY | ||
| 191 | |||
| 192 | =head2 v0.1 | ||
| 193 | |||
| 194 | Initial version | ||
| 195 | |||
| 196 | =head1 AUTHOR | ||
| 197 | |||
| 198 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 199 | |||
| 200 | =head1 SEE ALSO | ||
| 201 | |||
| 202 | Stripe API documentation: | ||
| 203 | |||
| 204 | L<https://stripe.com/docs/api/customer_balance_transactions>, L<https://stripe.com/docs/billing/customer/balance> | ||
| 205 | |||
| 206 | =head1 COPYRIGHT & LICENSE | ||
| 207 | |||
| 208 | Copyright (c) 2019-2020 DEGUEST Pte. Ltd. | ||
| 209 | |||
| 210 | You can use, copy, modify and redistribute this package and associated | ||
| 211 | files under the same terms as Perl itself. | ||
| 212 | |||
| 213 | =cut | ||