Class: WhopSDK::Resources::Payouts

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/payouts.rb,
lib/whop_sdk/resources/payouts/methods.rb,
sig/whop_sdk/resources/payouts.rbs,
sig/whop_sdk/resources/payouts/methods.rbs

Overview

Payouts represent money sent from an account or user balance to an external destination, such as a bank account, wallet, or other saved payout method.

Use the Payouts API to create payouts from stablecoin accounts, list payout history for accounts or users, monitor payout statuses, and show expected arrival details for funds leaving Whop.

Defined Under Namespace

Classes: Methods

Instance Attribute Summary collapse

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:



101
102
103
104
# File 'lib/whop_sdk/resources/payouts.rb', line 101

def initialize(client:)
  @client = client
  @methods_ = WhopSDK::Resources::Payouts::Methods.new(client: client)
end

Instance Attribute Details

#methods_WhopSDK::Resources::Payouts::Methods (readonly)

Payouts represent money sent from an account or user balance to an external destination, such as a bank account, wallet, or other saved payout method.

Use the Payouts API to create payouts from stablecoin accounts, list payout history for accounts or users, monitor payout statuses, and show expected arrival details for funds leaving Whop.



19
20
21
# File 'lib/whop_sdk/resources/payouts.rb', line 19

def methods_
  @methods_
end

Instance Method Details

#create(account_id:, amount:, payout_method_id:, currency: nil, idempotency_key: nil, request_options: {}) ⇒ WhopSDK::Models::PayoutCreateResponse

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

Creates a payout from a stablecoin account to a saved payout method. The account's funds move from its stablecoin balance to an external bank account, wallet, or crypto address. Accounts that pay out from a fiat balance use POST /withdrawals. Requires the payouts API to be enabled for the account; contact support to enable it. The payout settles asynchronously; poll GET /payouts for the entry whose payout_request_id matches this payout's id.

Parameters:

  • account_id (String)

    The account to pay out from (a biz_ identifier).

  • amount (Float)

    The amount to pay out in the specified currency.

  • payout_method_id (String)

    The saved payout method to deliver to (a potk_ identifier).

  • currency (String)

    The payout currency. Defaults to usd.

  • idempotency_key (String)

    A client-generated key that makes retries safe. Retrying with the same key retur

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

Returns:

See Also:



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

def create(params)
  parsed, options = WhopSDK::PayoutCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "payouts",
    body: parsed,
    model: WhopSDK::Models::PayoutCreateResponse,
    options: options
  )
end

#list(account_id: nil, after: nil, before: nil, currency: nil, first: nil, last: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PayoutListResponse>

Lists payouts (withdrawal requests) for an account or user, most recent first. Pass exactly one of accountid (a biz identifier) or userid (a user identifier). The saved payout method on each payout additionally requires the payout:destination:read scope and is null without it.

Parameters:

  • account_id (String)

    The owning account ID (a biz_ identifier). Provide this or user_id.

  • after (String)

    Cursor to fetch the page after (from page_info.end_cursor).

  • before (String)

    Cursor to fetch the page before (from page_info.start_cursor).

  • currency (String)

    Optional currency code filter, for example usd.

  • first (Integer)

    Number of payouts to return from the start of the window.

  • last (Integer)

    Number of payouts to return from the end of the window.

  • user_id (String)

    The owning user ID (a user_ identifier). Provide this or account_id.

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

Returns:

See Also:



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/whop_sdk/resources/payouts.rb', line 85

def list(params = {})
  parsed, options = WhopSDK::PayoutListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "payouts",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::PayoutListResponse,
    options: options
  )
end