Class: Stripe::CustomerBalanceTransactionService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/customer_balance_transaction_service.rb

Instance Method Summary collapse

Methods inherited from StripeService

#initialize, #request, #request_stream

Constructor Details

This class inherits a constructor from Stripe::StripeService

Instance Method Details

#create(customer, params = {}, opts = {}) ⇒ Object

Creates an immutable transaction that updates the customer’s credit [balance](stripe.com/docs/billing/customer/balance).



7
8
9
10
11
12
13
14
15
# File 'lib/stripe/services/customer_balance_transaction_service.rb', line 7

def create(customer, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/customers/%<customer>s/balance_transactions", { customer: CGI.escape(customer) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#list(customer, params = {}, opts = {}) ⇒ Object

Returns a list of transactions that updated the customer’s [balances](stripe.com/docs/billing/customer/balance).



18
19
20
21
22
23
24
25
26
# File 'lib/stripe/services/customer_balance_transaction_service.rb', line 18

def list(customer, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/customers/%<customer>s/balance_transactions", { customer: CGI.escape(customer) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#retrieve(customer, transaction, params = {}, opts = {}) ⇒ Object

Retrieves a specific customer balance transaction that updated the customer’s [balances](stripe.com/docs/billing/customer/balance).



29
30
31
32
33
34
35
36
37
# File 'lib/stripe/services/customer_balance_transaction_service.rb', line 29

def retrieve(customer, transaction, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/customers/%<customer>s/balance_transactions/%<transaction>s", { customer: CGI.escape(customer), transaction: CGI.escape(transaction) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#update(customer, transaction, params = {}, opts = {}) ⇒ Object

Most credit balance transaction fields are immutable, but you may update its description and metadata.



40
41
42
43
44
45
46
47
48
# File 'lib/stripe/services/customer_balance_transaction_service.rb', line 40

def update(customer, transaction, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/customers/%<customer>s/balance_transactions/%<transaction>s", { customer: CGI.escape(customer), transaction: CGI.escape(transaction) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end