Get Virtualizor

Edit 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 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

NameMethodValueDescriptionRequired
actGETeditinvoiceThe action will edit the invoice and return the done as the invoice IDYes
invoidPOSTIntThe ID of the invoiceYes
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['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"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list