Class: WhopSDK::Resources::CheckoutConfigurations

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

Overview

A Checkout Configuration is a reusable checkout link owned by an account. In payment mode it sells a specific plan; in setup mode it collects and saves payment details without charging. Each configuration can also override which payment methods are accepted and how 3D Secure is enforced for that checkout.

Use the Checkout Configurations API to create checkout links for an existing or inline plan, list configurations for an account, retrieve the configuration behind a checkout URL, and delete links that should no longer be used.

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:



139
140
141
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 139

def initialize(client:)
  @client = client
end

Instance Method Details

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

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

Creates a reusable checkout configuration for an existing or inline plan.

Parameters:

  • affiliate_code (String, nil)

    Affiliate code to apply to the checkout.

  • company_id (String)

    Account ID, prefixed biz_.

  • currency (String, nil)

    Currency used for setup-mode payment method availability.

  • metadata (Object, nil)

    Custom key-value metadata copied to payments and memberships.

  • mode (Symbol, WhopSDK::Models::CheckoutConfigurationCreateParams::Mode)

    Checkout mode: payment collects payment for a plan now; setup saves payment

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

    Payment method overrides for this checkout. null uses the plan or platform def

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

    Plan attributes used to create or find a plan for this checkout configuration. M

  • plan_id (String, nil)

    Existing plan ID, prefixed plan_. Mutually exclusive with plan.

  • redirect_url (String, nil)

    URL customers are sent to after checkout.

  • three_ds_level (String, nil)

    3D Secure behavior for this checkout.

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

Returns:

See Also:



46
47
48
49
50
51
52
53
54
55
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 46

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

#delete(id, request_options: {}) ⇒ nil

Deletes a checkout configuration so its checkout URL can no longer be used.

Parameters:

  • id (String)

    The ID of the checkout configuration.

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

Returns:

  • (nil)

See Also:



127
128
129
130
131
132
133
134
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 127

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

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

Lists checkout configurations for an account.

Parameters:

  • company_id (String)

    Account ID, prefixed biz_.

  • after (String)

    Cursor for the next page of results.

  • created_after (Integer)

    Only return checkout configurations created after this Unix timestamp.

  • created_before (Integer)

    Only return checkout configurations created before this Unix timestamp.

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

    Sort direction. Defaults to desc.

  • first (Integer)

    Number of checkout configurations to return.

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

    Field used to sort checkout configurations.

  • plan_id (String)

    Only return checkout configurations for this plan ID, prefixed plan_.

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

Returns:

See Also:



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/whop_sdk/resources/checkout_configurations.rb', line 103

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

Retrieves a checkout configuration by ID. This endpoint is public so a checkout page can load from the configuration URL.

Parameters:

  • id (String)

    The ID of the checkout configuration.

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

Returns:

See Also:



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

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