API - Endpoint: Check Addon Subscription Status and Expiration for Users

Check a user's addon subscription

Addon creators can use this endpoint to check one IO account's subscription status and expiration date. The addon must be approved and belong to the authenticated creator's IO account.

Endpoint and authentication

GET or POST https://rental.software/api6/addon_subscription

In the examples below, replace the example keys, usernames, and addon IDs with your own values.

Authenticate with an API key belonging to the creator's account, using the apiKey field. The account needs its normal API access, including the WP/API module. Existing API key IP restrictions, usage limits, and account access rules apply.

Identify the user requesting addon access with either username or user_api_key. These fields identify the subscriber; they do not replace the creator's apiKey. Send requests from your server so the creator's API key stays private. POST lets you send keys in the request body.

Request fields

Field Required Meaning
apiKey Yes API key for the IO account that created the addon.
addon_id Yes Positive integer ID of an approved addon created by that account.
username One of these two Subscriber's IO account username or worker username.
user_api_key One of these two Subscriber's valid IO API key or API authentication token.

Supply exactly one of username and user_api_key. Field names are case-sensitive, including the capital K in apiKey. Worker usernames resolve to their parent IO account, and the endpoint checks that account's subscription. If a name matches both an account username and a worker username, the account username takes precedence. An unknown username returns not_subscribed.

When using user_api_key, normal key validation applies, including expiry, API access requirements for API keys, and any IP restriction. The request comes from your integration server, so that server must be allowed by the subscriber key's restrictions.

Examples

Check an account username

curl --request POST 'https://rental.software/api6/addon_subscription'\

   --header 'Content-Type: application/json' \

   --data '{

      "apiKey": "YOUR_CREATOR_API_KEY",

      "addon_id": 123,

      "username": "customer_company"

    }'

To check a worker, use the same request with the worker's login username in username, for example customer_worker. The result is the subscription for that worker's parent account.

Check a subscriber API key

curl --request POST 'https://rental.software/api6/addon_subscription'\

   --header 'Content-Type: application/json' \

   --data '{

      "apiKey": "YOUR_CREATOR_API_KEY",

      "addon_id": 123,

      "user_api_key": "SUBSCRIBER_API_KEY_OR_TOKEN"

    }'

GET also accepts these fields as query parameters. POST accepts JSON or form fields.

Successful responses

A matching subscription returns HTTP 200:

{

    "status": "active",

    "Expires_at": 1800000000,

    "Request_time": 1794000000

}

If no subscription exists for the identified account and addon, the response is also HTTP 200:

{

    "status": "not_subscribed",

    "Expires_at": null,

    "Request_time": 1794000000

}

Response field Meaning
status Stored subscription status: active, trial, cancelled, inactive, or expired. not_subscribed means no matching subscription was found.
expires_at Stored subscription expiration as a Unix timestamp in seconds. Null when no subscription exists.
request_time API response time as a Unix timestamp in seconds; included by the standard API6 response formatter.

The endpoint reports the stored status and expiration without calculating an access decision. For renewing subscriptions, the expiration represents the current subscription period and can move forward after renewal. A cancelled subscription can still be within its paid period. An active status can also have a past expiration while payment is being retried. Check both values according to your addon's access policy rather than treating the status alone as an expiration check.

Errors

Check the HTTP status before reading the subscription result. For example, an unavailable addon returns HTTP 404 with:

{

    "status": 404,

    "message": "Addon not found"

}

HTTP status Meaning
400 Invalid or missing addon_id; missing or conflicting subscriber identifiers; invalid user_api_key.
401 Creator authentication failed, or the creator's account is past its permitted subscription window.
403 Creator account, module, or other existing API access restriction.
404 Addon does not exist, is not approved, or was created by another account. All three return the same error.
405 Unsupported HTTP method. Use GET or POST.
429 Existing API rate or usage limit was reached.

An error response does not establish whether the user is subscribed. Handle it separately from an HTTP 200 response containing not_subscribed.

Verify your integration

Before using this check to grant addon access, verify requests against an approved addon you created:

  • A known subscriber returns the expected status and expiration.
  • That subscriber's account username, worker username, and valid API key resolve to the same subscription.
  • An account without a subscription returns not_subscribed and a null expiration.
  • An unapproved addon or another creator's addon returns HTTP 404.
Is this article helpful?
0 0 0