Get Virtualizor

Add Invoice

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

NameMethodValueDescriptionRequired
actGETaddinvoiceThe action will create an invoice and return the done as the invoice IDYes
uidPOSTtextThe uid of the user for whom the invoice is generatedYes
invodatePOSTtextThe invoice date should be of the format DD/MM/YYYYYes
duedatePOSTtextThe due date should be of the format DD/MM/YYYYYes
paydatePOSTtextThe date on which the invoice was paidNo
itemPOSTtextThe Item for which the invoice is createdYes
item_descPOSTtextDetailed Description of the itemNo
discPOSTIntThis will be deducted from the amountNo
amtPOSTIntThe invoice amountYes
tokenPOSTtextA reference to the payment transactionNo

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"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list