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 this API which would appear in the enduser panel as "paid".
The API response will contain "done" as "1" after successful creation of the invoice.
HTTP Request
https://hostname:4085/index.php?act=addinvoice
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | addinvoice | The action will create an invoice and return the done as the invoice ID | 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['uid'] = 57 ;
$post['invodate'] = '18/01/1991';
$post['duedate'] = '18/01/1991';
$post['item'] = 'xyx';
$post['amt'] = 1000 ;
$output = $admin->addinvoice($post);
print_r(json_encode($output));
?>
Output
{
"title": "Create Invoice",
"done": "1",
"timenow": 1537214765,
"time_taken": "0.253"
}