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:



123
124
125
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 123

def initialize(client:)
  @client = client
end

Instance Method Details

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

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

Creates a new checkout configuration

Required permissions:

  • ‘checkout_configuration:create`

  • ‘plan:create`

  • ‘access_pass:create`

  • ‘access_pass:update`

  • ‘checkout_configuration:basic:read`

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

  • company_id (String)

    The ID of the company for which to generate the checkout configuration. Only req

  • 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

  • payment_method_configuration (WhopSDK::Models::CheckoutConfigurationCreateParams::PaymentMethodConfiguration, nil)

    This currently only works for configurations made in ‘setup’ mode. The explicit

  • redirect_url (String, nil)

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

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

Returns:

See Also:



42
43
44
45
46
47
48
49
50
51
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 42

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, created_after: nil, created_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.

  • created_after (Time, nil)

    The minimum creation date to filter by

  • created_before (Time, nil)

    The maximum creation date to filter by

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



108
109
110
111
112
113
114
115
116
117
118
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 108

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:



68
69
70
71
72
73
74
75
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 68

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