@openpets/whop
v1.0.0
Published
Comprehensive plugin for interacting with the Whop API - manage products, payments, users, companies, memberships, and more
Maintainers
Readme
Whop API Plugin for OpenPets
A comprehensive OpenPets plugin for interacting with the Whop API - manage products, payments, users, companies, memberships, and more.
Features
- Products Management: List, retrieve, and manage products
- Payments Processing: List payments, get payment details, and analyze transaction data
- User Management: Get user information and check access permissions
- Company Operations: Retrieve company details and manage business data
- Membership Tracking: List and manage user memberships
- Plan Management: Handle subscription plans and pricing
- App Development: List and manage Whop applications
- Fee Analysis: Get detailed fee information for payments
Quick Start
1. Environment Setup
Create a .env file in the whop directory:
WHOP_API_KEY=your_api_key_here
WHOP_APP_ID=your_app_id_here # Optional, for app development2. Get Your API Key
- Go to Whop Developer Dashboard
- Create either a Company API Key (for your own data) or App API Key (for building apps)
- Copy the API key to your
.envfile
3. Test Connection
cd pets/whop
opencode run "test whop connection" --format json --print-logsAvailable Tools
Connection & Testing
whop-test-connection- Test API connection and get account info
Products
whop-list-products- List products with filtering optionswhop-get-product- Get detailed product information
Payments
whop-list-payments- List payments with comprehensive filteringwhop-get-payment- Get specific payment detailswhop-list-payment-fees- Get fee breakdown for payments
Users
whop-get-user- Get user information by ID or usernamewhop-check-user-access- Check if user has product access
Companies
whop-get-company- Get company information
Memberships
whop-list-memberships- List memberships with status filteringwhop-get-membership- Get specific membership details
Plans
whop-list-plans- List subscription plans
Apps
whop-list-apps- List applications (requires app API key)
Usage Examples
List Products for a Company
opencode run "list all products for company biz_1234567890" --format jsonGet Recent Payments
opencode run "list recent payments for company biz_1234567890 with limit 10" --format jsonCheck User Access
opencode run "check if user_123456 has access to product_7890" --format jsonGet Payment Details
opencode run "get payment details for pay_abcdef123456" --format jsonAPI Key Types
Company API Keys
- Use for accessing your own company's data
- Can access connected account data (for platforms)
- Recommended for most use cases
App API Keys
- Use for building applications
- Can access data from companies that installed your app
- Requires app permissions setup
Required Permissions
Different endpoints require different permission scopes:
- Products:
access_pass:basic:read - Payments:
payment:basic:read,plan:basic:read,member:basic:read - Users: Varies by endpoint
- Companies:
company:basic:read - Memberships:
membership:basic:read
Check the Whop API Documentation for detailed permission requirements.
Response Format
All tools return JSON responses with consistent structure:
{
"success": true,
"data": { /* response data */ },
"message": "Operation completed successfully"
}Error responses:
{
"success": false,
"error": "Error message",
"details": { /* additional context */ }
}Filtering Options
Products
visibility: Filter by product visibilityproductType: Filter by product typeorder: Sort by various fieldsdirection: Sort direction (asc/desc)
Payments
status: Payment status filtersubstatus: Payment substatus filtercurrency: Currency filterincludeFree: Include free transactions
Memberships
status: Membership status filter
Error Handling
The plugin includes comprehensive error handling:
- Connection errors: Network issues, invalid endpoints
- Authentication errors: Invalid or missing API keys
- Permission errors: Insufficient API permissions
- Validation errors: Invalid parameters
Development
Local Testing
- Make changes to
index.ts - Test with OpenCode commands
- Check logs for debugging information
Building
pets build whopPublishing
pets publish whopTroubleshooting
Common Issues
"Not configured" error
- Check that
WHOP_API_KEYis set in.env - Verify the API key is valid
- Check that
Permission denied errors
- Ensure your API key has required permissions
- Check if you're using the right key type (company vs app)
Invalid company/product IDs
- Verify IDs are in correct format (biz_xxx, prod_xxx, etc.)
- Check that resources exist and are accessible
Debug Mode
Enable debug logging by setting log level in your environment:
WHOP_LOG_LEVEL=debugAPI Reference
For detailed API documentation, see:
Support
- Documentation: Check this README and API docs
- Issues: Report bugs via GitHub issues
- Community: Join the OpenPets Discord community
License
This plugin is part of the OpenPets ecosystem and follows the same license terms.
