import Whop from '@whop/sdk';
const client = new Whop({
apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const planListResponse of client.plans.list({ company_id: 'biz_xxxxxxxxxxxxxx' })) {
console.log(planListResponse.id);
}{
"data": [
{
"id": "plan_xxxxxxxxxxxxx",
"created_at": "2023-12-01T05:00:00.401Z",
"updated_at": "2023-12-01T05:00:00.401Z",
"visibility": "visible",
"plan_type": "renewal",
"release_method": "buy_now",
"currency": "usd",
"company": {
"id": "biz_xxxxxxxxxxxxxx",
"title": "Pickaxe"
},
"product": {
"id": "prod_xxxxxxxxxxxxx",
"title": "Pickaxe Analytics"
},
"invoice": {
"id": "inv_xxxxxxxxxxxxxx"
},
"billing_period": 42,
"title": "Pro Monthly",
"description": "Monthly access to all premium analytics dashboards and data exports.",
"purchase_url": "https://whop.com/pickaxe-analytics/checkout/plan_abc123",
"expiration_days": 42,
"initial_price": 6.9,
"renewal_price": 6.9,
"trial_period_days": 42,
"member_count": 42,
"internal_notes": "Black Friday 2024 promo plan - expires Dec 1",
"stock": 42,
"unlimited_stock": true,
"split_pay_required_payments": 42,
"payment_method_configuration": {
"enabled": [
"acss_debit"
],
"disabled": [
"acss_debit"
],
"include_platform_defaults": true
}
}
],
"page_info": {
"end_cursor": "<string>",
"start_cursor": "<string>",
"has_next_page": true,
"has_previous_page": true
}
}Returns a paginated list of plans belonging to a company, with optional filtering by visibility, type, release method, and product.
Required permissions:
plan:basic:readimport Whop from '@whop/sdk';
const client = new Whop({
apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const planListResponse of client.plans.list({ company_id: 'biz_xxxxxxxxxxxxxx' })) {
console.log(planListResponse.id);
}{
"data": [
{
"id": "plan_xxxxxxxxxxxxx",
"created_at": "2023-12-01T05:00:00.401Z",
"updated_at": "2023-12-01T05:00:00.401Z",
"visibility": "visible",
"plan_type": "renewal",
"release_method": "buy_now",
"currency": "usd",
"company": {
"id": "biz_xxxxxxxxxxxxxx",
"title": "Pickaxe"
},
"product": {
"id": "prod_xxxxxxxxxxxxx",
"title": "Pickaxe Analytics"
},
"invoice": {
"id": "inv_xxxxxxxxxxxxxx"
},
"billing_period": 42,
"title": "Pro Monthly",
"description": "Monthly access to all premium analytics dashboards and data exports.",
"purchase_url": "https://whop.com/pickaxe-analytics/checkout/plan_abc123",
"expiration_days": 42,
"initial_price": 6.9,
"renewal_price": 6.9,
"trial_period_days": 42,
"member_count": 42,
"internal_notes": "Black Friday 2024 promo plan - expires Dec 1",
"stock": 42,
"unlimited_stock": true,
"split_pay_required_payments": 42,
"payment_method_configuration": {
"enabled": [
"acss_debit"
],
"disabled": [
"acss_debit"
],
"include_platform_defaults": true
}
}
],
"page_info": {
"end_cursor": "<string>",
"start_cursor": "<string>",
"has_next_page": true,
"has_previous_page": true
}
}A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like Bearer ***************************
Returns the elements in the list that come after the specified cursor.
Returns the elements in the list that come before the specified cursor.
Returns the first n elements from the list.
42
Returns the last n elements from the list.
42
The unique identifier of the company to list plans for.
"biz_xxxxxxxxxxxxxx"
The sort direction for results. Defaults to descending.
asc, desc The field to sort results by. Defaults to created_at.
id, active_members_count, created_at, internal_notes, expires_at Filter to only plans matching these release methods.
The methods of how a plan can be released.
buy_now, waitlist Filter to only plans matching these visibility states.
The different levels of visibility for resources
visible, hidden, archived, quick_link, all, not_quick_link, not_archived Filter to only plans matching these billing types.
The type of plan that can be attached to a product
renewal, one_time Filter to only plans belonging to these product identifiers.
Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "VXNlci0xMA==") or integer (such as 4) input value will be accepted as an ID.
Only return plans created before this timestamp.
"2023-12-01T05:00:00.401Z"
Only return plans created after this timestamp.
"2023-12-01T05:00:00.401Z"
Was this page helpful?