### Listing Payments (Python SDK) Source: https://docs.whop.com/apps/api/getting-started Example of how to list payments using the Whop Python SDK. Requires app ID and API key. ```APIDOC ## Listing Payments (Python SDK) ### Description This example demonstrates how to use the Whop Python SDK to list payments for a company. ### Method Client Method ### Endpoint `client.payments.list()` ### Parameters #### Client Initialization - **app_id** (string) - Required - Your Whop application ID. - **api_key** (string) - Optional - Your Whop API key. Defaults to `os.environ.get("WHOP_API_KEY")`. #### Method Parameters - **company_id** (string) - Required - The ID of the company whose payments are to be listed. ### Request Example ```python import os from whop_sdk import Whop client = Whop( app_id="app_xxxxxxxxxxxxxx", api_key=os.environ.get("WHOP_API_KEY"), # This is the default and can be omitted ) page = client.payments.list( company_id="biz_xxxxxxxxxxxxxx", ) print(page.data) ``` ### Response #### Success Response (200) - **data** (list) - A list of payment objects. - **id** (str) - The unique identifier of the payment. - **amount** (float) - The amount of the payment. - **currency** (str) - The currency of the payment. #### Response Example ```json { "data": [ { "id": "pay_xxxxxxxxxxxxxx", "amount": 1000.0, "currency": "USD" } ] } ``` ``` -------------------------------- ### List Payments using Whop SDK (Ruby) Source: https://docs.whop.com/apps/api/getting-started Provides an example of listing payments via the Whop SDK in Ruby. It sets up the client with an API key from environment variables and an app ID, then prints the ID of the first payment in the response. ```ruby require "bundler/setup" require "whop_sdk" whop = WhopSDK::Client.new( api_key: ENV["WHOP_API_KEY"], # This is the default and can be omitted app_id: "app_xxxxxxxxxxxxxx" ) page = whop.payments.list(company_id: "biz_xxxxxxxxxxxxxx") puts(page.id) ``` -------------------------------- ### Listing Payments (TypeScript SDK) Source: https://docs.whop.com/apps/api/getting-started Example of how to list payments using the Whop TypeScript SDK. Requires app ID and API key. ```APIDOC ## Listing Payments (TypeScript SDK) ### Description This example demonstrates how to use the Whop TypeScript SDK to list payments for a company. ### Method Client Method ### Endpoint `client.payments.list()` ### Parameters #### Client Initialization - **appID** (string) - Required - Your Whop application ID. - **apiKey** (string) - Optional - Your Whop API key. Defaults to `process.env["WHOP_API_KEY"]`. #### Method Parameters - **company_id** (string) - Required - The ID of the company whose payments are to be listed. ### Request Example ```typescript import Whop from "@whop/sdk"; const client = new Whop({ appID: "app_xxxxxxxxxxxxxx", apiKey: process.env["WHOP_API_KEY"], // This is the default and can be omitted }); const page = await client.payments.list({ company_id: "biz_xxxxxxxxxxxxxx" }); const paymentListResponse = page.data[0]; console.log(paymentListResponse.id); ``` ### Response #### Success Response (200) - **data** (array) - An array of payment objects. - **id** (string) - The unique identifier of the payment. - **amount** (number) - The amount of the payment. - **currency** (string) - The currency of the payment. #### Response Example ```json { "data": [ { "id": "pay_xxxxxxxxxxxxxx", "amount": 1000, "currency": "USD" } ] } ``` ``` -------------------------------- ### Listing Payments (Ruby SDK) Source: https://docs.whop.com/apps/api/getting-started Example of how to list payments using the Whop Ruby SDK. Requires app ID and API key. ```APIDOC ## Listing Payments (Ruby SDK) ### Description This example demonstrates how to use the Whop Ruby SDK to list payments for a company. ### Method Client Method ### Endpoint `whop.payments.list()` ### Parameters #### Client Initialization - **app_id** (string) - Required - Your Whop application ID. - **api_key** (string) - Optional - Your Whop API key. Defaults to `ENV["WHOP_API_KEY"]`. #### Method Parameters - **company_id** (string) - Required - The ID of the company whose payments are to be listed. ### Request Example ```ruby require "bundler/setup" require "whop_sdk" whop = WhopSDK::Client.new( api_key: ENV["WHOP_API_KEY"], # This is the default and can be omitted app_id: "app_xxxxxxxxxxxxxx" ) page = whop.payments.list(company_id: "biz_xxxxxxxxxxxxxx") puts(page.id) ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the payment. - **amount** (integer) - The amount of the payment. - **currency** (string) - The currency of the payment. #### Response Example ```json { "id": "pay_xxxxxxxxxxxxxx", "amount": 1000, "currency": "USD" } ``` ``` -------------------------------- ### List Payments using Whop SDK (Python) Source: https://docs.whop.com/apps/api/getting-started Demonstrates listing payments with the Whop SDK in Python. The code initializes the client using environment variables for the API key and an explicit app ID, then prints the payment data. ```python import os from whop_sdk import Whop client = Whop( app_id="app_xxxxxxxxxxxxxx", api_key=os.environ.get("WHOP_API_KEY"), # This is the default and can be omitted ) page = client.payments.list( company_id="biz_xxxxxxxxxxxxxx", ) print(page.data) ``` -------------------------------- ### Making Authenticated API Requests Source: https://docs.whop.com/apps/api/getting-started Example of how to make an authenticated API request using curl. Requires an API key in the Authorization header. ```APIDOC ## POST /api/v1/payments/pay_{payment_id} ### Description Makes an authenticated request to process a payment. Requires an API key for authentication. ### Method POST ### Endpoint `/api/v1/payments/pay_{payment_id}` ### Parameters #### Path Parameters - **payment_id** (string) - Required - The unique identifier of the payment. #### Request Headers - **Authorization** (string) - Required - The API key in the `Bearer` scheme. Format: `Bearer YOUR_API_KEY` ### Request Example ```bash curl https://api.whop.com/api/v1/payments/pay_xxxxxxxxxxxxxx \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response #### Success Response (200) - **status** (string) - The status of the payment processing. #### Response Example ```json { "status": "processed" } ``` ``` -------------------------------- ### Fetching Public User Profile Data Source: https://docs.whop.com/apps/api/getting-started Example of how to fetch public user profile data using curl. Replace 'j' with the desired Whop username. ```APIDOC ## GET /api/v1/users/{username} ### Description Fetches the public profile data for a given Whop username. ### Method GET ### Endpoint `/api/v1/users/{username}` ### Parameters #### Path Parameters - **username** (string) - Required - The Whop username of the user whose profile data is to be fetched. ### Request Example ```bash curl https://api.whop.com/api/v1/users/j ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the user. - **username** (string) - The user's Whop username. - **display_name** (string) - The user's display name. #### Response Example ```json { "id": "user_xxxxxxxxxxxxxx", "username": "j", "display_name": "John Doe" } ``` ``` -------------------------------- ### Install and Use SDKs Source: https://docs.whop.com/apps/api/index Information on how to install and use the Whop SDKs for various programming languages. ```APIDOC ## Using an SDK We recommend using our SDKs to make API calls in your applications. ### TypeScript / JavaScript **Installation:** ```bash pnpm install @whop/sdk ``` **Example Usage:** ```typescript import Whop from "@whop/sdk"; const client = new Whop({ appID: "app_xxxxxxxxxxxxxx", apiKey: process.env["WHOP_API_KEY"], // This is the default and can be omitted }); const page = await client.payments.list({ company_id: "biz_xxxxxxxxxxxxxx" }); const paymentListResponse = page.data[0]; console.log(paymentListResponse.id); ``` ### Python **Installation:** ```bash pip install whop-sdk ``` ### Ruby **Installation:** ```bash gem install whop_sdk ``` ``` -------------------------------- ### Installing Whop SDK for Ruby Source: https://docs.whop.com/apps/api/index Command to install the Whop SDK for Ruby applications using gem. ```shell gem install whop_sdk ``` -------------------------------- ### Installing Whop SDK for Python Source: https://docs.whop.com/apps/api/index Command to install the Whop SDK for Python applications using pip package manager. ```shell pip install whop-sdk ``` -------------------------------- ### Example Usage of Whop SDK in Typescript Source: https://docs.whop.com/apps/api/index Example demonstrating how to initialize the Whop SDK in Typescript and list payments for a company. It assumes the WHOP_API_KEY is set as an environment variable. The output logs the ID of the first payment in the list. ```typescript import Whop from "@whop/sdk"; const client = new Whop({ appID: "app_xxxxxxxxxxxxxx", apiKey: process.env["WHOP_API_KEY"], // This is the default and can be omitted }); const page = await client.payments.list({ company_id: "biz_xxxxxxxxxxxxxx" }); const paymentListResponse = page.data[0]; console.log(paymentListResponse.id); ``` -------------------------------- ### Installing Whop SDK for Typescript/Javascript Source: https://docs.whop.com/apps/api/index Command to install the Whop SDK for Typescript and Javascript applications using pnpm package manager. ```shell pnpm install @whop/sdk ``` -------------------------------- ### Get API Key Source: https://docs.whop.com/apps/api/index Instructions on how to obtain your API key from the developer dashboard. ```APIDOC ## Getting Your API Key 1. Go to your developer dashboard. 2. Click the **Create app** button and give your app a name. 3. Your API key is located in the `Environment variables` section after `WHOP_API_KEY`. Use the reveal button to show the key, copy it, and store it securely. ``` -------------------------------- ### Public User Profile Data Source: https://docs.whop.com/apps/api/index Example of how to fetch public user profile data using curl. ```APIDOC ## Fetch Public User Profile Data ### Method GET ### Endpoint `https://api.whop.com/api/v1/users/{username}` ### Parameters #### Path Parameters - **username** (string) - Required - The username of the user whose profile data you want to fetch. ### Request Example ```bash # replace "j" with your own whop username curl https://api.whop.com/api/v1/users/j ``` ``` -------------------------------- ### Authenticated API Calls Source: https://docs.whop.com/apps/api/index Instructions for making authenticated API calls by including your API key in the Authorization header. ```APIDOC ## Authenticated API Calls To make authenticated requests, include your API key in the `Authorization` header using the `Bearer` scheme. Ensure your API key has the necessary permissions. ### Method POST ### Endpoint `https://api.whop.com/api/v1/payments/{payment_id}` ### Parameters #### Path Parameters - **payment_id** (string) - Required - The ID of the payment. #### Headers - **Authorization** (string) - Required - `Bearer YOUR_API_KEY` ### Request Example ```bash # replace "YOUR_API_KEY" with your real API key curl https://api.whop.com/api/v1/payments/pay_xxxxxxxxxxxxxx \ -H "Authorization: Bearer YOUR_API_KEY" ``` ``` -------------------------------- ### Making Authenticated API Call with Curl Source: https://docs.whop.com/apps/api/index This snippet shows how to make an authenticated API call to the Whop API using curl. It requires including the API key in the 'Authorization' header with the 'Bearer' scheme. Replace 'YOUR_API_KEY' with the actual API key. ```shell # replace "YOUR_API_KEY" with your real API key curl https://api.whop.com/api/v1/payments/pay_xxxxxxxxxxxxxx \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Making Unauthenticated API Call with Curl Source: https://docs.whop.com/apps/api/index This snippet demonstrates how to fetch public user profile data from the Whop API using curl without authentication. It requires replacing 'j' with the user's Whop username. ```shell # replace "j" with your own whop username curl https://api.whop.com/api/v1/users/j ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.