Class: Onlyfans::Resources::Payouts

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Payouts

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Payouts.

Parameters:



153
154
155
# File 'lib/onlyfans/resources/payouts.rb', line 153

def initialize(client:)
  @client = client
end

Instance Method Details

#list_requests(account, limit: nil, offset: nil, request_options: {}) ⇒ Onlyfans::Models::PayoutListRequestsResponse

List all payout requests for the account.

Parameters:

  • account (String)

    The Account ID

  • limit (String)

    Number of payout requests to return

  • offset (String)

    Number of payout requests to skip for pagination

  • request_options (Onlyfans::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/onlyfans/resources/payouts.rb', line 21

def list_requests(, params = {})
  parsed, options = Onlyfans::PayoutListRequestsParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/payouts/payout-requests", ],
    query: query,
    model: Onlyfans::Models::PayoutListRequestsResponse,
    options: options
  )
end

#request_manual_withdrawal(account, amount:, request_options: {}) ⇒ Onlyfans::Models::PayoutRequestManualWithdrawalResponse::UnionMember0, Onlyfans::Models::PayoutRequestManualWithdrawalResponse::UnionMember1

Request a payout withdrawal, if the frequency is set to manual. Refer to our ‘/payouts/balances` endpoint to retrieve the minimum and maximum withdrawal amounts.

Parameters:

  • account (String)

    The Account ID

  • amount (Integer)

    The amount to withdraw. Amount may not be higher than the current balance.

  • request_options (Onlyfans::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



48
49
50
51
52
53
54
55
56
57
# File 'lib/onlyfans/resources/payouts.rb', line 48

def request_manual_withdrawal(, params)
  parsed, options = Onlyfans::PayoutRequestManualWithdrawalParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/%1$s/payouts/request-manual-withdrawal", ],
    body: parsed,
    model: Onlyfans::Models::PayoutRequestManualWithdrawalResponse,
    options: options
  )
end

#retrieve_balances(account, request_options: {}) ⇒ Onlyfans::Models::PayoutRetrieveBalancesResponse

Get the current available and pending balances for the account.

Parameters:

Returns:

See Also:



70
71
72
73
74
75
76
77
# File 'lib/onlyfans/resources/payouts.rb', line 70

def retrieve_balances(, params = {})
  @client.request(
    method: :get,
    path: ["api/%1$s/payouts/balances", ],
    model: Onlyfans::Models::PayoutRetrieveBalancesResponse,
    options: params[:request_options]
  )
end

#retrieve_earning_statistics(account, end_date: nil, start_date: nil, request_options: {}) ⇒ Onlyfans::Models::PayoutRetrieveEarningStatisticsResponse

Get total and monthly time-series earning statistics for the account.

Parameters:

  • account (String)

    The Account ID

  • end_date (String, nil)

    The end date for earning statistics. Keep empty to get all earnings.

  • start_date (String, nil)

    The start date for earning statistics. Keep empty to get all earnings.

  • request_options (Onlyfans::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/onlyfans/resources/payouts.rb', line 94

def retrieve_earning_statistics(, params = {})
  parsed, options = Onlyfans::PayoutRetrieveEarningStatisticsParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/payouts/earning-statistics", ],
    query: query.transform_keys(end_date: "endDate", start_date: "startDate"),
    model: Onlyfans::Models::PayoutRetrieveEarningStatisticsResponse,
    options: options
  )
end

#retrieve_eligibility(account, request_options: {}) ⇒ Onlyfans::Models::PayoutRetrieveEligibilityResponse

Get the eligibility details for receiving payouts.

Parameters:

Returns:

See Also:



117
118
119
120
121
122
123
124
# File 'lib/onlyfans/resources/payouts.rb', line 117

def retrieve_eligibility(, params = {})
  @client.request(
    method: :get,
    path: ["api/%1$s/payouts/eligibility", ],
    model: Onlyfans::Models::PayoutRetrieveEligibilityResponse,
    options: params[:request_options]
  )
end

#update_frequency(account, frequency:, request_options: {}) ⇒ Onlyfans::Models::PayoutUpdateFrequencyResponse

Update the payout frequency for the account (Manual, Weekly or Monthly).

Parameters:

Returns:

See Also:



139
140
141
142
143
144
145
146
147
148
# File 'lib/onlyfans/resources/payouts.rb', line 139

def update_frequency(, params)
  parsed, options = Onlyfans::PayoutUpdateFrequencyParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["api/%1$s/payouts/payout-frequency", ],
    body: parsed,
    model: Onlyfans::Models::PayoutUpdateFrequencyResponse,
    options: options
  )
end