Class: WhopSDK::Resources::Withdrawals

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/withdrawals.rb

Overview

Withdrawals

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Withdrawals

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

Parameters:



118
119
120
# File 'lib/whop_sdk/resources/withdrawals.rb', line 118

def initialize(client:)
  @client = client
end

Instance Method Details

#create(amount:, company_id:, currency:, payout_method_id: nil, platform_covers_fees: nil, statement_descriptor: nil, request_options: {}) ⇒ WhopSDK::Models::Withdrawal

Some parameter documentations has been truncated, see Models::WithdrawalCreateParams for more details.

Creates a withdrawal request for a ledger account

Required permissions:

  • ‘payout:withdraw_funds`

  • ‘payout:destination:read`

Parameters:

  • amount (Float)

    The amount to withdraw in the specified currency

  • company_id (String)

    The ID of the company to withdraw from.

  • currency (Symbol, WhopSDK::Models::Currency)

    The currency that is being withdrawn.

  • payout_method_id (String, nil)

    The ID of the payout method to use for the withdrawal.

  • platform_covers_fees (Boolean, nil)

    Whether the platform covers the payout fees instead of the connected account.

  • statement_descriptor (String, nil)

    Custom statement descriptor for the withdrawal. Must be between 5 and 22 charact

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

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
# File 'lib/whop_sdk/resources/withdrawals.rb', line 36

def create(params)
  parsed, options = WhopSDK::WithdrawalCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "withdrawals",
    body: parsed,
    model: WhopSDK::Withdrawal,
    options: options
  )
end

#list(company_id:, after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::WithdrawalListResponse>

Returns a paginated list of withdrawals for a company, with optional sorting and date filtering.

Required permissions:

  • ‘payout:withdrawal:read`

Parameters:

  • company_id (String)

    The unique identifier of the company to list withdrawals for.

  • after (String, nil)

    Returns the elements in the list that come after the specified cursor.

  • before (String, nil)

    Returns the elements in the list that come before the specified cursor.

  • created_after (Time, nil)

    Only return withdrawals created after this timestamp.

  • created_before (Time, nil)

    Only return withdrawals created before this timestamp.

  • direction (Symbol, WhopSDK::Models::Direction, nil)

    The direction of the sort.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

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

Returns:

See Also:



102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/whop_sdk/resources/withdrawals.rb', line 102

def list(params)
  parsed, options = WhopSDK::WithdrawalListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "withdrawals",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::WithdrawalListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Withdrawal

Retrieves the details of an existing withdrawal.

Required permissions:

  • ‘payout:withdrawal:read`

  • ‘payout:destination:read`

Parameters:

  • id (String)

    The unique identifier of the withdrawal to retrieve.

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

Returns:

See Also:



63
64
65
66
67
68
69
70
# File 'lib/whop_sdk/resources/withdrawals.rb', line 63

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["withdrawals/%1$s", id],
    model: WhopSDK::Withdrawal,
    options: params[:request_options]
  )
end