Reseller API
Overview
Authentication
Basic Authentication
Responses
No matter if request is successful or not, endpoints are returning a JSON response in the following format:
code
attribute - success
or relevant error code in case of failure.
message
attribute - success
or error message in case of failure.
data
attribute - contains actual data or details about error.
Shared error responses
Fatal error:
{
"code": "internal_server_error",
"message": "<p>There has been a critical error on this website.</p><p><a href=\"https://wordpress.org/documentation/article/faq-troubleshooting/\">Learn more about troubleshooting WordPress.</a></p>",
"data": {
"status": 500
},
"additional_errors": []
}
Missing one or more required parameters:
{
"code": "rest_missing_callback_param",
"message": "Missing parameter(s): type",
"data": {
"status": 400,
"params": [
"type"
]
}
}
Required parameter is empty:
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): type",
"data": {
"status": 400,
"params": {
"type": "Sorry, field is empty which is not allowed."
},
"details": {
"type": {
"code": "param_value_empty",
"message": "Sorry, field is empty which is not allowed.",
"data": null
}
}
}
}
Endpoints
Create Order
Creates Parent or Renewal Order
POST /wp-json/reseller/v1/payment/
Parameter | Type | Description |
---|---|---|
type | string | Required. Order Type (parent , renewal or switch ) |
first_name | string | Required. Customer First Name |
last_name | string | Optional. Customer Last Name |
email | string | Required. Customer email |
reseller_user | string | Optional. Unique reseller's customer identifier |
plan | string | Required. Plan (seo-by-rank-math-pro , seo-by-rank-math-business , seo-by-rank-math-agency , content-ai-starter , content-ai-creator , content-ai-expert ) |
total | string | Optional. Total paid for order. If not provided payment total will be set to 0 |
price | string | Optional. Subscription renewal price. If not provided subscription price will be set to 0 in case of parent payment type, otherwise will not be changed. |
renewal_time | string | Optional. Next renewal timestamp. If not provided, renewal time will be set to +1 year , except in case of switch type when renewal time will not be changed. |
subscription_id | string | Required in case of renewal or switch. |
Response example:
{
"code": "success",
"message": "success",
"data": {
"status": 200,
"error": false,
"type": "order.create",
"order": {
"order_type": "parent",
"id": 657123,
"subscription_id": 657124,
"paid_date": 1697814628,
"currency": "USD",
"total": "23.00"
},
"customer": {
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"id": 377867
},
"licence": {
"date_expiration": 1729437029,
"plan": "pro",
"origin": "reseller",
"subscription_id": 657124,
"status": "active"
},
"plugin": "https://rankmath.com/download/510590/seo-by-rank-math-pro.zip?username=example&api_key=cd8a1126a1ed0137c00eed2d8353e686"
}
}
Possible error codes:
not_found
- User or Subscription not found,
plan_exists
- User already have subscription,
storing_error
- Something went wrong during data recording
Get Order Info
GET /wp-json/reseller/v1/order/{order_id}
Parameter | Type | Description |
---|---|---|
order_id | string | Required. Order ID |
Possible error codes:
not_found
- User or Order not found
Get Customer Info
GET, PATCH /wp-json/reseller/v1/customer/
Parameter | Type | Description |
---|---|---|
customer_id | string | Required. User ID or Email |
new_email | string | Optional. Required on case of PATCH method |
Possible error codes:
not_found
- User not found
List Orders
Only orders made by reseller will be listed.
GET wp-json/reseller/v1/orders/
Parameter | Type | Description |
---|---|---|
number | integer | Optional. Number of Orders (Default: 50, Max:50) |
page | integer | Optional. Page (Default: 1) |
Get or Cancel Subscription
GET, DELETE /wp-json/reseller/v1/subscription/{subscription_id}
Parameter | Type | Description |
---|---|---|
subscription_id | integer | Required. Subscription ID |
Response example:
{
"code": "success",
"message": "success",
"data": {
"status": 200,
"error": false,
"type": "subscription",
"orders": [
{
"order": {
"order_type": "parent",
"id": 657508,
"subscription_id": 657509,
"paid_date": 1699533362,
"currency": "USD",
"total": "35.00"
}
}
],
"customer": {
"email": "[email protected]",
"first_name": "Test",
"last_name": "",
"id": 93940
},
"licence": {
"date_expiration": 0,
"plan": "pro",
"origin": "reseller",
"subscription_id": 657509,
"status": "cancelled"
},
"plugin": "https://rankmath.com/download/510590/seo-by-rank-math-pro.zip?username=test4&api_key=7b8106073ee433974168e618a6e378d5"
}
}
Possible error codes:
not_found
- Subscription not found,
storing_error
- Something went wrong during data recording