This operation is only available on the server.

Required Permissions

  • plan:basic:read
  • access_pass:basic:read (optional)

Usage

import { whopSdk } from "@/lib/whop-sdk";

const result = await whopSdk.companies.listPlans({
	// ID of the company, either the tag (biz_xxx) or the page route (whop-dev)
	companyId: "biz_XXXXXXXX" /* Required! */,

	after: "pageInfo.endCursor",

	before: "pageInfo.startCursor",

	filter: {
		// A specific access pass to filter the scope by.
		accessPassId: "prod_XXXXXXXX",

		// If true, it returns plans that have affiliates
		affiliates: true,

		// How to order the results.
		direction: "asc" /* Valid values: asc | desc */,

		// What to order the results by.
		order:
			"active_memberships_count" /* Valid values: active_memberships_count | affiliates | created_at | expires_at | internal_notes */,

		// If true, it returns plans that have member/passholder affiliates set to true
		passholderAffiliate: true,

		// The text that is being searched.
		query: "some string",

		// If true, it returns raffles that have ended.
		raffleEnded: true,

		// The release method to filter the scope by.
		releaseMethod: "buy_now" /* Valid values: buy_now | raffle | waitlist */,

		// The visibility to filter the scope by.
		visibility:
			"all" /* Valid values: all | archived | hidden | not_archived | not_quick_link | quick_link | visible */,
	},

	first: 10,

	last: 10,
});

Example output

const result = {
	// All of the plans connected to the company.
	plans: {
		// The total number of items in this connection.
		totalCount: 10,

		// Information to aid in pagination.
		pageInfo: {
			// When paginating forwards, the cursor to continue.
			endCursor: "some string",

			// When paginating forwards, are there more items?
			hasNextPage: true,

			// When paginating backwards, are there more items?
			hasPreviousPage: true,

			// When paginating backwards, the cursor to continue.
			startCursor: "some string",
		},

		// A list of nodes.
		nodes: [
			{
				// The internal ID of the plan.
				id: "xxxxxxxxxxx",

				// The respective currency identifier for the plan.
				baseCurrency:
					"aed" /* Valid values: aed | all | amd | ape | ars | aud | bam | bgn | bhd | bob | brl | bsd | btc | cad | chf | clp | cop | crc | czk | dkk | dop | dzd | egp | etb | eth | eur | gbp | ghs | gmd | gtq | gyd | hkd | huf | idr | ils | inr | jmd | jod | jpy | kes | khr | krw | kwd | lkr | mad | mdl | mga | mkd | mnt | mop | mur | mxn | myr | nad | ngn | nok | nzd | omr | pen | php | pkr | pln | pyg | qar | ron | rsd | rub | rwf | sar | sek | sgd | thb | tnd | try | ttd | twd | tzs | usd | uyu | uzs | vnd | xcd | xof | zar */,

				// The price a person has to pay for a plan on the renewal purchase.
				rawRenewalPrice: 10,

				// The price a person has to pay for a plan on the initial purchase.
				rawInitialPrice: 10,

				// How much the user has to pay on the first payment.
				initialPriceDue: 10,

				// When the plan was created.
				createdAt: 1716931200,

				// When the plan was last updated.
				updatedAt: 1716931200,

				// The interval at which the plan charges (renewal plans).
				billingPeriod: 10,

				// The number of free trial days added before a renewal plan.
				trialPeriodDays: 10,

				// The interval at which the plan charges (expiration plans).
				expirationDays: 10,

				// Limits/doesn't limit the number of units available for purchase.
				unlimitedStock: true,

				// The description of the Plan as seen by the customer on the checkout page.
				paymentLinkDescription: "some string",

				// This is the release method the business uses to sell this plan.
				releaseMethod:
					"buy_now" /* Valid values: buy_now | raffle | waitlist */,

				// The number of units available for purchase.
				stock: 10,

				// Shows or hides the plan from public/business view.
				visibility:
					"archived" /* Valid values: archived | hidden | quick_link | visible */,

				// Indicates if the plan is a one time payment or recurring.
				planType: "one_time" /* Valid values: one_time | renewal */,

				// The access pass for the plan.
				accessPass: {
					// The internal ID of the public access pass.
					id: "xxxxxxxxxxx",

					// The title of the access pass. Use for Whop 4.0.
					title: "some string",

					// The route of the access pass.
					route: "some string",

					// The logo for the access pass.
					logo: {
						// The original URL of the attachment, such as a direct link to S3. This should
						// never be displayed on the client and always passed to an Imgproxy transformer.
						sourceUrl: "some string",
					},
				},
			},
		],
	},
};