Skip to main content
This operation is only available on the server.

Required Permissions

  • access_pass:create

Usage

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

const result = await whopSdk.accessPasses.createAccessPass({
	// A banner image for the access pass in png, jpeg format
	bannerImage: {
		// This ID should be used the first time you upload an attachment. It is the ID
		// of the direct upload that was created when uploading the file to S3 via the
		// mediaDirectUpload mutation.
		directUploadId: "xxxxxxxxxxx",

		// The ID of an existing attachment object. Use this when updating a resource and
		// keeping a subset of the attachments. Don't use this unless you know what you're doing.
		id: "xxxxxxxxxxx",
	},

	// The business type of the access pass.
	businessType:
		"agency" /* Valid values: agency | brick_and_mortar | coaching | coaching_and_courses | community | course | education_program | events | newsletter | other | paid_group | physical_products | saas | software */,

	// The ID of the company to create the access pass for.
	companyId: "biz_XXXXXXXX",

	// The creator pitch for the access pass.
	creatorPitch: "some string",

	// The custom call to action for the access pass.
	customCta:
		"apply_now" /* Valid values: apply_now | call_now | complete_order | contact_us | donate_now | get_access | get_offer | join | order_now | purchase | shop_now | sign_up | subscribe */,

	// The custom call to action URL for the access pass.
	customCtaUrl: "some string",

	// The custom statement descriptor for the access pass i.e. WHOP*SPORTS, must be
	// between 5 and 22 characters, contain at least one letter, and not contain any
	// of the following characters: <, >, \, ', "
	customStatementDescriptor: "some string",

	// A written description of the access pass.
	description: "some string",

	// An array of experience IDs that this pass has
	experienceIds: ["xxxxxxxxxxx"],

	// The percentage of the revenue that goes to the global affiliate program.
	globalAffiliatePercentage: 10,

	// The status of the global affiliate program for this access pass.
	globalAffiliateStatus: "disabled" /* Valid values: disabled | enabled */,

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

	// The URLs of the images to upload to the access pass.
	imageUrls: ["some string"],

	// The industry type of the access pass.
	industryType:
		"accessories" /* Valid values: accessories | agencies | ai | ai_agency | amazon_fba | auto_repair_shop | beauty_and_personal_care | bootcamps | business | careers | clipping | clipping_agency | clothing | coaching_agency | coffee_shop | concerts | convention | customer_support_agency | dating | design_agency | development_agency | ecommerce | electronics_and_gadgets | fitness | fitness_gear | food_and_beverages | gym | health_and_wellness | home_goods | home_services | hotel_lodging | kindle_book_publishing | marketing_agency | masterminds | medical_dentist_office | meetups | other | parties | personal_development | personal_finance | public_speaking | real_estate | recruiting_agency | reselling | restaurant | retail_store | sales | sales_agency | salon_spa | social_media | software | spirituality | sports_betting | supplements | trading | travel | vas | video_games | webinars */,

	// The logo for the access pass in png, jpeg, or gif format
	logo: {
		// This ID should be used the first time you upload an attachment. It is the ID
		// of the direct upload that was created when uploading the file to S3 via the
		// mediaDirectUpload mutation.
		directUploadId: "xxxxxxxxxxx",

		// The ID of an existing attachment object. Use this when updating a resource and
		// keeping a subset of the attachments. Don't use this unless you know what you're doing.
		id: "xxxxxxxxxxx",
	},

	// The ID of the marketplace category to assign to the access pass.
	marketplaceCategoryId: "xxxxxxxxxxx",

	// The percentage of the revenue that goes to the member affiliate program.
	memberAffiliatePercentage: 10,

	// The status of the member affiliate program for this access pass.
	memberAffiliateStatus: "disabled" /* Valid values: disabled | enabled */,

	// The details to assign an autogenerated plan.
	planOptions: {
		// 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 interval at which the plan charges (renewal plans).
		billingPeriod: 10,

		// An array of custom field objects.
		customFields: [
			{
				// The type of the custom field.
				fieldType: "text" /* Valid values: text */ /* Required! */,

				// The ID of the custom field (if being updated)
				id: "xxxxxxxxxxx",

				// The name of the custom field.
				name: "some string" /* Required! */,

				// The order of the field.
				order: 10,

				// The placeholder value of the field.
				placeholder: "some string",

				// Whether or not the field is required.
				required: true,
			},
		],

		// An additional amount charged upon first purchase.
		initialPrice: 10,

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

		// The method by which the plan is released to the public.
		releaseMethod: "buy_now" /* Valid values: buy_now | raffle | waitlist */,

		// The amount the customer is charged every billing period.
		renewalPrice: 10,

		// The visibility of the plan.
		visibility:
			"archived" /* Valid values: archived | hidden | quick_link | visible */,
	},

	// The product highlights for the access pass.
	productHighlights: [
		{
			// Text to display to describe the product highlight (max length 250 for
			// qualification or benefits, 170 for who this is for, 140 for pricing features).
			content: "some string" /* Required! */,

			// The type of this highlight.
			highlightType:
				"benefit" /* Valid values: benefit | pricing_feature | qualification | who_this_is_for */ /* Required! */,

			// The title of the product highlight, if applicable.
			title: "some string",
		},
	],

	// The ID of the product tax code to apply to this access pass.
	productTaxCodeId: "xxxxxxxxxxx",

	// The URL to redirect the customer to after a purchase.
	redirectPurchaseUrl: "some string",

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

	// A short description of what the access pass offers or does. Must be 150 chars or less.
	shortenedDescription: "some string",

	// Whether or not to show the member count on the access pass.
	showMemberCount: true,

	// Whether or not to show reviews on the access pass.
	showReviewsDtc: true,

	// The social links for the access pass.
	socialLinks: [
		{
			// The URL of the social link
			url: "some string" /* Required! */,

			// The website this link is for
			website:
				"facebook" /* Valid values: facebook | instagram | linkedin | tiktok | twitch | website | x | youtube */ /* Required! */,
		},
	],

	// The title of the access pass.
	title: "some string" /* Required! */,

	// Whether or not customers can upgrade to different plans on this access pass.
	upgradeable: true,

	// This access pass will/will not be displayed publicly.
	visibility:
		"archived" /* Valid values: archived | hidden | quick_link | visible */,
});

