update_billing_plan
You can use the update_billing_plan method to create, update and delete a billing plan:
svc=account/update_billing_plan¶ms={"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>,
"enable_smtp": <text>, /* Email SMTP state */
"smtp_host": <text>, /* SMTP host */
"smtp_port": <text>, /* SMTP port */
"smtp_login": <text>, /* SMTP login */
"smtp_password": <text>, /* SMTP password */
"mapserver_tags":<text>, /* Map tags */
"hwTypes":{
"<hw_id>":
{
"name": <uint>
},
...
},
"parent": <text>,
"personal":
{
"services": <object>
}
}
}
Parameters
The request must contain the following parameters:
Parameter | Description |
---|---|
callMode | Request type (create, update, delete). |
name | Billing plan name (unique field). |
rename | New billing plan name. You can’t edit the name of the billing plan of the top account user. The names of billing plans are unique. You can’t give the same name to two billing plans. |
servicesModCounter | The number of modifications in the list of services. |
historyPeriod | Time to store unit messages, in days. |
flags | Billing plan flags (see below). |
denyBalance | Minimum balance for the account to be active. If the balance is lower, the account is blocked. |
blockBalance | Minimum balance for the paid services to be available. If the balance is lower, the services are blocked. |
minDaysCounter | Number of days left before the account is blocked. The number of days decreases if the Block by days option is enabled. |
currencyFormat | Currency format. |
descr | Billing plan description. |
Email address. |
Billing plan flags
Flag | Description |
---|---|
0x01 | Block users, if the balance is lower than the blocking threshold. |
0x02 | If the balance is lower than the minimum, the user can’t log in to the system and the account is suspended. |
0x08 | It is forbidden to use the specified hardware types. |
0x10 | It is forbidden to use the hardware types that are not specified. |
0x20 | Decrease the number of days in the day counter, and block the account when the number of remaining days reaches the minimum. |
Hardware types
Name | Description |
---|---|
<hw_name> | Hardware name. |
id | Hardware ID. |
Services
Name | Description |
---|---|
cost | Limit and cost in the format described on the Services page. |
descr | Service description. |
flags | Define action: 0 — none, 1 — create/update, 2 — delete. |
interval | Reset frequency: |
maxUsage | Amount of available items. |
name | Service name. |
type | Service type: 1 — on demand, 2 — periodic. |
For more details about services, visit the get_account_data page.
Response
If the request is completed successfully, the response looks as follows:
{
"parent":<text>, /* Parent billing plan name. */
"name":<text>, /* Billing plan name. */
"servicesModCounter":<uint>, /* Number of service modifications.*/
"historyPeriod":<uint>, /* History period to store messages, in days. If 0 is specified, the period is unlimited. */
"flags":<uint>, /* Billing plan flags. */
"denyBalance":<int>, /* The balance value at which the paid services become unavailable. */
"blockBalance":<int>, /* The balance value at which the account is blocked. */
"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> /* Service object (see below). */
},
"combined":
{
"services":{ /* Service object where keys are correct service names. */
"<service_name>":{ /* Insert service name instead of <service_name>. */
"type": <uint>, /* Type: 1 — on demand; 2 — periodic. */
"maxUsage": <int>, /* Number of active resources of the service. */
"cost": <text>, /* Maximum number of resources. */
"interval": <uint>, /* Cost table. */
"descr": <text>, /* Interval: 0 — none, 1 — hourly, 2 — daily, 3 — weekly, 4 — monthly. */
"flags": <uint>
},
...
}
}
}
For more details about services, visit the get_account_data page.