Class: WhopSDK::Resources::CheckoutConfigurations

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

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:



109
110
111
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 109

def initialize(client:)
  @client = client
end

Instance Method Details

#create(plan: , plan_id: , affiliate_code: nil, metadata: nil, redirect_url: nil, request_options: {}) ⇒ WhopSDK::Models::CheckoutConfiguration

Creates a new checkout configuration

Required permissions:

  • ‘checkout_configuration:create`

  • ‘plan:create`

  • ‘access_pass:create`

  • ‘access_pass:update`

Parameters:

  • plan (WhopSDK::Models::CheckoutConfigurationCreateParams::Plan)

    Pass this object to create a new plan for this checkout configuration

  • plan_id (String)

    The ID of the plan to use for the checkout configuration

  • affiliate_code (String, nil)

    The affiliate code to use for the checkout configuration

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

    The metadata to use for the checkout configuration

  • redirect_url (String, nil)

    The URL to redirect the user to after the checkout configuration is created

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

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 32

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

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

Lists checkout configurations

Required permissions:

  • ‘checkout_configuration:basic:read`

Parameters:

  • company_id (String)

    The ID 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.

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

    The ID of the plan to filter checkout configurations by

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

Returns:

See Also:



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

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

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

Retrieves a checkout configuration by ID

Required permissions:

  • ‘checkout_configuration:basic:read`

Parameters:

  • id (String)

    The ID of the checkout configuration

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

Returns:

See Also:



58
59
60
61
62
63
64
65
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 58

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