The List Invoice API to allows you to list the invoices of the user generated by the admin. The API response contains the list of the invoice details, which are listed according to their IDs. To filter or limit the size of the list, you can specify one or more query parameters.
HTTP Request
https://hostname:4085/index.php?act=invoices
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | invoices | The action will list all the invoices | Yes |
page | GET | Int | If not specified, then only first 50 records are returned | No |
reslen | GET | Int | Number of records to be returned, default is 50 | No |
invoid | POST | Int | Filter list using the invoice ID | No |
uid | POST | Int | Filter the list using the user ID | No |
POST | text | Filter the list using the user Email | No | |
item | POST | text | Filter the list using the item name | No |
paydate | POST | text | Filter the list using the paydate in the format YYYY/MM/DD | No |
invodate | POST | text | Filter the list using the invoice date in the format YYYY/MM/DD | No |
duedate | POST | text | Filter the list using the due date in the format YYYY/MM/DD | 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);
$page = 1;
$reslen = 20;
$post = array();
$post['invoid'] = '';
$post['uid'] = ''; // use uid or email
$post['email'] = '';
$post['item'] = '';
$post['paydate'] = '';
$post['invodate'] = '';
$post['duedate'] = '';
$output = $admin->listinvoice($page, $reslen, $post);
print_r(json_encode($output));
?>
Output
{
"title": "Invoices",
"invoices": {
"3": {
"invoid": "3",
"invonum": "3",
"invodate": "19950118",
"invotime": "790387200",
"duedate": "19990118",
"uid": "57",
"paydate": "0",
"paytime": "0",
"item": "xyxsss",
"additional_desc": null,
"item_desc": "",
"amt": "1005550.00",
"disc": "0.00",
"additional_disc": "0.00",
"net": "1005550.00",
"token": "",
"cancelled": "0",
"email": "samplemail@gmail.com",
"status": "unpaid",
"status_txt": null
}
},
"timenow": 1537272991,
"time_taken": "0.215"
}