Class: Stripe::CustomerFundingInstructionsService

Inherits:
StripeService
  • Object
show all
Defined in:
lib/stripe/services/customer_funding_instructions_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

Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new funding instructions will be created. If funding instructions have already been created for a given customer, the same funding instructions will be retrieved. In other words, we will return the same funding instructions each time.



9
10
11
12
13
14
15
16
17
# File 'lib/stripe/services/customer_funding_instructions_service.rb', line 9

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

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

Serializes a CustomerFundingInstructions create request into a batch job JSONL line.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/stripe/services/customer_funding_instructions_service.rb', line 20

def serialize_batch_create_funding_instructions(customer, params = {}, opts = {})
  request_id = SecureRandom.uuid
  stripe_version = opts[:stripe_version] || Stripe.api_version

  request_body = {
    id: request_id,
    params: params,
    stripe_version: stripe_version,
  }
  request_body[:path_params] = { customer: customer }
  request_body[:context] = opts[:stripe_context] if opts[:stripe_context]
  JSON.generate(request_body)
end