Invoices are generated automatically for the user whose billing is enabled, as per the billing cycle.
In the event of any adhoc payment from the user, the admin can generate an invoice for that payment using the Add Invoice API which would appear in the enduser panel as "paid".
Use the Edit Invoice API, for editing the invoices generated by the admin.
The API response will contain "done" as the id of the invoice after successful update of the invoice.
HTTP Request
https://hostname:4085/index.php?act=editinvoice
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | editinvoice | The action will edit the invoice and return the done as the invoice ID | Yes |
invoid | POST | Int | The ID of the invoice | Yes |
uid | POST | text | The uid of the user for whom the invoice is generated | Yes |
invodate | POST | text | The invoice date should be of the format DD/MM/YYYY | Yes |
duedate | POST | text | The due date should be of the format DD/MM/YYYY | Yes |
paydate | POST | text | The date on which the invoice was paid | No |
item | POST | text | The Item for which the invoice is created | Yes |
item_desc | POST | text | Detailed Description of the item | No |
disc | POST | Int | This will be deducted from the amount | No |
amt | POST | Int | The invoice amount | Yes |
token | POST | text | A reference to the payment transaction | No |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$post = array();
$post['invoid'] = 3;
$post['uid'] = 57;
$post['invodate'] = '18/01/1995';
$post['duedate'] = '18/01/1999';
$post['item'] = 'xyxsss';
$post['amt'] = 1005550;
$output = $admin->editinvoice($post);
print_r(json_encode($output));
?>
Output
{
"title": "Edit Invoice",
"done": 3,
"users": {
"57": {
"uid": "57",
"email": "samplemail@gmail.com"
},
"61": {
"uid": "61",
"email": "samplemail@gsmail.com"
},
"60": {
"uid": "60",
"email": "test_email@gmail.co"
},
"55": {
"uid": "55",
"email": "tt@rrr.com"
}
},
"invoice": {
"invoid": "3",
"invonum": "3",
"invodate": "19950118",
"invotime": "790387200",
"duedate": "19990118",
"uid": "57",
"paydate": "0",
"paytime": "0",
"item": "xyxss",
"additional_desc": null,
"item_desc": "",
"amt": "1000.00",
"disc": "0.00",
"additional_disc": "0.00",
"net": "1000.00",
"token": "",
"cancelled": "0"
},
"timenow": 1537271956,
"time_taken": "0.222"
}