Class: GoCardlessPro::Services::BillingRequestWithActionsService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/gocardless_pro/services/billing_request_with_actions_service.rb

Overview

Service for making requests to the BillingRequestWithAction endpoints

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #make_request, #sub_url

Constructor Details

This class inherits a constructor from GoCardlessPro::Services::BaseService

Instance Method Details

#create_with_actions(options = {}) ⇒ Object

Creates a billing request and completes any specified actions in a single request. This endpoint allows you to create a billing request and immediately complete actions such as collecting customer details, bank account details, or other required actions. Example URL: /billing_requests/create_with_actions



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/gocardless_pro/services/billing_request_with_actions_service.rb', line 21

def create_with_actions(options = {})
  path = '/billing_requests/create_with_actions'

  params = options.delete(:params) || {}
  options[:params] = {}
  options[:params][envelope_key] = params

  options[:retry_failures] = true

  response = make_request(:post, path, options)

  return if response.body.nil?

  Resources::BillingRequestWithAction.new(unenvelope_body(response.body), response)
end