Class: WhopSDK::Resources::Transfers

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

Overview

Transfers move value between identities on Whop. They are used for account-to-account money movement, user payouts inside Whop, crypto transfers, and claim links depending on the destination type.

Use the Transfers API to create a transfer, list previous transfers, and retrieve a transfer by ID when reconciling money movement between accounts or users.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Transfers

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

Parameters:



126
127
128
# File 'lib/whop_sdk/resources/transfers.rb', line 126

def initialize(client:)
  @client = client
end

Instance Method Details

#create(amount:, origin_id:, currency: nil, destination_id: nil, expires_at: nil, idempotence_key: nil, metadata: nil, notes: nil, redeemable_count: nil, type: nil, request_options: {}) ⇒ WhopSDK::Models::TransferCreateResponse::Transfer, ...

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

Moves funds out of an account. type selects the kind of movement (default ledger): ledger transfers credit between two ledger accounts and returns a Transfer; wallet_send sends USDT from the origin account's Ethereum wallet to a recipient; claim_link funds a shareable claim link anyone with the URL can redeem.

Parameters:

  • amount (Float)

    The amount to move, in the transfer currency. For example 25.00.

  • origin_id (String)

    The account sending the funds. A user ID (user_xxx), account ID (biz_xxx), or le

  • currency (String)

    Currency, such as usd. Required for ledger transfers.

  • destination_id (String)

    The recipient. Required for ledger and walletsend (a user/biz*/ldgr* ID, or —

  • expires_at (Time, nil)

    claim_link only. Link expiry as an ISO 8601 timestamp. Defaults to 24 hours from

  • idempotence_key (String, nil)

    Ledger transfers only. A unique key to prevent duplicate transfers.

  • metadata (Hash{Symbol=>Object}, nil)

    Ledger transfers only. Custom key-value pairs attached to the transfer. Max 50 k

  • notes (String, nil)

    Ledger transfers only. A short note describing the transfer.

  • redeemable_count (Integer)

    claim_link only. How many different users can claim the link. Defaults to 1.

  • type (Symbol, WhopSDK::Models::TransferCreateParams::Type)

    The kind of money movement. Defaults to ledger.

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

Returns:

See Also:



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

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

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

Lists ledger transfers for an account. You must specify an origin_id or a destination_id.

Parameters:

  • 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).

  • created_after (String)

    Only transfers created strictly after this ISO 8601 timestamp.

  • created_before (String)

    Only transfers created strictly before this ISO 8601 timestamp.

  • destination_id (String)

    Filter to transfers received by this account.

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

    Sort direction. Defaults to desc.

  • first (Integer)

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

  • last (Integer)

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

  • order (Symbol, WhopSDK::Models::TransferListParams::Order)

    Sort column. Defaults to created_at.

  • origin_id (String)

    Filter to transfers sent from this account.

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

Returns:

See Also:



110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/whop_sdk/resources/transfers.rb', line 110

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

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

Retrieves a ledger transfer by ID.

Parameters:

Returns:

See Also:



71
72
73
74
75
76
77
78
# File 'lib/whop_sdk/resources/transfers.rb', line 71

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