Example output

const result = {
	// The internal ID of the public access pass.
	id: "xxxxxxxxxxx",

	// When the access pass was created.
	createdAt: 1716931200,

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

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

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

	// A short description of what the company offers or does.
	shortenedDescription: "some string",

	// Whether this product is Whop verified.
	verified: true,

	// This access pass will/will not be displayed publicly.
	visibility:
		"archived" /* Valid values: archived | hidden | quick_link | visible */,

	// The number of active users for this access pass.
	activeUsersCount: 10,

	// The average of all reviews for this access pass.
	reviewsAverage: 10,

	// The creator pitch for the access pass.
	creatorPitch: "some string",

	// The timestamp (in milliseconds since epoch) of when the access pass was updated
	updatedAtMs: "9999999",

	// Whether to show the offers on the access pass.
	showOffers: true,

	// The URL to redirect the customer to after a purchase, if applicable.
	redirectPurchaseUrl: "some string",

	// The custom call to action for the access pass.
	customCta:
		"apply_now" /* Valid values: apply_now | call_now | complete_order | contact_us | donate_now | get_access | get_offer | join | order_now | purchase | shop_now | sign_up | subscribe */,

	// The custom call to action URL for the access pass, if any.
	customCtaUrl: "some string",

	// The percentage of a transaction a user is eligible to earn from the whop marketplace global affiliate program.
	globalAffiliatePercentage: 10,

	// The status of the global affiliate program for this access pass.
	globalAffiliateStatus: "disabled" /* Valid values: disabled | enabled */,

	// The percentage of a transaction a user is eligible to earn from the whop marketplace member affiliate program.
	memberAffiliatePercentage: 10,

	// The status of the member affiliate program for this access pass.
	memberAffiliateStatus: "disabled" /* Valid values: disabled | enabled */,

	// Whether to show the member count.
	showMemberCount: true,

	// 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",
	},

	// The banner image for the access pass.
	bannerImage: {
		// The source of the attachment
		source: {
			// The URL to access the attachment
			url: "some string",
		},
	},
};