Class: Inttegro::Resources::Payouts

Inherits:
Object
  • Object
show all
Defined in:
lib/inttegro/resources/payouts.rb

Overview

Payouts resource for configuring and managing automatic balance payouts.

Payouts transfer available balance from Inttegro to your financial accounts. Use this resource to configure payout destinations, manage payout schedules, enable foreign exchange conversion, and retrieve payout history.

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ Payouts

Returns a new instance of Payouts.



14
15
16
# File 'lib/inttegro/resources/payouts.rb', line 14

def initialize(http)
  @http = T.let(http, Inttegro::HTTPClient)
end

Instance Method Details

#cancel(payout_id:) ⇒ Inttegro::Payout

Cancel a scheduled payout before execution.

Only payouts in scheduled status with a future execution time can be canceled.

Parameters:

  • payout_id (String)

    Scheduled payout ID

Returns:



191
192
193
194
195
196
197
# File 'lib/inttegro/resources/payouts.rb', line 191

def cancel(payout_id:)
  @http.post_resource(
    "/payouts/cancel",
    Inttegro::Payout, :payout,
    { payout_id: payout_id }
  )
end

#disable_automaticInttegro::PayoutSettingsMutation

Disable automatic payouts by switching to manual payout mode.

Disables automatic payouts for your application. When automatic payouts are disabled, the system will not automatically schedule payouts—you must manually trigger them. Balance transactions must still be at least 7 days old before they can be paid out, but the payout will only occur when you explicitly request it.

Examples:

Disable automatic payouts

result = client.payouts.disable_automatic

puts "Schedule type: #{result.schedule&.type}"

Returns:

See Also:



79
80
81
82
83
84
85
# File 'lib/inttegro/resources/payouts.rb', line 79

def disable_automatic
  @http.post_resource(
    "/payouts/disable",
    Inttegro::PayoutSettingsMutation, :settings,
    {}
  )
end

#disable_fxInttegro::PayoutSettingsLookup

Disable foreign exchange conversion for payouts.

Disables FX conversion, restricting payouts to accounts that match the transaction currency. After disabling FX, GHS balance can only be paid out to GHS accounts, USD balance only to USD accounts, etc.

Examples:

Disable foreign exchange for payouts

result = client.payouts.disable_fx

puts "FX enabled: #{result.fx_enabled}"

Returns:

See Also:



134
135
136
# File 'lib/inttegro/resources/payouts.rb', line 134

def disable_fx
  @http.post_resource("/payouts/disable_fx", Inttegro::PayoutSettingsLookup, :settings, {})
end

#enable_automaticObject Also known as: enable



87
88
89
90
91
92
93
# File 'lib/inttegro/resources/payouts.rb', line 87

def enable_automatic
  @http.post_resource(
    "/payouts/enable",
    Inttegro::PayoutSettingsMutation, :settings,
    {}
  )
end

#enable_fxInttegro::PayoutSettingsLookup

Enable foreign exchange conversion for payouts.

Enables FX conversion for payouts. When FX is enabled, Inttegro can automatically convert payout funds from one currency to another when routing to destination accounts. This allows you to consolidate multiple currencies into a single operating account or hold funds in a preferred currency.

With FX disabled (default), payouts only transfer funds to accounts matching the transaction currency. With FX enabled, GHS balance can be converted and paid out to USD accounts, for example.

Important: FX conversion incurs additional fees beyond standard payout fees, and exchange rates are determined at payout execution time. FX-enabled payouts require approval and special configuration.

Examples:

Enable foreign exchange for payouts

result = client.payouts.enable_fx

puts "FX enabled: #{result.fx_enabled}"

Returns:

See Also:



117
118
119
# File 'lib/inttegro/resources/payouts.rb', line 117

def enable_fx
  @http.post_resource("/payouts/enable_fx", Inttegro::PayoutSettingsLookup, :settings, {})
end

#lookup(payout_id:) ⇒ Object



176
177
178
179
180
181
182
# File 'lib/inttegro/resources/payouts.rb', line 176

def lookup(payout_id:)
  @http.post_resource(
    "/payouts/lookup",
    Inttegro::Payout, :payout,
    { payout_id: payout_id }
  )
end

#page(payload = {}) ⇒ Inttegro::PayoutPage

Retrieve a paginated list of payouts.

Returns payouts in reverse chronological order (most recent first). Use the has_more field and page parameter to navigate through results. Supports filtering by status and time range.

Examples:

Get first page of payouts

result = client.payouts.page(
  per_page: 25,
  page: 1
)

puts "Retrieved #{result.payouts&.length || 0} payouts"

Filter by status

paid_payouts = client.payouts.page(
  status: 'paid',
  per_page: 50
)

Parameters:

  • payload (Hash) (defaults to: {})

    Pagination and filter parameters (optional)

Options Hash (payload):

  • :page (Integer)

    Page number to retrieve (minimum 1, default: 1)

  • :per_page (Integer)

    Number of results per page (minimum 1, maximum 100, default: 10)

  • :status (String)

    Filter by payout status (e.g., 'pending', 'paid', 'failed')

  • :created_after (String)

    Filter payouts created after this timestamp (ISO 8601)

  • :created_before (String)

    Filter payouts created before this timestamp (ISO 8601)

Returns:

See Also:



168
169
170
# File 'lib/inttegro/resources/payouts.rb', line 168

def page(payload = {})
  @http.post_resource("/payouts/page", Inttegro::PayoutPage, :page, payload || {})
end

#schedule(payload) ⇒ Object



172
173
174
# File 'lib/inttegro/resources/payouts.rb', line 172

def schedule(payload)
  @http.post_resource("/payouts/schedule", Inttegro::Payout, :payout, payload)
end

#set_destinations(destinations:) ⇒ Inttegro::PayoutSettingsMutation

Configure which financial account should be used for payouts in each currency.

Sets payout destinations by mapping currency codes to financial account IDs. Each financial account must be owned by your application, have push operations enabled, and its currency must match the currency key in the destinations map.

Examples:

Set payout destinations for multiple currencies

result = client.payouts.set_destinations(
  destinations: {
    'ghs' => 'fa_1234567890abcdef',
    'usd' => 'fa_0987654321fedcba'
  }
)

puts "Destinations configured: #{result.destinations}"

Parameters:

  • destinations (Hash)

    Map of currency codes to financial account IDs (required)

Returns:

See Also:



39
40
41
42
43
44
45
# File 'lib/inttegro/resources/payouts.rb', line 39

def set_destinations(destinations:)
  @http.post_resource(
    "/payouts/set_destinations",
    Inttegro::PayoutSettingsMutation, :settings,
    { destinations: destinations }
  )
end

#settingsInttegro::PayoutSettingsLookup

Retrieve the current payout settings for your application.

Returns payout settings including configured payout destinations, schedule information, and whether foreign exchange is enabled.

Examples:

Get payout settings

result = client.payouts.settings

puts "Payout schedule: #{result.schedule&.name}"

Returns:

See Also:



60
61
62
# File 'lib/inttegro/resources/payouts.rb', line 60

def settings
  @http.post_resource("/payouts/settings", Inttegro::PayoutSettingsLookup, :settings, {})
end