Class: WhopSDK::Client
- Inherits:
-
Internal::Transport::BaseClient
- Object
- Internal::Transport::BaseClient
- WhopSDK::Client
- Defined in:
- lib/whop_sdk/client.rb,
sig/whop_sdk/client.rbs
Constant Summary collapse
- DEFAULT_MAX_RETRIES =
Default max number of retries to attempt after a failed retryable request.
2- DEFAULT_TIMEOUT_IN_SECONDS =
Default per-request timeout.
60.0- DEFAULT_INITIAL_RETRY_DELAY =
Default initial retry delay in seconds. Overall delay is calculated using exponential backoff + jitter.
0.5- DEFAULT_MAX_RETRY_DELAY =
Default max retry delay in seconds.
8.0
Constants inherited from Internal::Transport::BaseClient
Internal::Transport::BaseClient::MAX_REDIRECTS, Internal::Transport::BaseClient::PLATFORM_HEADERS, Internal::Transport::BaseClient::WhopSDK
Instance Attribute Summary collapse
- #access_tokens ⇒ WhopSDK::Resources::AccessTokens readonly
- #account_links ⇒ WhopSDK::Resources::AccountLinks readonly
-
#accounts ⇒ WhopSDK::Resources::Accounts
readonly
An Account represents a person or business on Whop that can have its own profile, wallet, and account-scoped settings.
-
#ad_campaigns ⇒ WhopSDK::Resources::AdCampaigns
readonly
An Ad Campaign is the top-level container for paid ads on an ad network.
-
#ad_groups ⇒ WhopSDK::Resources::AdGroups
readonly
An Ad Group sits inside an ad campaign and controls delivery for ads.
- #ad_reports ⇒ WhopSDK::Resources::AdReports readonly
-
#ads ⇒ WhopSDK::Resources::Ads
readonly
An Ad is the individual creative unit delivered by an ad group.
- #affiliates ⇒ WhopSDK::Resources::Affiliates readonly
- #ai_chats ⇒ WhopSDK::Resources::AIChats readonly
-
#api_key ⇒ String
readonly
An account API key, account scoped JWT, app API key, or user OAuth token.
- #app_builds ⇒ WhopSDK::Resources::AppBuilds readonly
-
#app_id ⇒ String?
readonly
When using the SDK in app mode pass this parameter to allow verifying user tokens.
-
#apps ⇒ WhopSDK::Resources::Apps
readonly
An App is software you build on Whop.
-
#audiences ⇒ WhopSDK::Resources::Audiences
readonly
An Audience represents a customer list uploaded to Whop for ad targeting.
- #authorized_users ⇒ WhopSDK::Resources::AuthorizedUsers readonly
- #bounties ⇒ WhopSDK::Resources::Bounties readonly
-
#cards ⇒ WhopSDK::Resources::Cards
readonly
Cards represent Whop-issued virtual payment cards that spend from an account or user balance.
- #chat_channels ⇒ WhopSDK::Resources::ChatChannels readonly
-
#checkout_configurations ⇒ WhopSDK::Resources::CheckoutConfigurations
readonly
A Checkout Configuration is a reusable checkout link owned by an account.
- #companies ⇒ WhopSDK::Resources::Companies readonly
- #company_token_transactions ⇒ WhopSDK::Resources::CompanyTokenTransactions readonly
- #course_chapters ⇒ WhopSDK::Resources::CourseChapters readonly
- #course_lesson_interactions ⇒ WhopSDK::Resources::CourseLessonInteractions readonly
- #course_lessons ⇒ WhopSDK::Resources::CourseLessons readonly
- #course_students ⇒ WhopSDK::Resources::CourseStudents readonly
- #courses ⇒ WhopSDK::Resources::Courses readonly
-
#deposits ⇒ WhopSDK::Resources::Deposits
readonly
Deposits describe ways to add funds to an account balance, including hosted deposit pages, bank deposit instructions, and supported crypto wallet addresses.
- #dispute_alerts ⇒ WhopSDK::Resources::DisputeAlerts readonly
- #disputes ⇒ WhopSDK::Resources::Disputes readonly
- #dm_channels ⇒ WhopSDK::Resources::DmChannels readonly
- #dm_members ⇒ WhopSDK::Resources::DmMembers readonly
- #entries ⇒ WhopSDK::Resources::Entries readonly
-
#events ⇒ WhopSDK::Resources::Events
readonly
An Event records conversion or engagement activity for an account, such as page views, purchases, or leads.
- #experiences ⇒ WhopSDK::Resources::Experiences readonly
- #fee_markups ⇒ WhopSDK::Resources::FeeMarkups readonly
- #files ⇒ WhopSDK::Resources::Files readonly
-
#financial_activity ⇒ WhopSDK::Resources::FinancialActivity
readonly
A Ledger Activity row is a single financial event on an account's ledger — a payment, withdrawal, refund, transfer, on-chain deposit, swap, or card transaction.
- #forum_posts ⇒ WhopSDK::Resources::ForumPosts readonly
- #forums ⇒ WhopSDK::Resources::Forums readonly
- #invoices ⇒ WhopSDK::Resources::Invoices readonly
- #leads ⇒ WhopSDK::Resources::Leads readonly
- #ledger_accounts ⇒ WhopSDK::Resources::LedgerAccounts readonly
-
#media ⇒ WhopSDK::Resources::Media
readonly
A Media Asset is an AI-generated image or video created from a prompt and billed from an account balance.
- #members ⇒ WhopSDK::Resources::Members readonly
- #memberships ⇒ WhopSDK::Resources::Memberships readonly
- #messages ⇒ WhopSDK::Resources::Messages readonly
- #notifications ⇒ WhopSDK::Resources::Notifications readonly
- #payment_methods ⇒ WhopSDK::Resources::PaymentMethods readonly
- #payments ⇒ WhopSDK::Resources::Payments readonly
- #payout_accounts ⇒ WhopSDK::Resources::PayoutAccounts readonly
-
#payouts ⇒ WhopSDK::Resources::Payouts
readonly
Payouts represent money sent from an account or user balance to an external destination, such as a bank account, wallet, or other saved payout method.
-
#people ⇒ WhopSDK::Resources::People
readonly
A Person represents a visitor or customer of an account, assembled from pixel events and purchase activity — ad clicks, storefront visits, and checkouts.
-
#plans ⇒ WhopSDK::Resources::Plans
readonly
A Plan defines how customers buy a product.
-
#products ⇒ WhopSDK::Resources::Products
readonly
A Product is a digital good or service sold on Whop.
- #promo_codes ⇒ WhopSDK::Resources::PromoCodes readonly
- #reactions ⇒ WhopSDK::Resources::Reactions readonly
-
#referrals ⇒ WhopSDK::Resources::Referrals
readonly
The Referrals API covers your Whop partner activity: the users you referred onto Whop, the businesses you referred and the earnings generated from their processing volume, and the partner leaderboard.
- #refunds ⇒ WhopSDK::Resources::Refunds readonly
- #resolution_center_cases ⇒ WhopSDK::Resources::ResolutionCenterCases readonly
- #reviews ⇒ WhopSDK::Resources::Reviews readonly
- #setup_intents ⇒ WhopSDK::Resources::SetupIntents readonly
- #shipments ⇒ WhopSDK::Resources::Shipments readonly
-
#social_accounts ⇒ WhopSDK::Resources::SocialAccounts
readonly
A Social Account represents an external profile connected to a Whop account or user, such as a Facebook page or Instagram account.
-
#stats ⇒ WhopSDK::Resources::Stats
readonly
Stats represent aggregated activity for an account over time.
- #support_channels ⇒ WhopSDK::Resources::SupportChannels readonly
-
#swaps ⇒ WhopSDK::Resources::Swaps
readonly
Swaps convert value between supported tokens, chains, or wallet destinations for an account.
- #topups ⇒ WhopSDK::Resources::Topups readonly
-
#transfers ⇒ WhopSDK::Resources::Transfers
readonly
Transfers move value between identities on Whop.
-
#user_token_jwks_url ⇒ String?
readonly
Override for the JWKS endpoint used by #verify_user_token.
-
#user_token_public_key ⇒ String?
readonly
Static public key (PEM or JWK JSON) used by #verify_user_token to verify user tokens.
-
#users ⇒ WhopSDK::Resources::Users
readonly
A User represents a person on Whop.
-
#verifications ⇒ WhopSDK::Resources::Verifications
readonly
A Verification represents an identity review for a person or business.
-
#version ⇒ String?
readonly
Pins the API version (an ISO date).
- #webhook_key ⇒ String? readonly
- #webhooks ⇒ WhopSDK::Resources::Webhooks readonly
- #withdrawals ⇒ WhopSDK::Resources::Withdrawals readonly
- #workforce ⇒ WhopSDK::Resources::Workforce readonly
Attributes inherited from Internal::Transport::BaseClient
#base_url, #headers, #idempotency_header, #initial_retry_delay, #max_retries, #max_retry_delay, #requester, #timeout
Instance Method Summary collapse
-
#initialize(api_key: ENV["WHOP_API_KEY"], webhook_key: ENV["WHOP_WEBHOOK_SECRET"], app_id: ENV["WHOP_APP_ID"], version: ENV.fetch("WHOP_API_VERSION", "2026-07-08-1"), user_token_public_key: ENV["WHOP_USER_TOKEN_PUBLIC_KEY"], user_token_jwks_url: ENV["WHOP_USER_TOKEN_JWKS_URL"], base_url: ENV["WHOP_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY) ⇒ Client
constructor
Creates and returns a new client for interacting with the API.
-
#verify_user_token(token_or_headers, **opts) ⇒ Helpers::VerifyUserToken::UserTokenPayload?
Verifies a Whop user token.
-
#verify_user_token!(token_or_headers, **opts) ⇒ Helpers::VerifyUserToken::UserTokenPayload
Verifies a Whop user token.
Methods inherited from Internal::Transport::BaseClient
follow_redirect, #inspect, reap_connection!, #request, #send_request, should_retry?, validate!
Methods included from Internal::Util::SorbetRuntimeSupport
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type
Constructor Details
#initialize(api_key: ENV["WHOP_API_KEY"], webhook_key: ENV["WHOP_WEBHOOK_SECRET"], app_id: ENV["WHOP_APP_ID"], version: ENV.fetch("WHOP_API_VERSION", "2026-07-08-1"), user_token_public_key: ENV["WHOP_USER_TOKEN_PUBLIC_KEY"], user_token_jwks_url: ENV["WHOP_USER_TOKEN_JWKS_URL"], base_url: ENV["WHOP_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY) ⇒ Client
Creates and returns a new client for interacting with the API.
must prepend your key/token with the word Bearer, which will look like
Bearer *************************** Defaults to ENV["WHOP_API_KEY"]
tokens Defaults to ENV["WHOP_APP_ID"]
generated against. Defaults to ENV["WHOP_API_VERSION"]
user tokens. When set, #verify_user_token skips remote JWKS fetching.
Defaults to ENV["WHOP_USER_TOKEN_PUBLIC_KEY"]
Defaults to ENV["WHOP_USER_TOKEN_JWKS_URL"], then to the canonical Whop endpoint.
"https://api.example.com/v2/". Defaults to ENV["WHOP_BASE_URL"]
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
# File 'lib/whop_sdk/client.rb', line 458 def initialize( api_key: ENV["WHOP_API_KEY"], webhook_key: ENV["WHOP_WEBHOOK_SECRET"], app_id: ENV["WHOP_APP_ID"], version: ENV.fetch("WHOP_API_VERSION", "2026-07-08-1"), user_token_public_key: ENV["WHOP_USER_TOKEN_PUBLIC_KEY"], user_token_jwks_url: ENV["WHOP_USER_TOKEN_JWKS_URL"], base_url: ENV["WHOP_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY ) base_url ||= "https://api.whop.com/api/v1" if api_key.nil? raise ArgumentError.new("api_key is required, and can be set via environ: \"WHOP_API_KEY\"") end headers = { "x-whop-app-id" => (@app_id = app_id&.to_s), "api-version-date" => (@version = version.to_s) } custom_headers_env = ENV["WHOP_CUSTOM_HEADERS"] unless custom_headers_env.nil? parsed = {} custom_headers_env.split("\n").each do |line| colon = line.index(":") unless colon.nil? parsed[line[0...colon].strip] = line[(colon + 1)..].strip end end headers = parsed.merge(headers) end @api_key = api_key.to_s @webhook_key = webhook_key&.to_s @user_token_public_key = user_token_public_key&.to_s @user_token_jwks_url = user_token_jwks_url&.to_s super( base_url: base_url, timeout: timeout, max_retries: max_retries, initial_retry_delay: initial_retry_delay, max_retry_delay: max_retry_delay, headers: headers ) @apps = WhopSDK::Resources::Apps.new(client: self) @invoices = WhopSDK::Resources::Invoices.new(client: self) @course_lesson_interactions = WhopSDK::Resources::CourseLessonInteractions.new(client: self) @products = WhopSDK::Resources::Products.new(client: self) @social_accounts = WhopSDK::Resources::SocialAccounts.new(client: self) @audiences = WhopSDK::Resources::Audiences.new(client: self) @media = WhopSDK::Resources::Media.new(client: self) @people = WhopSDK::Resources::People.new(client: self) @events = WhopSDK::Resources::Events.new(client: self) @companies = WhopSDK::Resources::Companies.new(client: self) @webhooks = WhopSDK::Resources::Webhooks.new(client: self) @plans = WhopSDK::Resources::Plans.new(client: self) @entries = WhopSDK::Resources::Entries.new(client: self) @forum_posts = WhopSDK::Resources::ForumPosts.new(client: self) @transfers = WhopSDK::Resources::Transfers.new(client: self) @ledger_accounts = WhopSDK::Resources::LedgerAccounts.new(client: self) @memberships = WhopSDK::Resources::Memberships.new(client: self) @authorized_users = WhopSDK::Resources::AuthorizedUsers.new(client: self) @app_builds = WhopSDK::Resources::AppBuilds.new(client: self) @shipments = WhopSDK::Resources::Shipments.new(client: self) @checkout_configurations = WhopSDK::Resources::CheckoutConfigurations.new(client: self) @messages = WhopSDK::Resources::Messages.new(client: self) @chat_channels = WhopSDK::Resources::ChatChannels.new(client: self) @users = WhopSDK::Resources::Users.new(client: self) @payments = WhopSDK::Resources::Payments.new(client: self) @support_channels = WhopSDK::Resources::SupportChannels.new(client: self) @experiences = WhopSDK::Resources::Experiences.new(client: self) @reactions = WhopSDK::Resources::Reactions.new(client: self) @members = WhopSDK::Resources::Members.new(client: self) @forums = WhopSDK::Resources::Forums.new(client: self) @promo_codes = WhopSDK::Resources::PromoCodes.new(client: self) @courses = WhopSDK::Resources::Courses.new(client: self) @course_chapters = WhopSDK::Resources::CourseChapters.new(client: self) @course_lessons = WhopSDK::Resources::CourseLessons.new(client: self) @reviews = WhopSDK::Resources::Reviews.new(client: self) @course_students = WhopSDK::Resources::CourseStudents.new(client: self) @access_tokens = WhopSDK::Resources::AccessTokens.new(client: self) @notifications = WhopSDK::Resources::Notifications.new(client: self) @disputes = WhopSDK::Resources::Disputes.new(client: self) @refunds = WhopSDK::Resources::Refunds.new(client: self) @withdrawals = WhopSDK::Resources::Withdrawals.new(client: self) @account_links = WhopSDK::Resources::AccountLinks.new(client: self) @accounts = WhopSDK::Resources::Accounts.new(client: self) @financial_activity = WhopSDK::Resources::FinancialActivity.new(client: self) @stats = WhopSDK::Resources::Stats.new(client: self) @payouts = WhopSDK::Resources::Payouts.new(client: self) @referrals = WhopSDK::Resources::Referrals.new(client: self) @cards = WhopSDK::Resources::Cards.new(client: self) @swaps = WhopSDK::Resources::Swaps.new(client: self) @deposits = WhopSDK::Resources::Deposits.new(client: self) @setup_intents = WhopSDK::Resources::SetupIntents.new(client: self) @payment_methods = WhopSDK::Resources::PaymentMethods.new(client: self) @fee_markups = WhopSDK::Resources::FeeMarkups.new(client: self) @verifications = WhopSDK::Resources::Verifications.new(client: self) @leads = WhopSDK::Resources::Leads.new(client: self) @topups = WhopSDK::Resources::Topups.new(client: self) @files = WhopSDK::Resources::Files.new(client: self) @company_token_transactions = WhopSDK::Resources::CompanyTokenTransactions.new(client: self) @dm_members = WhopSDK::Resources::DmMembers.new(client: self) @ai_chats = WhopSDK::Resources::AIChats.new(client: self) @dm_channels = WhopSDK::Resources::DmChannels.new(client: self) @dispute_alerts = WhopSDK::Resources::DisputeAlerts.new(client: self) @resolution_center_cases = WhopSDK::Resources::ResolutionCenterCases.new(client: self) @payout_accounts = WhopSDK::Resources::PayoutAccounts.new(client: self) @affiliates = WhopSDK::Resources::Affiliates.new(client: self) @bounties = WhopSDK::Resources::Bounties.new(client: self) @workforce = WhopSDK::Resources::Workforce.new(client: self) @ad_campaigns = WhopSDK::Resources::AdCampaigns.new(client: self) @ad_groups = WhopSDK::Resources::AdGroups.new(client: self) @ads = WhopSDK::Resources::Ads.new(client: self) @ad_reports = WhopSDK::Resources::AdReports.new(client: self) end |
Instance Attribute Details
#access_tokens ⇒ WhopSDK::Resources::AccessTokens (readonly)
233 234 235 |
# File 'lib/whop_sdk/client.rb', line 233 def access_tokens @access_tokens end |
#account_links ⇒ WhopSDK::Resources::AccountLinks (readonly)
248 249 250 |
# File 'lib/whop_sdk/client.rb', line 248 def account_links @account_links end |
#accounts ⇒ WhopSDK::Resources::Accounts (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.
258 259 260 |
# File 'lib/whop_sdk/client.rb', line 258 def accounts @accounts end |
#ad_campaigns ⇒ WhopSDK::Resources::AdCampaigns (readonly)
An Ad Campaign is the top-level container for paid ads on an ad network. It sets the platform, objective, and budget strategy shared by its ad groups and ads.
Use the Ad Campaigns API to create campaigns, list campaigns for an account, retrieve or update campaign settings, and pause or resume campaign delivery.
392 393 394 |
# File 'lib/whop_sdk/client.rb', line 392 def ad_campaigns @ad_campaigns end |
#ad_groups ⇒ WhopSDK::Resources::AdGroups (readonly)
An Ad Group sits inside an ad campaign and controls delivery for ads. It sets the audience, placements, schedule, budget, and optimization goal for its ads.
Use the Ad Groups API to create ad groups in campaigns, list or retrieve targeting and delivery settings, update budgets or targeting, delete groups that should stop running, and pause or resume delivery.
403 404 405 |
# File 'lib/whop_sdk/client.rb', line 403 def ad_groups @ad_groups end |
#ad_reports ⇒ WhopSDK::Resources::AdReports (readonly)
416 417 418 |
# File 'lib/whop_sdk/client.rb', line 416 def ad_reports @ad_reports end |
#ads ⇒ WhopSDK::Resources::Ads (readonly)
An Ad is the individual creative unit delivered by an ad group. It holds the copy, creative assets, and destination URL for one ad.
Use the Ads API to list ads for an account, create ads inside ad groups, retrieve or update creative details, delete ads that should stop running, and pause or resume delivery.
413 414 415 |
# File 'lib/whop_sdk/client.rb', line 413 def ads @ads end |
#affiliates ⇒ WhopSDK::Resources::Affiliates (readonly)
377 378 379 |
# File 'lib/whop_sdk/client.rb', line 377 def affiliates @affiliates end |
#ai_chats ⇒ WhopSDK::Resources::AIChats (readonly)
362 363 364 |
# File 'lib/whop_sdk/client.rb', line 362 def ai_chats @ai_chats end |
#api_key ⇒ String (readonly)
An account API key, account scoped JWT, app API key, or user OAuth token. You
must prepend your key/token with the word Bearer, which will look like
Bearer ***************************
22 23 24 |
# File 'lib/whop_sdk/client.rb', line 22 def api_key @api_key end |
#app_builds ⇒ WhopSDK::Resources::AppBuilds (readonly)
166 167 168 |
# File 'lib/whop_sdk/client.rb', line 166 def app_builds @app_builds end |
#app_id ⇒ String? (readonly)
When using the SDK in app mode pass this parameter to allow verifying user tokens
30 31 32 |
# File 'lib/whop_sdk/client.rb', line 30 def app_id @app_id end |
#apps ⇒ WhopSDK::Resources::Apps (readonly)
An App is software you build on Whop. It can be a hosted web app served at
<route>.whop.app or an API integration installed as an experience, and it
belongs to the account that owns its credentials, settings, builds, and runtime
logs.
Use the Apps API to manage app configuration and, for hosted apps, read server runtime logs for console output, uncaught exceptions, and failed requests. Logs are retained for 7 days and can be filtered by build, level, time window, and message text.
59 60 61 |
# File 'lib/whop_sdk/client.rb', line 59 def apps @apps end |
#audiences ⇒ WhopSDK::Resources::Audiences (readonly)
An Audience represents a customer list uploaded to Whop for ad targeting. Audiences belong to an account and sync to supported ad platforms as custom audiences.
Use the Audiences API to create audiences from CSV uploads, monitor processing
status, and list or delete audiences for an account. Created audiences are
usable for targeting after processing reaches ready or partial.
95 96 97 |
# File 'lib/whop_sdk/client.rb', line 95 def audiences @audiences end |
#authorized_users ⇒ WhopSDK::Resources::AuthorizedUsers (readonly)
163 164 165 |
# File 'lib/whop_sdk/client.rb', line 163 def @authorized_users end |
#bounties ⇒ WhopSDK::Resources::Bounties (readonly)
380 381 382 |
# File 'lib/whop_sdk/client.rb', line 380 def bounties @bounties end |
#cards ⇒ WhopSDK::Resources::Cards (readonly)
Cards represent Whop-issued virtual payment cards that spend from an account or user balance. Cards can be assigned to cardholders and configured with spending limits for controlled spending.
Use the Cards API to issue cards, list cards for an account or user, and retrieve active card details such as the card number and CVC.
307 308 309 |
# File 'lib/whop_sdk/client.rb', line 307 def cards @cards end |
#chat_channels ⇒ WhopSDK::Resources::ChatChannels (readonly)
186 187 188 |
# File 'lib/whop_sdk/client.rb', line 186 def chat_channels @chat_channels end |
#checkout_configurations ⇒ WhopSDK::Resources::CheckoutConfigurations (readonly)
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.
180 181 182 |
# File 'lib/whop_sdk/client.rb', line 180 def checkout_configurations @checkout_configurations end |
#companies ⇒ WhopSDK::Resources::Companies (readonly)
126 127 128 |
# File 'lib/whop_sdk/client.rb', line 126 def companies @companies end |
#company_token_transactions ⇒ WhopSDK::Resources::CompanyTokenTransactions (readonly)
356 357 358 |
# File 'lib/whop_sdk/client.rb', line 356 def company_token_transactions @company_token_transactions end |
#course_chapters ⇒ WhopSDK::Resources::CourseChapters (readonly)
221 222 223 |
# File 'lib/whop_sdk/client.rb', line 221 def course_chapters @course_chapters end |
#course_lesson_interactions ⇒ WhopSDK::Resources::CourseLessonInteractions (readonly)
65 66 67 |
# File 'lib/whop_sdk/client.rb', line 65 def course_lesson_interactions @course_lesson_interactions end |
#course_lessons ⇒ WhopSDK::Resources::CourseLessons (readonly)
224 225 226 |
# File 'lib/whop_sdk/client.rb', line 224 def course_lessons @course_lessons end |
#course_students ⇒ WhopSDK::Resources::CourseStudents (readonly)
230 231 232 |
# File 'lib/whop_sdk/client.rb', line 230 def course_students @course_students end |
#courses ⇒ WhopSDK::Resources::Courses (readonly)
218 219 220 |
# File 'lib/whop_sdk/client.rb', line 218 def courses @courses end |
#deposits ⇒ WhopSDK::Resources::Deposits (readonly)
Deposits describe ways to add funds to an account balance, including hosted deposit pages, bank deposit instructions, and supported crypto wallet addresses.
Use the Deposits API to create deposit instructions for an account and retrieve existing bank deposit activity.
324 325 326 |
# File 'lib/whop_sdk/client.rb', line 324 def deposits @deposits end |
#dispute_alerts ⇒ WhopSDK::Resources::DisputeAlerts (readonly)
368 369 370 |
# File 'lib/whop_sdk/client.rb', line 368 def dispute_alerts @dispute_alerts end |
#disputes ⇒ WhopSDK::Resources::Disputes (readonly)
239 240 241 |
# File 'lib/whop_sdk/client.rb', line 239 def disputes @disputes end |
#dm_channels ⇒ WhopSDK::Resources::DmChannels (readonly)
365 366 367 |
# File 'lib/whop_sdk/client.rb', line 365 def dm_channels @dm_channels end |
#dm_members ⇒ WhopSDK::Resources::DmMembers (readonly)
359 360 361 |
# File 'lib/whop_sdk/client.rb', line 359 def dm_members @dm_members end |
#entries ⇒ WhopSDK::Resources::Entries (readonly)
141 142 143 |
# File 'lib/whop_sdk/client.rb', line 141 def entries @entries end |
#events ⇒ WhopSDK::Resources::Events (readonly)
An Event records conversion or engagement activity for an account, such as page views, purchases, or leads. Each event ties the action to the person who took it, so activity can be attributed to the ads and links that drove it.
Use the Events API to send new tracking events and list the events recorded for a person.
123 124 125 |
# File 'lib/whop_sdk/client.rb', line 123 def events @events end |
#experiences ⇒ WhopSDK::Resources::Experiences (readonly)
203 204 205 |
# File 'lib/whop_sdk/client.rb', line 203 def experiences @experiences end |
#fee_markups ⇒ WhopSDK::Resources::FeeMarkups (readonly)
333 334 335 |
# File 'lib/whop_sdk/client.rb', line 333 def fee_markups @fee_markups end |
#files ⇒ WhopSDK::Resources::Files (readonly)
353 354 355 |
# File 'lib/whop_sdk/client.rb', line 353 def files @files end |
#financial_activity ⇒ WhopSDK::Resources::FinancialActivity (readonly)
A Ledger Activity row is a single financial event on an account's ledger — a
payment, withdrawal, refund, transfer, on-chain deposit, swap, or card
transaction. Each row is derived from the underlying ledger lines and carries a
typed resource and source so you can present and link the event without
extra lookups.
Use Ledger Activity to build a statement or transaction feed for an account or
user. Reconcile against your own records with amount (signed, in the
currency's smallest precision units) and posted_at, and use available_at to
know when inflows became withdrawable.
271 272 273 |
# File 'lib/whop_sdk/client.rb', line 271 def financial_activity @financial_activity end |
#forum_posts ⇒ WhopSDK::Resources::ForumPosts (readonly)
144 145 146 |
# File 'lib/whop_sdk/client.rb', line 144 def forum_posts @forum_posts end |
#forums ⇒ WhopSDK::Resources::Forums (readonly)
212 213 214 |
# File 'lib/whop_sdk/client.rb', line 212 def forums @forums end |
#invoices ⇒ WhopSDK::Resources::Invoices (readonly)
62 63 64 |
# File 'lib/whop_sdk/client.rb', line 62 def invoices @invoices end |
#leads ⇒ WhopSDK::Resources::Leads (readonly)
347 348 349 |
# File 'lib/whop_sdk/client.rb', line 347 def leads @leads end |
#ledger_accounts ⇒ WhopSDK::Resources::LedgerAccounts (readonly)
157 158 159 |
# File 'lib/whop_sdk/client.rb', line 157 def ledger_accounts @ledger_accounts end |
#media ⇒ WhopSDK::Resources::Media (readonly)
A Media Asset is an AI-generated image or video created from a prompt and billed from an account balance. When generation finishes, the asset includes a file that can be attached anywhere Whop accepts files.
Use the Media API to start a generation job and retrieve the asset while it processes or after it is ready.
104 105 106 |
# File 'lib/whop_sdk/client.rb', line 104 def media @media end |
#members ⇒ WhopSDK::Resources::Members (readonly)
209 210 211 |
# File 'lib/whop_sdk/client.rb', line 209 def members @members end |
#memberships ⇒ WhopSDK::Resources::Memberships (readonly)
160 161 162 |
# File 'lib/whop_sdk/client.rb', line 160 def memberships @memberships end |
#messages ⇒ WhopSDK::Resources::Messages (readonly)
183 184 185 |
# File 'lib/whop_sdk/client.rb', line 183 def @messages end |
#notifications ⇒ WhopSDK::Resources::Notifications (readonly)
236 237 238 |
# File 'lib/whop_sdk/client.rb', line 236 def notifications @notifications end |
#payment_methods ⇒ WhopSDK::Resources::PaymentMethods (readonly)
330 331 332 |
# File 'lib/whop_sdk/client.rb', line 330 def payment_methods @payment_methods end |
#payments ⇒ WhopSDK::Resources::Payments (readonly)
197 198 199 |
# File 'lib/whop_sdk/client.rb', line 197 def payments @payments end |
#payout_accounts ⇒ WhopSDK::Resources::PayoutAccounts (readonly)
374 375 376 |
# File 'lib/whop_sdk/client.rb', line 374 def payout_accounts @payout_accounts end |
#payouts ⇒ WhopSDK::Resources::Payouts (readonly)
Payouts represent money sent from an account or user balance to an external destination, such as a bank account, wallet, or other saved payout method.
Use the Payouts API to create payouts from stablecoin accounts, list payout history for accounts or users, monitor payout statuses, and show expected arrival details for funds leaving Whop.
289 290 291 |
# File 'lib/whop_sdk/client.rb', line 289 def payouts @payouts end |
#people ⇒ WhopSDK::Resources::People (readonly)
A Person represents a visitor or customer of an account, assembled from pixel events and purchase activity — ad clicks, storefront visits, and checkouts.
Use the People API to list the people of an account and retrieve a single person.
113 114 115 |
# File 'lib/whop_sdk/client.rb', line 113 def people @people end |
#plans ⇒ WhopSDK::Resources::Plans (readonly)
A Plan defines how customers buy a product. It controls pricing, billing cadence, availability, tax behavior, checkout fields, and purchase visibility.
Use the Plans API to create plans for products, list existing plans, retrieve or update plan configuration, calculate tax for checkout, and delete plans that should no longer be offered.
138 139 140 |
# File 'lib/whop_sdk/client.rb', line 138 def plans @plans end |
#products ⇒ WhopSDK::Resources::Products (readonly)
A Product is a digital good or service sold on Whop. Products may contain plans for pricing and/or experiences for content delivery.
Use the Products API to create products, list products visible to your credentials, retrieve product details, update product metadata or merchandising fields, and delete products that should no longer be sold.
74 75 76 |
# File 'lib/whop_sdk/client.rb', line 74 def products @products end |
#promo_codes ⇒ WhopSDK::Resources::PromoCodes (readonly)
215 216 217 |
# File 'lib/whop_sdk/client.rb', line 215 def promo_codes @promo_codes end |
#reactions ⇒ WhopSDK::Resources::Reactions (readonly)
206 207 208 |
# File 'lib/whop_sdk/client.rb', line 206 def reactions @reactions end |
#referrals ⇒ WhopSDK::Resources::Referrals (readonly)
The Referrals API covers your Whop partner activity: the users you referred onto Whop, the businesses you referred and the earnings generated from their processing volume, and the partner leaderboard.
Use it to enroll as a Whop partner, list the users you referred, list your referred businesses and review their earnings, and see the partner leaderboard.
298 299 300 |
# File 'lib/whop_sdk/client.rb', line 298 def referrals @referrals end |
#refunds ⇒ WhopSDK::Resources::Refunds (readonly)
242 243 244 |
# File 'lib/whop_sdk/client.rb', line 242 def refunds @refunds end |
#resolution_center_cases ⇒ WhopSDK::Resources::ResolutionCenterCases (readonly)
371 372 373 |
# File 'lib/whop_sdk/client.rb', line 371 def resolution_center_cases @resolution_center_cases end |
#reviews ⇒ WhopSDK::Resources::Reviews (readonly)
227 228 229 |
# File 'lib/whop_sdk/client.rb', line 227 def reviews @reviews end |
#setup_intents ⇒ WhopSDK::Resources::SetupIntents (readonly)
327 328 329 |
# File 'lib/whop_sdk/client.rb', line 327 def setup_intents @setup_intents end |
#shipments ⇒ WhopSDK::Resources::Shipments (readonly)
169 170 171 |
# File 'lib/whop_sdk/client.rb', line 169 def shipments @shipments end |
#social_accounts ⇒ WhopSDK::Resources::SocialAccounts (readonly)
A Social Account represents an external profile connected to a Whop account or user, such as a Facebook page or Instagram account. Connecting a social account lets Whop run ads under that profile's identity and promote its existing posts.
Use the Social Accounts API to list connected accounts, create a Whop-managed Facebook page, start an OAuth connection, disconnect a social account, and list a connected profile's posts.
85 86 87 |
# File 'lib/whop_sdk/client.rb', line 85 def @social_accounts end |
#stats ⇒ WhopSDK::Resources::Stats (readonly)
Stats represent aggregated activity for an account over time. They help you understand revenue, transactions, disputes, members, referrals, and advertising performance across reporting periods like days, weeks, or months.
Use the Stats API to list available metrics and their filterable properties, then retrieve time-series values for a date range.
280 281 282 |
# File 'lib/whop_sdk/client.rb', line 280 def stats @stats end |
#support_channels ⇒ WhopSDK::Resources::SupportChannels (readonly)
200 201 202 |
# File 'lib/whop_sdk/client.rb', line 200 def support_channels @support_channels end |
#swaps ⇒ WhopSDK::Resources::Swaps (readonly)
Swaps convert value between supported tokens, chains, or wallet destinations for an account. A swap quote describes the expected output, fees, and approval requirements before you create the swap.
Use the Swaps API to quote a conversion, create the swap, list recent swaps, and retrieve status until the transaction completes.
316 317 318 |
# File 'lib/whop_sdk/client.rb', line 316 def swaps @swaps end |
#topups ⇒ WhopSDK::Resources::Topups (readonly)
350 351 352 |
# File 'lib/whop_sdk/client.rb', line 350 def topups @topups end |
#transfers ⇒ WhopSDK::Resources::Transfers (readonly)
Transfers move value between identities on Whop. They are used for account-to-account money movement, user payouts inside Whop, crypto transfers, and claim links depending on the destination type.
Use the Transfers API to create a transfer, list previous transfers, and retrieve a transfer by ID when reconciling money movement between accounts or users.
154 155 156 |
# File 'lib/whop_sdk/client.rb', line 154 def transfers @transfers end |
#user_token_jwks_url ⇒ String? (readonly)
Override for the JWKS endpoint used by #verify_user_token. Defaults to the canonical Whop endpoint when unset.
47 48 49 |
# File 'lib/whop_sdk/client.rb', line 47 def user_token_jwks_url @user_token_jwks_url end |
#user_token_public_key ⇒ String? (readonly)
Static public key (PEM or JWK JSON) used by #verify_user_token to verify user tokens. When set, the SDK skips remote JWKS fetching. Prefer #user_token_jwks_url (or the default) so key rotation is handled automatically.
42 43 44 |
# File 'lib/whop_sdk/client.rb', line 42 def user_token_public_key @user_token_public_key end |
#users ⇒ WhopSDK::Resources::Users (readonly)
A User represents a person on Whop. Users have a public profile and can buy products, join accounts, and access experiences.
Use the Users API to search for users, retrieve or update profiles, and check whether a user has access to an account, product, or experience.
194 195 196 |
# File 'lib/whop_sdk/client.rb', line 194 def users @users end |
#verifications ⇒ WhopSDK::Resources::Verifications (readonly)
A Verification represents an identity review for a person or business. Accounts and users complete verification when Whop needs to confirm who they are before enabling payouts or compliance-sensitive workflows.
Use the Verifications API to start or resume a hosted verification session,
check review status, and submit requested details or documents. If
requested_information contains items, submit answers with
Update Verification.
344 345 346 |
# File 'lib/whop_sdk/client.rb', line 344 def verifications @verifications end |
#version ⇒ String? (readonly)
Pins the API version (an ISO date). Defaults to the latest version the SDK was generated against.
35 36 37 |
# File 'lib/whop_sdk/client.rb', line 35 def version @version end |
#webhook_key ⇒ String? (readonly)
25 26 27 |
# File 'lib/whop_sdk/client.rb', line 25 def webhook_key @webhook_key end |
#webhooks ⇒ WhopSDK::Resources::Webhooks (readonly)
129 130 131 |
# File 'lib/whop_sdk/client.rb', line 129 def webhooks @webhooks end |
#withdrawals ⇒ WhopSDK::Resources::Withdrawals (readonly)
245 246 247 |
# File 'lib/whop_sdk/client.rb', line 245 def withdrawals @withdrawals end |
#workforce ⇒ WhopSDK::Resources::Workforce (readonly)
383 384 385 |
# File 'lib/whop_sdk/client.rb', line 383 def workforce @workforce end |
Instance Method Details
#verify_user_token(token_or_headers, **opts) ⇒ Helpers::VerifyUserToken::UserTokenPayload?
Verifies a Whop user token. Same signature as #verify_user_token!
but returns nil on any validation failure instead of raising.
605 606 607 608 609 |
# File 'lib/whop_sdk/client.rb', line 605 def verify_user_token(token_or_headers, **opts) verify_user_token!(token_or_headers, **opts) rescue StandardError nil end |
#verify_user_token!(token_or_headers, **opts) ⇒ Helpers::VerifyUserToken::UserTokenPayload
Verifies a Whop user token.
591 592 593 594 595 596 597 598 599 |
# File 'lib/whop_sdk/client.rb', line 591 def verify_user_token!(token_or_headers, **opts) opts[:app_id] ||= app_id opts[:public_key] = user_token_public_key if opts[:public_key].nil? && user_token_public_key && !user_token_public_key.empty? opts[:jwks_url] = user_token_jwks_url if opts[:jwks_url].nil? && user_token_jwks_url && !user_token_jwks_url.empty? unless opts[:app_id] raise StandardError, "You must set app_id in the Whop client if you want to verify user tokens" end Helpers::VerifyUserToken.verify_user_token!(token_or_headers, **opts) end |