NAME

Net::API::Stripe::Customer::BalanceTransaction - A Stripe Customer Balance Tranaction Object

SYNOPSIS

my $bt = $stripe->balance_transaction({
    amount => 2000,
    currency => 'jpy',
    customer => $customer_object,
    description => 'Payment for professional service',
    invoice => $invoice_object,
    metadata => { transaction_id => 123 },
    type => 'initial',
});

Crediting the customer:

my $bt = $stripe->balance_transaction({
    amount => -2000,
    credit_note => $credit_note_object,
    currency => 'jpy',
    customer => $customer_object,
    description => 'Credit note for cancelled invoice',
    invoice => $invoice_object,
    metadata => { transaction_id => 123 },
    type => 'credit_note',
});

See documentation in Net::API::Stripe for example to make api calls to Stripe to create those objects.

VERSION

v0.100.0

DESCRIPTION

Each customer has a 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 (https://stripe.com/docs/api/customers/update), or by creating a Customer Balance Transaction, which increments or decrements the customer's balance by the specified amount.

CONSTRUCTOR

new( %ARG )

Creates a new Net::API::Stripe::Customer::BalanceTransaction object. It may also take an hash like arguments, that also are method of the same name.

METHODS

id string

Unique identifier for the object.

object string, value is "customer_balance_transaction"

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

amount integer

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.

created timestamp

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

credit_note string (expandable)

The ID of the credit note (if any) related to the transaction. When expanded this is a Net::API::Stripe::Billing::CreditNote object.

currency currency

Three-letter ISO currency code, in lowercase. Must be a supported currency.

customer string (expandable)

The ID of the customer the transaction belongs to. When expanded, this is a Net::API::Stripe::Customer object.

description string

An arbitrary string attached to the object. Often useful for displaying to users.

ending_balance integer

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.

invoice string (expandable)

The ID of the invoice (if any) related to the transaction. When expanded, this is a Net::API::Stripe::Billing::Invoice object.

livemode boolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

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.

type string

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.

API SAMPLE

{
  "object": "balance",
  "available": [
    {
      "amount": 0,
      "currency": "jpy",
      "source_types": {
        "card": 0
      }
    }
  ],
  "connect_reserved": [
    {
      "amount": 0,
      "currency": "jpy"
    }
  ],
  "livemode": false,
  "pending": [
    {
      "amount": 7712,
      "currency": "jpy",
      "source_types": {
        "card": 7712
      }
    }
  ]
}

HISTORY

v0.1

Initial version

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/customer_balance_transactions, https://stripe.com/docs/billing/customer/balance

COPYRIGHT & LICENSE

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

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