Class: WhopSDK::Resources::SetupIntents

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

Overview

Setup intents

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SetupIntents

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

Parameters:



82
83
84
# File 'lib/whop_sdk/resources/setup_intents.rb', line 82

def initialize(client:)
  @client = client
end

Instance Method Details

#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::SetupIntentListResponse>

Returns a paginated list of setup intents for a company, with optional filtering by creation date. A setup intent securely collects and stores a member’s payment method for future use without charging them immediately.

Required permissions:

  • ‘payment:setup_intent:read`

  • ‘member:basic:read`

  • ‘member:email:read`

Parameters:

  • company_id (String)

    The unique identifier of the company to list setup intents 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 setup intents created after this timestamp.

  • created_before (Time, nil)

    Only return setup intents 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:



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/whop_sdk/resources/setup_intents.rb', line 66

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

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

Retrieves the details of an existing setup intent.

Required permissions:

  • ‘payment:setup_intent:read`

  • ‘member:basic:read`

  • ‘member:email:read`

Parameters:

  • id (String)

    The unique identifier of the setup intent.

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

Returns:

See Also:



24
25
26
27
28
29
30
31
# File 'lib/whop_sdk/resources/setup_intents.rb', line 24

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