Class: Onlyfans::Resources::Chargebacks

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Chargebacks

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 Chargebacks.

Parameters:



97
98
99
# File 'lib/onlyfans/resources/chargebacks.rb', line 97

def initialize(client:)
  @client = client
end

Instance Method Details

#calculate_ratio(account, end_date: nil, start_date: nil, request_options: {}) ⇒ Onlyfans::Models::ChargebackCalculateRatioResponse

The Chargeback Ratio reflects the number of chargebacks compared to the total number of payments as a percentage. Ideally, your Chargeback Ratio should be under 1%.

Parameters:

  • account (String)

    The Account ID

  • end_date (String)

    The end date for the chargeback ratio. Keep empty to get all.

  • start_date (String)

    The start date for the chargeback ratio. Keep empty to get all.

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

Returns:

See Also:



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/onlyfans/resources/chargebacks.rb', line 55

def calculate_ratio(, params = {})
  parsed, options = Onlyfans::ChargebackCalculateRatioParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/chargebacks/ratio", ],
    query: query,
    model: Onlyfans::Models::ChargebackCalculateRatioResponse,
    options: options
  )
end

#list(account, end_date: nil, limit: nil, offset: nil, start_date: nil, request_options: {}) ⇒ Onlyfans::Models::ChargebackListResponse

Retrieve a list of chargebacks within a specified date range. Possible statuses are ‘loading`, `done`, `undo`.

Parameters:

  • account (String)

    The Account ID

  • end_date (String)

    The end date for the chargebacks. Keep empty to get all.

  • limit (String, nil)

    Number of chargebacks to return (1-100). Default = 10

  • offset (String, nil)

    Number of chargebacks to skip, used for pagination.

  • start_date (String)

    The start date for the chargebacks. Keep empty to get all.

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

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/onlyfans/resources/chargebacks.rb', line 26

def list(, params = {})
  parsed, options = Onlyfans::ChargebackListParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/chargebacks", ],
    query: query,
    model: Onlyfans::Models::ChargebackListResponse,
    options: options
  )
end

#list_statistics(account, end_date: nil, start_date: nil, request_options: {}) ⇒ Onlyfans::Models::ChargebackListStatisticsResponse

List chargeback counts & amounts per hour, day or month.

Parameters:

  • account (String)

    The Account ID

  • end_date (String)

    The end date for the chargebacks. Keep empty to get all.

  • start_date (String)

    The start date for the chargebacks. Keep empty to get all.

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

Returns:

See Also:



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/onlyfans/resources/chargebacks.rb', line 82

def list_statistics(, params = {})
  parsed, options = Onlyfans::ChargebackListStatisticsParams.dump_request(params)
  query = Onlyfans::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/%1$s/chargebacks/statistics", ],
    query: query,
    model: Onlyfans::Models::ChargebackListStatisticsResponse,
    options: options
  )
end