Class: Stripe::CustomerBalanceTransaction
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::CustomerBalanceTransaction
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/customer_balance_transaction.rb
Overview
Each customer has a [Balance](stripe.com/docs/api/customers/object#customer_object-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](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`.
Related guide: [Customer balance](stripe.com/docs/billing/customer/balance)
Constant Summary collapse
- OBJECT_NAME =
"customer_balance_transaction"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
- .object_name ⇒ Object
- .retrieve(_id, _opts = {}) ⇒ Object
- .update(_id, _params = nil, _opts = nil) ⇒ Object
Instance Method Summary collapse
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Class Method Details
.object_name ⇒ Object
15 16 17 |
# File 'lib/stripe/resources/customer_balance_transaction.rb', line 15 def self.object_name "customer_balance_transaction" end |
.retrieve(_id, _opts = {}) ⇒ Object
27 28 29 30 31 |
# File 'lib/stripe/resources/customer_balance_transaction.rb', line 27 def self.retrieve(_id, _opts = {}) raise NotImplementedError, "Customer Balance Transactions cannot be retrieved without a customer ID. " \ "Retrieve a Customer Balance Transaction using `Customer.retrieve_balance_transaction('cus_123', 'cbtxn_123')`" end |
.update(_id, _params = nil, _opts = nil) ⇒ Object
33 34 35 36 37 |
# File 'lib/stripe/resources/customer_balance_transaction.rb', line 33 def self.update(_id, _params = nil, _opts = nil) raise NotImplementedError, "Customer Balance Transactions cannot be retrieved without a customer ID. " \ "Update a Customer Balance Transaction using `Customer.update_balance_transaction('cus_123', 'cbtxn_123', params)`" end |
Instance Method Details
#resource_url ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/stripe/resources/customer_balance_transaction.rb', line 19 def resource_url if !respond_to?(:customer) || customer.nil? raise NotImplementedError, "Customer Balance Transactions cannot be accessed without a customer ID." end "#{Customer.resource_url}/#{CGI.escape(customer)}/balance_transactions/#{CGI.escape(id)}" end |