Class: WhopSDK::Resources::Accounts

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

Overview

An Account represents a person or business on Whop that can have its own profile, wallet, and account-scoped settings. Use accounts for customers, creators, merchants, sellers, or connected businesses your integration supports.

Use the Accounts API to create accounts, list accounts visible to your credentials, retrieve or update an account, and retrieve the account associated with the current API key.

Defined Under Namespace

Classes: Preferences

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Accounts

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

Parameters:



248
249
250
251
# File 'lib/whop_sdk/resources/accounts.rb', line 248

def initialize(client:)
  @client = client
  @preferences = WhopSDK::Resources::Accounts::Preferences.new(client: client)
end

Instance Attribute Details

#preferencesWhopSDK::Resources::Accounts::Preferences (readonly)

An Account represents a person or business on Whop that can have its own profile, wallet, and account-scoped settings. Use accounts for customers, creators, merchants, sellers, or connected businesses your integration supports.

Use the Accounts API to create accounts, list accounts visible to your credentials, retrieve or update an account, and retrieve the account associated with the current API key.



21
22
23
# File 'lib/whop_sdk/resources/accounts.rb', line 21

def preferences
  @preferences
end

Instance Method Details

#create(email: nil, metadata: nil, title: nil, request_options: {}) ⇒ WhopSDK::Models::Account

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

Creates an account. User tokens create business accounts; business account API keys create connected accounts. Tax fields (tax_remitted_by, product_tax_code_id, business_address, tax_identifiers) are configured with Update Account, not at creation.

Parameters:

  • email (String)

    The email address of the account owner. Required for business account API key re

  • metadata (Hash{Symbol=>Object})

    Arbitrary key/value metadata to store on the account.

  • title (String)

    The display name of the account. Defaults to metadata.external_id or the owner

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

Returns:

See Also:



44
45
46
47
48
49
50
51
52
53
# File 'lib/whop_sdk/resources/accounts.rb', line 44

def create(params = {})
  parsed, options = WhopSDK::AccountCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "accounts",
    body: parsed,
    model: WhopSDK::Account,
    options: options
  )
end

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

Lists accounts visible to the credential. User tokens return the user's business accounts; business account API keys return the requesting business account and its connected accounts.

Parameters:

Returns:

See Also:



191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/whop_sdk/resources/accounts.rb', line 191

def list(params = {})
  parsed, options = WhopSDK::AccountListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "accounts",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Account,
    options: options
  )
end

#me(request_options: {}) ⇒ WhopSDK::Models::Account

Retrieves the business account associated with the current business account API key.

Parameters:

Returns:

See Also:



214
215
216
217
218
219
220
221
# File 'lib/whop_sdk/resources/accounts.rb', line 214

def me(params = {})
  @client.request(
    method: :get,
    path: "accounts/me",
    model: WhopSDK::Account,
    options: params[:request_options]
  )
end

#recommend_actions(account_id, request_options: {}) ⇒ WhopSDK::Models::AccountRecommendActionsResponse

Lists the recommended actions computed for the account — the same set embedded on the account resource, served on their own so a caller can fetch just the recommendations.

Parameters:

  • account_id (String)

    Account ID, prefixed biz_.

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

Returns:

See Also:



236
237
238
239
240
241
242
243
# File 'lib/whop_sdk/resources/accounts.rb', line 236

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

#retrieve(account_id, request_options: {}) ⇒ WhopSDK::Models::Account

Retrieves a single account visible to the credential, including its crypto wallet.

Parameters:

  • account_id (String)

    Account ID, prefixed biz_.

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

Returns:

See Also:



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

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

#update(account_id, affiliate_application_required: nil, affiliate_instructions: nil, banner_image: nil, business_address: nil, business_type: nil, country: nil, description: nil, featured_affiliate_product_id: nil, home_preferences: nil, industry_group: nil, industry_type: nil, invoice_prefix: nil, logo: nil, metadata: nil, onboarding_type: nil, opengraph_image: nil, opengraph_image_variant: nil, other_business_description: nil, other_industry_description: nil, product_tax_code_id: nil, require_2fa: nil, route: nil, send_customer_emails: nil, show_joined_whops: nil, show_reviews_dtc: nil, show_user_directory: nil, social_links: nil, store_page_config: nil, target_audience: nil, tax_identifiers: nil, tax_remitted_by: nil, title: nil, use_logo_as_opengraph_image_fallback: nil, request_options: {}) ⇒ WhopSDK::Models::Account

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

Updates an account. User tokens can update business accounts; business account API keys can update connected accounts.

Parameters:

  • account_id (String)

    Account ID, prefixed biz_.

  • affiliate_application_required (Boolean)

    Whether prospective affiliates must submit an application before promoting this

  • affiliate_instructions (String, nil)

    Guidelines shown to affiliates promoting this account.

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

    Attachment input for the account banner image.

  • business_address (WhopSDK::Models::AccountUpdateParams::BusinessAddress)

    Account business address used to calculate tax. A complete address in a supporte

  • business_type (String, nil)

    High-level business category for the account.

  • country (String, nil)

    Country where the account is located.

  • description (String, nil)

    Account promotional description.

  • featured_affiliate_product_id (String, nil)

    The ID of the product to feature for affiliates. Pass null to clear.

  • home_preferences (Array<String>)

    Public account home page preferences.

  • industry_group (String, nil)

    Account industry group.

  • industry_type (String, nil)

    Specific industry vertical for the account.

  • invoice_prefix (String, nil)

    Prefix used for account invoices.

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

    Attachment input for the account logo.

  • metadata (Hash{Symbol=>Object})

    Arbitrary key/value metadata to store on the account.

  • onboarding_type (String, nil)

    The type of onboarding the account has completed.

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

    Attachment input for the account Open Graph image.

  • opengraph_image_variant (String, nil)

    The account Open Graph image variant.

  • other_business_description (String, nil)

    The description of the business type when business_type is other.

  • other_industry_description (String, nil)

    The description of the industry type when industry_type is other.

  • product_tax_code_id (String, nil)

    ID of the tax classification code applied by default to the account's products.

  • require_2fa (Boolean)

    Whether the account requires authorized users to have two-factor authentication

  • route (String, nil)

    The unique URL slug for the account.

  • send_customer_emails (Boolean)

    Whether Whop sends transactional emails to customers on behalf of this account.

  • show_joined_whops (Boolean)

    Whether the account appears in joined whops on other accounts.

  • show_reviews_dtc (Boolean)

    Whether reviews are displayed on direct-to-consumer product pages.

  • show_user_directory (Boolean)

    Whether the account shows users in the user directory.

  • social_links (Array<Hash{Symbol=>Object}>)

    The full list of social links to display for the account.

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

    Account store page display configuration.

  • target_audience (String, nil)

    The target audience for this account.

  • tax_identifiers (Array<WhopSDK::Models::AccountUpdateParams::TaxIdentifier>)

    Account tax/VAT registrations to add or update. When tax_remitted_by is self

  • tax_remitted_by (Symbol, WhopSDK::Models::AccountUpdateParams::TaxRemittedBy)

    Who calculates and remits tax for the account: whop (Whop calculates and remit

  • title (String, nil)

    The display name of the account.

  • use_logo_as_opengraph_image_fallback (Boolean)

    Whether the account uses its logo as the fallback Open Graph image.

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

Returns:

See Also:



157
158
159
160
161
162
163
164
165
166
# File 'lib/whop_sdk/resources/accounts.rb', line 157

def update(, params = {})
  parsed, options = WhopSDK::AccountUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["accounts/%1$s", ],
    body: parsed,
    model: WhopSDK::Account,
    options: options
  )
end