WPSubscription Pro includes REST API support for performing subscription actions programmatically. This feature allows developers and automation tools to manage subscriptions remotely using secure API requests.
API Settings
To enable and access REST API functionality:
Go to WPSubscription > Settings > API Settings
Check Enable REST API endpoints for subscription actions
Copy the REST API Endpoint URL provided
Use or regenerate the API Key for authentication
Keep your API key secure. It must be included in every API request.

Available Subscription Actions
Each API request must be made as a POST request to:
/wp-json/wpsubscription/v1/action
Every request must include:
action
: Type of operation to perform (e.g.cancel_subscription
)subscription_id
: ID of the subscription to targetapi_key
: Your plugin-generated API keydata
: Optional additional info (e.g. reason for cancellation)
Supported Actions
Action | Description | Example Use Case |
---|---|---|
| Cancels an active subscription | Trigger from CRM when customer churns |
| Puts a subscription on hold (pending) | Vacation pause or payment issue |
| Reactivates a paused subscription | Resume billing after pause |
| Change status to: active, pending, cancelled, expired | Sync with external system or admin rule |
| Reactivate a cancelled subscription | Manual override from support or CRM |
| Mark subscription as expired manually | Time-limited plans or force expiry |
| Trigger custom logic at end of free trial | Convert free to paid in other systems |
| Log or react to failed renewal attempts | Dunning workflows, CRM alert |
| Verify API key validity | Test connection from external tool |
Sample JSON Request

Here’s how to resume a subscription via Postman or external system:
POST /wp-json/wpsubscription/v1/action
{
"action": "resume_subscription",
"subscription_id": 168,
"api_key": "your-api-key",
"data": {
"reason": "Customer request"
}
}
Sample JSON Success Response
{
"status": "success",
"message": "Subscription action \"resume_subscription\" processed successfully",
"subscription_id": 168
}
Logs & Debugging
All REST API activity is logged inside WooCommerce > Status > Logs under the log file named subscription-pro-api-YYYY-MM-DD
.

Each log includes:
Timestamp
Action type
Subscription ID
Status (processed or error)
Payload data (if any)
Authentication & Security
All API calls require the API key for access.
API keys can be regenerated anytime from the API settings.
Keys should be securely stored and not exposed in public requests.
Error Handling
REST responses will return appropriate error codes for invalid input or failure states.
Error Code | Meaning |
---|---|
| Invalid or missing API key |
| Subscription ID not found |
| Provided status value is invalid |
| General action failure |
Always verify that your request body includes:
Valid API key
Correct action name
Valid subscription ID