For billing to work, you need to upload the JSON file to the Ajax billing server. The file should have a specific name and should be filled in according to the requirements of the instruction. Otherwise, the billing service will not work.
How to choose the file format and the file name?
The file to be uploaded should:
- Be in JSON format.
- Be named in the time stamp format (file creation date). Record format: yyyy-mm-dd-hh-mm-ss.json.
- Be written in UTF-8 encoding.
How to fill in the file to be uploaded?
The structure of the JSON file to be uploaded:
[
{
"hubId": "0000AF49",
"subscriptionFee": "300",
"balance": "300",
"currency": "UAH",
"blocked": "false",
"paymentDate": "2019-12-31"
},
{
….
}
]
[/gray_block]
Table of field values:
Field name | Description | Value |
hubId |
Hub ID. Can be found in the Ajax app under the hub properties, as well as on the hub body under the SmartBracket mount. |
8-character HEX value For example: 0000AF49 |
subscriptionFee | Customer’s monthly payment |
Positive integers or fractional numbers. Fractional numbers are written with two decimal places using decimal point. For example: 1560.50 |
balance | Current customer’s account balance |
Positive, negative, integer or fractional numbers. Fractional numbers are written with two decimal places using decimal point. For example: -1560.50 |
blocked | Request to lock / unlock the customer hub | Boolean data type: true or false. |
currency | Type of currency to pay for the services | Record format: UAH |
paymentDate | Date of the next regular service payment by the customer. |
Date in ISO 8601 format (yyyy-mm-dd) For example: 2019-12-31 |
All the fields of JSON file must be filled in! Otherwise, the billing service will not work.
JSON file example: 2019-12-23-15-43-37
How to upload the file to the Ajax billing server?
The upload takes place in two stages:
- User authentication on the Ajax billing server
- Uploading the file to the billing server
How to authenticate on the Ajax billing server
To upload a JSON file, you should authenticate using the private part of the SSH key that was used when connecting the billing service.
This can be done via the command line or using FTP clients (for example, FileZilla).
The format of a command to be sent:
sftp -i ssh_path [email protected]
Explanation:
- sftp -i — constant part indicating connection to the billing server
- ssh_path — path to the private part of the SSH key
- user_login — user login that you received when connecting the billing
- @sftp.ajax.systems — server address (endpoint) to be authorized at.
Example of a command to be sent: sftp -i C:\ssh_key [email protected]
How to upload the file to the Ajax billing server?
After successful authentication, you need to upload the JSON file to the Ajax billing server. This can be done via the command line or using FTP clients (for example, FileZilla).
The format of a command to be sent:
put json_path
Explanation:
- put — command to upload the file to the billing server
- json_path — path to the json file being uploaded.
Example of a command to be sent: put C:\clients.json
In case of connection via the command line, after successful connection a message will be displayed on the screen: sftp>. After that enter the command: put json_path.