Setup your access pass on the dashboard.
- Go to the your app’s dashboard.
- Select the access passes tab and create an access pass. Give it a name like “My App Premium”
- Create a pricing plan for the access pass by clicking the “Add Pricing” button from the table row.
- After creating the pricing plan, copy the plan id from the 3 dot menu in the pricing plan card.
- Also copy the access pass id from the 3 dot menu in the access pass table row.
We recommend storing the access pass id and plan id in environment variables
for your app. Eg:
Check if users have access
When a user makes a request to your app, you can easily check if they have access using the whop api.Collect payment from users
This function requires the iFrame SDK to be initialized. See iFrame
Overview for more information.
Attaching custom metadata to a subscription
You can attach custom metadata to a subscription by using thecreateCheckoutSession
mutation.
For example, you can use this to associate a subscription with an experience or company that it was created for.
Using this you can attribute the source of the subscription and build powerful revenue sharing features into your app.
Before using the iframeSdk.inAppPurchase
function, you need to create a checkout session, and pass it to the function.
Create the checkout session in a server action.
Use the whopSdk to create a checkout session on your backend, pass the experienceId to this function.Pass the checkout session to the iframeSdk.inAppPurchase function.
React
payUser
mutation to share your subscription revenue with the creator of the experience.