Skip to main content

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/
ParameterTypeDescription
typestringRequired. Order Type (parent, renewal or switch)
first_namestringRequired. Customer First Name
last_namestringOptional. Customer Last Name
emailstringRequired. Customer email
reseller_userstringOptional. Unique reseller's customer identifier
planstringRequired. 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)
totalstringOptional. Total paid for order. If not provided payment total will be set to 0
pricestringOptional. 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_timestringOptional. 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_idstringRequired 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}
ParameterTypeDescription
order_idstringRequired. Order ID

Possible error codes:

not_found - User or Order not found

Get Customer Info

GET, PATCH /wp-json/reseller/v1/customer/
ParameterTypeDescription
customer_idstringRequired. User ID or Email
new_emailstringOptional. 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/
ParameterTypeDescription
numberintegerOptional. Number of Orders (Default: 50, Max:50)
pageintegerOptional. Page (Default: 1)

Get or Cancel Subscription

GET, DELETE /wp-json/reseller/v1/subscription/{subscription_id}
ParameterTypeDescription
subscription_idintegerRequired. 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