Sha256: e530dab62275b3f6e3e3d410415c009612ded830b3c7d12b200f9428e57250db

Contents?: true

Size: 1.71 KB

Versions: 39

Compression:

Stored size: 1.71 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  # Each customer has a [Balance](https://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](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`.
  #
  # Related guide: [Customer balance](https://stripe.com/docs/billing/customer/balance)
  class CustomerBalanceTransaction < APIResource
    extend Stripe::APIOperations::List
    include Stripe::APIOperations::Save

    OBJECT_NAME = "customer_balance_transaction"

    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

    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

    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
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
stripe-10.7.0.pre.beta.3 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.7.0.pre.beta.2 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.7.0.pre.beta.1 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.6.0 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.6.0.pre.beta.1 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.5.0 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.5.0.pre.beta.1 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.4.0 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.4.0.pre.beta.1 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.3.0 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.3.0.pre.beta.1 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.2.0 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.2.0.pre.beta.1 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.1.0 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.1.0.pre.beta.2 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.1.0.pre.beta.1 lib/stripe/resources/customer_balance_transaction.rb
stripe-10.0.0 lib/stripe/resources/customer_balance_transaction.rb
stripe-9.5.0.pre.beta.2 lib/stripe/resources/customer_balance_transaction.rb
stripe-9.5.0.pre.beta.1 lib/stripe/resources/customer_balance_transaction.rb
stripe-9.4.0 lib/stripe/resources/customer_balance_transaction.rb