Premiums API

Manage user premium subscriptions

Premiums API

Manage user premium subscriptions via action-based POST requests and GET queries

GET /api/users/user/[userId]/premiums?action=status

Get basic premium status for a user.

Endpoint:
/api/users/user/[userId]/premiums?action=status
Example Request:
GET https://api.wecompleteapp.com/api/users/user/USER_ID/premiums?action=status
Headers:
  Content-Type: application/json
Example Response:
{
  "isPremium": true,
  "source": "direct",
  "partnerId": null,
  "message": "Direct premium access"
}

GET /api/users/user/[userId]/premiums?action=subscription

Get full subscription details including start date, end date, plan, and other subscription information.

Endpoint:
/api/users/user/[userId]/premiums?action=subscription
Example Request:
GET https://api.wecompleteapp.com/api/users/user/USER_ID/premiums?action=subscription
Headers:
  Content-Type: application/json
Example Response:
{
  "success": true,
  "isPremium": true,
  "subscription": {
    "plan": "9.99",
    "startDate": 1718000000000,
    "endDate": 1720600000000,
    "isActive": true,
    "isPartnerInherited": false,
    "revenueCatId": "rc_abc123",
    "platform": "ios",
    "lastRenewed": 1718000000000,
    "cancelled": false,
    "meta": {}
  }
}

GET /api/users/user/[userId]/premiums?action=limits

Get comprehensive user limits and premium status details.

Endpoint:
/api/users/user/[userId]/premiums?action=limits
Example Request:
GET https://api.wecompleteapp.com/api/users/user/USER_ID/premiums?action=limits
Headers:
  Content-Type: application/json
Example Response:
{
  "isPremium": true,
  "limits": {
    "projects": 50,
    "storage": "10GB"
  }
}

GET /api/users/user/[userId]/premiums?action=check&feature=FEATURE_NAME

Quick check to see if a user has premium access to a specific feature.

Endpoint:
/api/users/user/[userId]/premiums?action=check&feature=FEATURE_NAME
Example Request:
GET https://api.wecompleteapp.com/api/users/user/USER_ID/premiums?action=check&feature=export_pdf
Headers:
  Content-Type: application/json
Example Response:
{
  "hasAccess": true
}

POST /api/users/user/[userId]/premiums (create)

Create or update a premium subscription for a user. Use `action: create` when the user first buys premium.

Endpoint:
/api/users/user/[userId]/premiums
Example Request:
curl -X POST https://api.wecompleteapp.com/api/users/user/USER_ID/premiums \
  -H "Content-Type: application/json" \
  -d '{
    "action": "create",
    "plan": "9.99",
    "startDate": 1718000000000,
    "endDate": 1720600000000,
    "revenueCatId": "rc_abc123",
    "platform": "ios",
    "meta": {}
  }'
Example Response:
{
  "success": true,
  "created": true
}

POST /api/users/user/[userId]/premiums (subscribe)

Alias for `create` — also creates or updates a premium subscription. Used when subscribing via an external provider.

Endpoint:
/api/users/user/[userId]/premiums
Example Request:
curl -X POST https://api.wecompleteapp.com/api/users/user/USER_ID/premiums \
  -H "Content-Type: application/json" \
  -d '{
    "action": "subscribe",
    "plan": "9.99",
    "startDate": 1718000000000,
    "endDate": 1720600000000,
    "revenueCatId": "rc_xyz789",
    "platform": "android",
    "meta": { "promoCode": "SUMMER2025" }
  }'
Example Response:
{
  "success": true,
  "created": true
}

POST /api/users/user/[userId]/premiums (update)

Update an existing premium subscription (change plan, renew, extend, etc). Fails if no premium exists.

Endpoint:
/api/users/user/[userId]/premiums
Example Request:
curl -X POST https://api.wecompleteapp.com/api/users/user/USER_ID/premiums \
  -H "Content-Type: application/json" \
  -d '{
    "action": "update",
    "plan": "19.99",
    "endDate": 1723200000000
  }'
Example Response:
{
  "success": true,
  "updated": true
}

POST /api/users/user/[userId]/premiums (cancel)

Deactivate a user's premium subscription. Sets `isActive` to false.

Endpoint:
/api/users/user/[userId]/premiums
Example Request:
curl -X POST https://api.wecompleteapp.com/api/users/user/USER_ID/premiums \
  -H "Content-Type: application/json" \
  -d '{ "action": "cancel" }'
Example Response:
{
  "success": true,
  "deactivated": true
}

POST /api/users/user/[userId]/premiums (deactivate)

Same as cancel — deactivates a premium subscription.

Endpoint:
/api/users/user/[userId]/premiums
Example Request:
curl -X POST https://api.wecompleteapp.com/api/users/user/USER_ID/premiums \
  -H "Content-Type: application/json" \
  -d '{ "action": "deactivate" }'
Example Response:
{
  "success": true,
  "deactivated": true
}

📌 Notes:

GET Endpoints:
- action=status - Basic premium status (isPremium, source, partnerId)
- action=subscription or action=details - Full subscription details with dates
- action=limits - Comprehensive limits and usage information
- action=check&feature=FEATURE_NAME - Quick feature access check

POST Endpoints:
- All POST requests must include an action field in the body.
- action can be: create, subscribe, update, cancel, or deactivate.
- plan is a string representing the price (e.g., "9.99").
- Dates (startDate / endDate) are in milliseconds since epoch.
- create / subscribe will create or update a premium plan.
- update modifies an existing premium plan without creating one.
- cancel / deactivate turn off premium access.
- Optional fields: revenueCatId, platform, meta.