Class: WhopSDK::Resources::CheckoutConfigurations

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

Overview

Checkout configurations

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ CheckoutConfigurations

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

Parameters:



112
113
114
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 112

def initialize(client:)
  @client = client
end

Instance Method Details

#create(body:, request_options: {}) ⇒ WhopSDK::Models::CheckoutConfiguration

Creates a new checkout configuration

Required permissions:

  • ‘checkout_configuration:create`

  • ‘plan:create`

  • ‘access_pass:create`

  • ‘access_pass:update`

  • ‘checkout_configuration:basic:read`



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

def create(params)
  parsed, options = WhopSDK::CheckoutConfigurationCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "checkout_configurations",
    body: parsed[:body],
    model: WhopSDK::CheckoutConfiguration,
    options: options
  )
end

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

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

Returns a paginated list of checkout configurations for a company, with optional filtering by plan and creation date.

Required permissions:

  • ‘checkout_configuration:basic:read`

Parameters:

  • company_id (String)

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

  • created_before (Time, nil)

    Only return checkout configurations 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.

  • plan_id (String, nil)

    Filter checkout configurations to only those associated with this plan identifie

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

Returns:

See Also:



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 96

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

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

Retrieves the details of an existing checkout configuration.

Required permissions:

  • ‘checkout_configuration:basic:read`

Parameters:

  • id (String)

    The unique identifier of the checkout configuration.

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

Returns:

See Also:



52
53
54
55
56
57
58
59
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 52

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