Getting started
Authentication
Resources
- Access Passes
- Access
- Attachments
- Companies
- Experiences
- Forums
- Messages
- Notifications
- Payments
- Users
Payments
Create Checkout Session
This operation is only available on the server.
Copy
Ask AI
import { whopApi } from "@/lib/whop-api";
const result = await whopApi.payments.createCheckoutSession({
// The affiliate code to use for the checkout session
affiliateCode: "some string",
// The metadata to use for the checkout session
metadata: { any: "json" },
// The ID of the plan to use for the checkout session
planId: "xxxxxxxxxxx" /* Required! */,
// The URL to redirect the user to after the checkout session is created
redirectUrl: "some string",
});
Example output:
Copy
Ask AI
const response = {
// The ID of the checkout session
id: "xxxxxxxxxxx",
// The ID of the plan to use for the checkout session
planId: "xxxxxxxxxxx",
};
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.