[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CYABPPD5520NE1VEPYWPVA":3,"skill-same:01M6CYABPPD5520NE1VEPYWPVA":72},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":53,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":56,"updatedAt":57,"install":58,"resources":71},"01M6CYABPPD5520NE1VEPYWPVA","whop",null,"Whop platform expert for digital products, memberships, and community monetization. Covers memberships API, payments, courses, forums, webhooks, OAuth apps, and checkout integration. Build SaaS, course platforms, and gated communities. Triggers on Whop, memberships, digital products, course platform, community monetization, Whop API, license keys.","eric861129\u002FSKILLS_All-in-one","eric861129","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F74950944?v=4","01M6CXHDYEYRPFGGV4EFXCSYCF","ChiYu-Huang","01M6CXHE2J5CN1EBTY0FKV3ZKW",52,"MIT","https:\u002F\u002Fgithub.com\u002Feric861129\u002FSKILLS_All-in-one\u002Fblob\u002Fmain\u002Fpublic\u002FSKILLS\u002FSaaS & Backend\u002Fwhop\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"edit","platform","communities","gated","monetization","community","build","expert","webhooks","license","write","read","grep","Bash","api","saas","OAuth","payments","integration","2026-11-10 10:12:30",false,"---\nname: whop\ndescription: Whop platform expert for digital products, memberships, and community monetization. Covers memberships API, payments, courses, forums, webhooks, OAuth apps, and checkout integration. Build SaaS, course platforms, and gated communities. Triggers on Whop, memberships, digital products, course platform, community monetization, Whop API, license keys.\nallowed-tools: Read, Write, Edit, Grep, Glob, Bash\nmodel: sonnet\nlicense: MIT\nmetadata:\n  author: raintree\n  version: \"1.0\"\n---\n\n# Whop Platform Expert\n\nWhop is a platform for selling digital products, memberships, courses, and community access.\n\n## When to Use\n\n- Building membership\u002Fsubscription products\n- Integrating Whop checkout and payments\n- Managing courses and educational content\n- Gating content by membership status\n- Handling webhooks for payment events\n- Building Whop apps with OAuth\n\n## Quick Start\n\n### Authentication\n\n```typescript\nconst headers = {\n  Authorization: `Bearer ${process.env.WHOP_API_KEY}`,\n  \"Content-Type\": \"application\u002Fjson\",\n};\n\nconst response = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fme\", { headers });\n```\n\n**API Key Types:**\n- **Company API Keys** - Your own company data (Dashboard → Settings → API Keys)\n- **App API Keys** - Multi-tenant apps (Dashboard → Developer → Your App)\n\n## Core Operations\n\n### Create Product\n\n```typescript\nconst product = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fproducts\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    title: \"Premium Membership\",\n    description: \"Access to all content\",\n    visibility: \"visible\",\n  }),\n});\n```\n\n### Create Plan\n\n```typescript\nconst plan = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fplans\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    product_id: \"prod_xxx\",\n    billing_period: 1,\n    billing_period_unit: \"month\",\n    price: 2999, \u002F\u002F $29.99 in cents\n    currency: \"usd\",\n  }),\n});\n```\n\n### Create Checkout\n\n```typescript\nconst checkout = await fetch(\n  \"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcheckout-configurations\",\n  {\n    method: \"POST\",\n    headers,\n    body: JSON.stringify({\n      plan_id: \"plan_xxx\",\n      success_url: \"https:\u002F\u002Fyourapp.com\u002Fsuccess\",\n      cancel_url: \"https:\u002F\u002Fyourapp.com\u002Fcancel\",\n      metadata: { user_id: \"123\" },\n    }),\n  }\n);\n\nconst { url } = await checkout.json();\n\u002F\u002F Redirect user to url\n```\n\n## Membership Management\n\n### List Memberships\n\n```typescript\nconst response = await fetch(\n  \"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fmemberships?valid=true\",\n  { headers }\n);\n\nconst { data: memberships } = await response.json();\n```\n\n### Check User Access\n\n```typescript\nasync function checkAccess(userId: string, productId: string): Promise\u003Cboolean> {\n  const response = await fetch(\n    `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fmemberships?user_id=${userId}&product_id=${productId}&valid=true`,\n    { headers }\n  );\n\n  const { data } = await response.json();\n  return data.length > 0;\n}\n```\n\n### Validate License Key\n\n```typescript\nasync function validateLicense(licenseKey: string): Promise\u003Cboolean> {\n  const response = await fetch(\n    `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fmemberships?license_key=${licenseKey}`,\n    { headers }\n  );\n\n  const { data } = await response.json();\n  return data.length > 0 && data[0].valid;\n}\n```\n\n### Cancel Membership\n\n```typescript\nawait fetch(\n  `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fmemberships\u002F${membershipId}\u002Fcancel`,\n  {\n    method: \"POST\",\n    headers,\n  }\n);\n```\n\n## Payments\n\n### Get Payment\n\n```typescript\nconst payment = await fetch(\n  `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fpayments\u002F${paymentId}`,\n  { headers }\n);\n```\n\n### Refund Payment\n\n```typescript\nawait fetch(`https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fpayments\u002F${paymentId}\u002Frefund`, {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    amount: 1000, \u002F\u002F Optional: partial refund in cents\n  }),\n});\n```\n\n## Courses\n\n### Create Course\n\n```typescript\nconst course = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcourses\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    product_id: \"prod_xxx\",\n    title: \"Complete Web Development\",\n    description: \"Learn fullstack from scratch\",\n    visibility: \"visible\",\n  }),\n});\n```\n\n### Create Chapter\n\n```typescript\nconst chapter = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcourse-chapters\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    course_id: \"course_xxx\",\n    title: \"Introduction to JavaScript\",\n    order: 1,\n  }),\n});\n```\n\n### Create Lesson\n\n```typescript\nconst lesson = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcourse-lessons\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    chapter_id: \"chapter_xxx\",\n    title: \"Variables and Data Types\",\n    content: \"Lesson content in markdown...\",\n    type: \"video\", \u002F\u002F or 'text', 'quiz', 'assignment'\n    video_url: \"https:\u002F\u002Fyoutube.com\u002Fwatch?v=...\",\n    order: 1,\n  }),\n});\n```\n\n### Mark Lesson Complete\n\n```typescript\nawait fetch(\n  `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcourse-lessons\u002F${lessonId}\u002Fmark-as-completed`,\n  {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${userAccessToken}`,\n    },\n  }\n);\n```\n\n## Webhooks\n\n### Setup Endpoint\n\n```typescript\nimport crypto from \"crypto\";\n\nexport async function POST(req: Request) {\n  const body = await req.text();\n  const signature = req.headers.get(\"x-whop-signature\");\n\n  \u002F\u002F Verify signature\n  const hash = crypto\n    .createHmac(\"sha256\", process.env.WHOP_WEBHOOK_SECRET!)\n    .update(body)\n    .digest(\"hex\");\n\n  if (hash !== signature) {\n    return new Response(\"Invalid signature\", { status: 401 });\n  }\n\n  const event = JSON.parse(body);\n\n  switch (event.action) {\n    case \"payment.succeeded\":\n      await handlePaymentSuccess(event.data);\n      break;\n\n    case \"membership.activated\":\n      await grantAccess(event.data);\n      break;\n\n    case \"membership.deactivated\":\n      await revokeAccess(event.data);\n      break;\n\n    case \"dispute.created\":\n      await handleDispute(event.data);\n      break;\n  }\n\n  return Response.json({ received: true });\n}\n```\n\n**Key webhook events:**\n| Event | Trigger |\n|-------|---------|\n| `payment.succeeded` | Payment completed |\n| `payment.failed` | Payment failed |\n| `membership.activated` | Membership started |\n| `membership.deactivated` | Membership ended |\n| `invoice.paid` | Recurring payment succeeded |\n| `dispute.created` | Chargeback initiated |\n\n## OAuth Apps\n\n### Redirect to Whop OAuth\n\n```typescript\nconst authUrl = new URL(\"https:\u002F\u002Fwhop.com\u002Foauth\");\nauthUrl.searchParams.set(\"client_id\", process.env.WHOP_CLIENT_ID!);\nauthUrl.searchParams.set(\"redirect_uri\", \"https:\u002F\u002Fyourapp.com\u002Fcallback\");\nauthUrl.searchParams.set(\"scope\", \"memberships:read payments:read\");\n\n\u002F\u002F Redirect user\nwindow.location.href = authUrl.toString();\n```\n\n### Handle Callback\n\n```typescript\nexport async function GET(req: Request) {\n  const url = new URL(req.url);\n  const code = url.searchParams.get(\"code\");\n\n  const response = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Foauth\u002Ftoken\", {\n    method: \"POST\",\n    headers: { \"Content-Type\": \"application\u002Fjson\" },\n    body: JSON.stringify({\n      client_id: process.env.WHOP_CLIENT_ID!,\n      client_secret: process.env.WHOP_CLIENT_SECRET!,\n      code,\n      grant_type: \"authorization_code\",\n      redirect_uri: \"https:\u002F\u002Fyourapp.com\u002Fcallback\",\n    }),\n  });\n\n  const { access_token, refresh_token } = await response.json();\n  \u002F\u002F Store tokens securely\n}\n```\n\n## Middleware (Access Control)\n\n```typescript\n\u002F\u002F middleware.ts\nimport { NextResponse } from \"next\u002Fserver\";\nimport type { NextRequest } from \"next\u002Fserver\";\n\nexport async function middleware(request: NextRequest) {\n  const token = request.cookies.get(\"whop_user_token\")?.value;\n\n  if (!token) {\n    return NextResponse.redirect(new URL(\"\u002Flogin\", request.url));\n  }\n\n  const response = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fme\u002Fmemberships\", {\n    headers: { Authorization: `Bearer ${token}` },\n  });\n\n  const { data } = await response.json();\n  const hasAccess = data.some((m: any) => m.status === \"active\" && m.valid);\n\n  if (!hasAccess) {\n    return NextResponse.redirect(new URL(\"\u002Fsubscribe\", request.url));\n  }\n\n  return NextResponse.next();\n}\n\nexport const config = {\n  matcher: [\"\u002Fdashboard\u002F:path*\", \"\u002Fpremium\u002F:path*\"],\n};\n```\n\n## TypeScript Types\n\n```typescript\ninterface WhopMembership {\n  id: string;\n  user_id: string;\n  product_id: string;\n  plan_id: string;\n  status: \"active\" | \"paused\" | \"canceled\" | \"expired\";\n  valid: boolean;\n  license_key: string;\n  renews_at: string | null;\n  expires_at: string | null;\n  cancel_at_period_end: boolean;\n}\n\ninterface WhopPayment {\n  id: string;\n  amount: number;\n  currency: string;\n  status: \"succeeded\" | \"pending\" | \"failed\";\n  user_id: string;\n  product_id: string;\n}\n```\n\n## Error Handling\n\n```typescript\nasync function safeWhopRequest(url: string, options: RequestInit) {\n  const response = await fetch(url, options);\n\n  if (!response.ok) {\n    const error = await response.json();\n    throw new Error(error.message || \"Whop API error\");\n  }\n\n  return response.json();\n}\n```\n\n| Error | Meaning |\n|-------|---------|\n| `401 Unauthorized` | Invalid API key |\n| `403 Forbidden` | Insufficient permissions |\n| `404 Not Found` | Resource doesn't exist |\n| `429 Too Many Requests` | Rate limited |\n\n## Security Best Practices\n\n**DO:**\n- Verify webhook signatures\n- Store tokens encrypted\n- Check membership status server-side\n- Use HTTPS everywhere\n\n**DON'T:**\n- Expose API keys client-side\n- Trust client-sent membership data\n- Skip webhook verification\n- Log sensitive data\n\n## Implementation Checklist\n\n- [ ] Create Whop account and company\n- [ ] Get API keys from Dashboard\n- [ ] Set environment variables\n- [ ] Create products and plans\n- [ ] Implement checkout flow\n- [ ] Add membership access checking\n- [ ] Set up webhook endpoint\n- [ ] Handle payment events\n- [ ] Test end-to-end flow\n\n## Resources\n\n- **Dashboard:** https:\u002F\u002Fwhop.com\u002Fdashboard\n- **API Docs:** https:\u002F\u002Fdocs.whop.com\n- **API Base:** https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\n","# Whop Platform Expert\n\nWhop is a platform for selling digital products, memberships, courses, and community access.\n\n## When to Use\n\n- Building membership\u002Fsubscription products\n- Integrating Whop checkout and payments\n- Managing courses and educational content\n- Gating content by membership status\n- Handling webhooks for payment events\n- Building Whop apps with OAuth\n\n## Quick Start\n\n### Authentication\n\n```typescript\nconst headers = {\n  Authorization: `Bearer ${process.env.WHOP_API_KEY}`,\n  \"Content-Type\": \"application\u002Fjson\",\n};\n\nconst response = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fme\", { headers });\n```\n\n**API Key Types:**\n- **Company API Keys** - Your own company data (Dashboard → Settings → API Keys)\n- **App API Keys** - Multi-tenant apps (Dashboard → Developer → Your App)\n\n## Core Operations\n\n### Create Product\n\n```typescript\nconst product = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fproducts\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    title: \"Premium Membership\",\n    description: \"Access to all content\",\n    visibility: \"visible\",\n  }),\n});\n```\n\n### Create Plan\n\n```typescript\nconst plan = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fplans\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    product_id: \"prod_xxx\",\n    billing_period: 1,\n    billing_period_unit: \"month\",\n    price: 2999, \u002F\u002F $29.99 in cents\n    currency: \"usd\",\n  }),\n});\n```\n\n### Create Checkout\n\n```typescript\nconst checkout = await fetch(\n  \"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcheckout-configurations\",\n  {\n    method: \"POST\",\n    headers,\n    body: JSON.stringify({\n      plan_id: \"plan_xxx\",\n      success_url: \"https:\u002F\u002Fyourapp.com\u002Fsuccess\",\n      cancel_url: \"https:\u002F\u002Fyourapp.com\u002Fcancel\",\n      metadata: { user_id: \"123\" },\n    }),\n  }\n);\n\nconst { url } = await checkout.json();\n\u002F\u002F Redirect user to url\n```\n\n## Membership Management\n\n### List Memberships\n\n```typescript\nconst response = await fetch(\n  \"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fmemberships?valid=true\",\n  { headers }\n);\n\nconst { data: memberships } = await response.json();\n```\n\n### Check User Access\n\n```typescript\nasync function checkAccess(userId: string, productId: string): Promise\u003Cboolean> {\n  const response = await fetch(\n    `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fmemberships?user_id=${userId}&product_id=${productId}&valid=true`,\n    { headers }\n  );\n\n  const { data } = await response.json();\n  return data.length > 0;\n}\n```\n\n### Validate License Key\n\n```typescript\nasync function validateLicense(licenseKey: string): Promise\u003Cboolean> {\n  const response = await fetch(\n    `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fmemberships?license_key=${licenseKey}`,\n    { headers }\n  );\n\n  const { data } = await response.json();\n  return data.length > 0 && data[0].valid;\n}\n```\n\n### Cancel Membership\n\n```typescript\nawait fetch(\n  `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fmemberships\u002F${membershipId}\u002Fcancel`,\n  {\n    method: \"POST\",\n    headers,\n  }\n);\n```\n\n## Payments\n\n### Get Payment\n\n```typescript\nconst payment = await fetch(\n  `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fpayments\u002F${paymentId}`,\n  { headers }\n);\n```\n\n### Refund Payment\n\n```typescript\nawait fetch(`https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fpayments\u002F${paymentId}\u002Frefund`, {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    amount: 1000, \u002F\u002F Optional: partial refund in cents\n  }),\n});\n```\n\n## Courses\n\n### Create Course\n\n```typescript\nconst course = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcourses\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    product_id: \"prod_xxx\",\n    title: \"Complete Web Development\",\n    description: \"Learn fullstack from scratch\",\n    visibility: \"visible\",\n  }),\n});\n```\n\n### Create Chapter\n\n```typescript\nconst chapter = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcourse-chapters\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    course_id: \"course_xxx\",\n    title: \"Introduction to JavaScript\",\n    order: 1,\n  }),\n});\n```\n\n### Create Lesson\n\n```typescript\nconst lesson = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcourse-lessons\", {\n  method: \"POST\",\n  headers,\n  body: JSON.stringify({\n    chapter_id: \"chapter_xxx\",\n    title: \"Variables and Data Types\",\n    content: \"Lesson content in markdown...\",\n    type: \"video\", \u002F\u002F or 'text', 'quiz', 'assignment'\n    video_url: \"https:\u002F\u002Fyoutube.com\u002Fwatch?v=...\",\n    order: 1,\n  }),\n});\n```\n\n### Mark Lesson Complete\n\n```typescript\nawait fetch(\n  `https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fcourse-lessons\u002F${lessonId}\u002Fmark-as-completed`,\n  {\n    method: \"POST\",\n    headers: {\n      Authorization: `Bearer ${userAccessToken}`,\n    },\n  }\n);\n```\n\n## Webhooks\n\n### Setup Endpoint\n\n```typescript\nimport crypto from \"crypto\";\n\nexport async function POST(req: Request) {\n  const body = await req.text();\n  const signature = req.headers.get(\"x-whop-signature\");\n\n  \u002F\u002F Verify signature\n  const hash = crypto\n    .createHmac(\"sha256\", process.env.WHOP_WEBHOOK_SECRET!)\n    .update(body)\n    .digest(\"hex\");\n\n  if (hash !== signature) {\n    return new Response(\"Invalid signature\", { status: 401 });\n  }\n\n  const event = JSON.parse(body);\n\n  switch (event.action) {\n    case \"payment.succeeded\":\n      await handlePaymentSuccess(event.data);\n      break;\n\n    case \"membership.activated\":\n      await grantAccess(event.data);\n      break;\n\n    case \"membership.deactivated\":\n      await revokeAccess(event.data);\n      break;\n\n    case \"dispute.created\":\n      await handleDispute(event.data);\n      break;\n  }\n\n  return Response.json({ received: true });\n}\n```\n\n**Key webhook events:**\n| Event | Trigger |\n|-------|---------|\n| `payment.succeeded` | Payment completed |\n| `payment.failed` | Payment failed |\n| `membership.activated` | Membership started |\n| `membership.deactivated` | Membership ended |\n| `invoice.paid` | Recurring payment succeeded |\n| `dispute.created` | Chargeback initiated |\n\n## OAuth Apps\n\n### Redirect to Whop OAuth\n\n```typescript\nconst authUrl = new URL(\"https:\u002F\u002Fwhop.com\u002Foauth\");\nauthUrl.searchParams.set(\"client_id\", process.env.WHOP_CLIENT_ID!);\nauthUrl.searchParams.set(\"redirect_uri\", \"https:\u002F\u002Fyourapp.com\u002Fcallback\");\nauthUrl.searchParams.set(\"scope\", \"memberships:read payments:read\");\n\n\u002F\u002F Redirect user\nwindow.location.href = authUrl.toString();\n```\n\n### Handle Callback\n\n```typescript\nexport async function GET(req: Request) {\n  const url = new URL(req.url);\n  const code = url.searchParams.get(\"code\");\n\n  const response = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Foauth\u002Ftoken\", {\n    method: \"POST\",\n    headers: { \"Content-Type\": \"application\u002Fjson\" },\n    body: JSON.stringify({\n      client_id: process.env.WHOP_CLIENT_ID!,\n      client_secret: process.env.WHOP_CLIENT_SECRET!,\n      code,\n      grant_type: \"authorization_code\",\n      redirect_uri: \"https:\u002F\u002Fyourapp.com\u002Fcallback\",\n    }),\n  });\n\n  const { access_token, refresh_token } = await response.json();\n  \u002F\u002F Store tokens securely\n}\n```\n\n## Middleware (Access Control)\n\n```typescript\n\u002F\u002F middleware.ts\nimport { NextResponse } from \"next\u002Fserver\";\nimport type { NextRequest } from \"next\u002Fserver\";\n\nexport async function middleware(request: NextRequest) {\n  const token = request.cookies.get(\"whop_user_token\")?.value;\n\n  if (!token) {\n    return NextResponse.redirect(new URL(\"\u002Flogin\", request.url));\n  }\n\n  const response = await fetch(\"https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\u002Fme\u002Fmemberships\", {\n    headers: { Authorization: `Bearer ${token}` },\n  });\n\n  const { data } = await response.json();\n  const hasAccess = data.some((m: any) => m.status === \"active\" && m.valid);\n\n  if (!hasAccess) {\n    return NextResponse.redirect(new URL(\"\u002Fsubscribe\", request.url));\n  }\n\n  return NextResponse.next();\n}\n\nexport const config = {\n  matcher: [\"\u002Fdashboard\u002F:path*\", \"\u002Fpremium\u002F:path*\"],\n};\n```\n\n## TypeScript Types\n\n```typescript\ninterface WhopMembership {\n  id: string;\n  user_id: string;\n  product_id: string;\n  plan_id: string;\n  status: \"active\" | \"paused\" | \"canceled\" | \"expired\";\n  valid: boolean;\n  license_key: string;\n  renews_at: string | null;\n  expires_at: string | null;\n  cancel_at_period_end: boolean;\n}\n\ninterface WhopPayment {\n  id: string;\n  amount: number;\n  currency: string;\n  status: \"succeeded\" | \"pending\" | \"failed\";\n  user_id: string;\n  product_id: string;\n}\n```\n\n## Error Handling\n\n```typescript\nasync function safeWhopRequest(url: string, options: RequestInit) {\n  const response = await fetch(url, options);\n\n  if (!response.ok) {\n    const error = await response.json();\n    throw new Error(error.message || \"Whop API error\");\n  }\n\n  return response.json();\n}\n```\n\n| Error | Meaning |\n|-------|---------|\n| `401 Unauthorized` | Invalid API key |\n| `403 Forbidden` | Insufficient permissions |\n| `404 Not Found` | Resource doesn't exist |\n| `429 Too Many Requests` | Rate limited |\n\n## Security Best Practices\n\n**DO:**\n- Verify webhook signatures\n- Store tokens encrypted\n- Check membership status server-side\n- Use HTTPS everywhere\n\n**DON'T:**\n- Expose API keys client-side\n- Trust client-sent membership data\n- Skip webhook verification\n- Log sensitive data\n\n## Implementation Checklist\n\n- [ ] Create Whop account and company\n- [ ] Get API keys from Dashboard\n- [ ] Set environment variables\n- [ ] Create products and plans\n- [ ] Implement checkout flow\n- [ ] Add membership access checking\n- [ ] Set up webhook endpoint\n- [ ] Handle payment events\n- [ ] Test end-to-end flow\n\n## Resources\n\n- **Dashboard:** https:\u002F\u002Fwhop.com\u002Fdashboard\n- **API Docs:** https:\u002F\u002Fdocs.whop.com\n- **API Base:** https:\u002F\u002Fapi.whop.com\u002Fapi\u002Fv5\n",{"name":5,"model":43,"license":15,"metadata":44,"description":7,"allowed-tools":47},"sonnet",{"author":45,"version":46},"raintree","1.0","Read, Write, Edit, Grep, Glob, Bash","main","cbdd44aae21131521c09e42762e36178c790eacf","public\u002FSKILLS\u002FSaaS & Backend\u002Fwhop",13,"https:\u002F\u002Fgithub.com\u002Feric861129\u002FSKILLS_All-in-one","http:\u002F\u002Fhuangchiyu.com\u002FSKILLS_All-in-one\u002F","https:\u002F\u002Fgithub.com\u002Feric861129","https:\u002F\u002Fhuangchiyu.com\u002FChiYu-Blog\u002F","開發工程師，專注於 C#／.NET 系統現代化、AI-assisted engineering、開源工具與技術寫作。","2026-04-16 14:28:14",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add eric861129\u002FSKILLS_All-in-one --skill whop",{"tool":64,"command":65},"bunx","bunx skills add eric861129\u002FSKILLS_All-in-one --skill whop",{"tool":67,"command":68},"pnpm","pnpm dlx skills add eric861129\u002FSKILLS_All-in-one --skill whop","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Feric861129\u002FSKILLS_All-in-one\u002Fblob\u002Fmain\u002Fpublic\u002FSKILLS\u002FSaaS & Backend\u002Fwhop\u002FSKILL.md",true,[],[73,98,117,140,162,181],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":38},"01M6CZ1WR3KNVTKSWH4GNWT646","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Feric861129\u002FSKILLS_All-in-one\u002Fblob\u002Fmain\u002Fpublic\u002FSKILLS\u002FWriting & Research\u002Fwhat-if-oracle\u002FSKILL.md",[],[80,81,82,83,84,85,86,87,88,89,90,91,92,30,29,93,94,95,96,97],"oracle","what if oracle","go","run","planning","ux","futures","risk","analysis","explore","decision","branch","question","idea","exploration","options","stress-test","strategies",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":38},"01M6CZ1QHGJE91A95MSN5EK5Q9","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Feric861129\u002FSKILLS_All-in-one\u002Fblob\u002Fmain\u002Fpublic\u002FSKILLS\u002FWriting & Research\u002Fvenue-templates\u002FSKILL.md",[],[105,106,107,108,109,110,111,112,32,113,30,29,19,114,115,116],"templates","venue templates","research","guidelines","NeurIPS","ICML","LaTeX","science","access","proposals","Academic","requirements",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":38},"01M6CZ1KBQD2E5RTFB3BGVX7CD","the-fool","Use when challenging ideas, plans, decisions, or proposals using structured critical reasoning. Invoke to play devil's advocate, run a pre-mortem, red team, or audit evidence and assumptions.","https:\u002F\u002Fgithub.com\u002Feric861129\u002FSKILLS_All-in-one\u002Fblob\u002Fmain\u002Fpublic\u002FSKILLS\u002FWriting & Research\u002Fthe-fool\u002FSKILL.md",[],[124,125,82,126,127,83,128,129,130,131,132,133,134,135,114,136,137,26,138,139],"the fool","review","workflow","architecture","code","audit","forge","devil","team","designer","reviewer","challenge","stress test","evidence","poke","ideas",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":38},"01M6CZ1ES826S7P1X3333E40TA","scientific-writing","Core skill for the deep research and writing tool. Write scientific manuscripts in full paragraphs (never bullet points). Use two-stage process with (1) section outlines with key points using research-lookup then (2) convert to flowing prose. IMRAD structure, citations (APA\u002FAMA\u002FVancouver), figures\u002Ftables, reporting guidelines (CONSORT\u002FSTROBE\u002FPRISMA), for research papers and journal submissions.","https:\u002F\u002Fgithub.com\u002Feric861129\u002FSKILLS_All-in-one\u002Fblob\u002Fmain\u002Fpublic\u002FSKILLS\u002FWriting & Research\u002Fscientific-writing\u002FSKILL.md",[],[147,148,108,149,150,151,152,153,32,154,30,29,19,155,156,157,158,159,160,161],"writing","scientific writing","core","reporting","deep research","Citations","Outlines","tool","use","never","structure","deep","full","stage","prisma",{"skillNo":163,"name":164,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":168,"publishedAt":38},"01M6CZ1B2JGJTB9FRD0TW4RXXE","scientific-brainstorming","Creative research ideation and exploration. Use for open-ended brainstorming sessions, exploring interdisciplinary connections, challenging assumptions, or identifying research gaps. Best for early-stage research planning when you do not have specific observations yet. For formulating testable hypotheses from data use hypothesis-generation.","https:\u002F\u002Fgithub.com\u002Feric861129\u002FSKILLS_All-in-one\u002Fblob\u002Fmain\u002Fpublic\u002FSKILLS\u002FWriting & Research\u002Fscientific-brainstorming\u002FSKILL.md",[],[169,170,107,171,84,172,173,174,155,175,176,177,94,178,179,160,180],"brainstorming","scientific brainstorming","sessions","data","hypothesis","open","ideation","creative","do","connections","research ideation","generation",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":187,"publishedAt":38},"01M6CZ16JG8N7A2ZX04BGE8J2Y","research-lookup","Look up current research information using the Parallel Chat API (primary) or Perplexity sonar-pro-search (academic paper searches). Automatically routes queries to the best backend. Use for finding papers, gathering research data, and verifying scientific information.","https:\u002F\u002Fgithub.com\u002Feric861129\u002FSKILLS_All-in-one\u002Fblob\u002Fmain\u002Fpublic\u002FSKILLS\u002FWriting & Research\u002Fresearch-lookup\u002FSKILL.md",[],[107,188,189,190,172,191,33,32,192,193,30,29,19,155,194,195,196,197,198,115],"lookup","research lookup","search","perplexity","parallel","openrouter","backend","up","look","queries","chat"]