Create, update, delete billing plan

You can use this command for billing plan creation, updating, deleting:

svc=account/update_billing_plan&params={"callMode":<text>,
					"plan":{
					     "name":<text>,
					     "rename":<text>,
					     "servicesModCounter":<uint>,
					     "historyPeriod":<int>,
					     "flags":<uint>,
					     "denyBalance":<double>,
					     "blockBalance":<double>,
					     "minDaysCounter":<int>,
					     "currencyFormat":<text>,
					     "descr":<text>,
					     "email":<text>,
					     "hwTypes":{		
							"<hw_id>":			
								     { 		
							     	        "name": <uint>	
								     },
							...
					     },
					     "parent": <text>,
				             "personal":
				        	        {
	        			           	    "services": <object>
				        	        }
					}}

Parameters

Name Description Values
callMode request type create, update, delete

Plan

Name Description
name billing plan name (unique field)
rename new billing plan name
servicesModCounter counter shows how many times services list being modified
historyPeriod time to store unit messages, days
flags billing plan flags (see below)
denyBalance min balance below which block occurs
blockBalance min balance below which services block occurs
minDaysCounter min days count below whoch block occurs
currencyFormat currency format
descr billing plan description
email email box

:!: Restrictions for rename:
1. top billing name editing is restricted;
2. setting already existed billing name to another plan is restricted (no dublicates allowed).

Billing plan flags

Flag Description
0x01 block users, if the balance is less than block balance
0x02 forbid to login to the system and stop account functioning if the balance is less than deny balance
0x08 limit device types by assigned
0x10 limit device types by any except assigned
0x20 every day decrease the days counter value, and block account when remained days value reaches the minimum value

HW Types

Name Description
<hw_name> put correct hw name here
id hardware id

Services

Name Description
cost cost table
descr service description
flags define action: 0 – none, 1 – create/update, 2 – delete
interval 0 – none, 1 – hourly, 2 – daily,
3 – weekly, 4 – monthly
maxUsage amount of items available
name service name
type service type: 1 – on demand, 2 – periodic

Please visit this page to get more info about services list.

Response

{
	"parent":<text>,			/* parent billing plan name */
	"name":<text>,				/* billing plan name */
	"servicesModCounter":<uint>,		/* services modification counter */
	"historyPeriod":<uint>,			/* history period to store messages, in days (if 0 - unlimited) */
	"flags":<uint>,				/* billing plan flags */
	"denyBalance":<int>,			/* deny balance */
	"blockBalance":<int>,			/* block balance */
	"minDaysCounter":<int>,			/* minimum days counter */
	"currencyFormat":<text>,		/* currency format */
	"descr":<text>,				/* description */
	"email":<text>,				/* email */
	"mapserverTags":<text>,			/* map server tags */
	"hwTypes":{				/* hardware object */
				"<hw_id>":			/* hardware id */
					     { 		
				     	        "name": <text>			/* hardware name */
					     },
				...
	},
	"personal":
	        	        {
	        	        	"services": <object>	/* services object (see below) */
	        	        },
	"combined":
	        	        {
	        	        	"services": <object>	/* services object (see below) */
	        	        }
	}
}

Services

"services":{                          /* service object where keys are correct service names */
                "<service_name>":{                  /* put correct service name instead of <service_name> */
                                "type": <uint>,         /* type: 1 - on demand; 2 - periodic */
                                "maxUsage": <int>,     /* count of active resources of current service */
                                "cost": <text>,         /* maximal resources count */
                                "interval": <uint>,     /* cost table */
                                "descr": <text>,        /* interval: 0 - none, 1 - hourly, 2 - daily, 3 - weekly, 4 - monthly*/
                                "flags": <uint>         
                },
                ...
}

Please go here to see services list.