Get invoice

Recover a specific invoice


Endpoint


Method URI
POST https://apiv2.keliweb.it/api/v2/keliweb/get-invoice

Request Parameters


Parameter Type Description Required
HTTP headers: Authorization string Bearer + the token to access APIs Required
invoiceid integer The ID of the invoice to retrieve Required

Response Parameters


Parameter Type Description
result string The result of the operation: success or error
invoiceid integer The id of the invoice
invoicenum string The Sequential Invoice Number assigned (if enabled)
userid integer The id of the user owning this invoice
date date The date of the invoice YYYY-MM-DD
duedate date The due date of the invoice YYYY-MM-DD
datepaid date The date the invoice was paid YYYY-MM-DD HH:ii:ss
subtotal float The subtotal on the invoice
credit float The amount of credit assigned to the invoice
tax float The amount of first level tax charged on the invoice
tax2 float The amount of second level tax charged on the invoice
total float The total of the invoice
balance float The amount left to pay on the invoice
taxrate float The rate of the first level tax
taxrate2 float The rate of the second level tax
status string The status of the invoice
paymentmethod string The payment method on the invoice in system format
notes string The notes associated with the invoice
ccgateway boolean Is the payment method associated with the invoice a CC Gateway
items array The items on the invoice
transactions array The transactions on the invoice

Example Request (PHP Curl)

            

                    $curl = curl_init();
                    
                    curl_setopt_array($curl, array(
                      CURLOPT_URL => "https://apiv2.keliweb.it/api/v2/keliweb/get-invoice",
                      CURLOPT_RETURNTRANSFER => true,
                      CURLOPT_ENCODING => "",
                      CURLOPT_MAXREDIRS => 10,
                      CURLOPT_TIMEOUT => 0,
                      CURLOPT_FOLLOWLOCATION => false,
                      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                      CURLOPT_CUSTOMREQUEST => "POST",
                      CURLOPT_POSTFIELDS =>
                        http_build_query(
                                array(
                                    'invoiceid' => '1',
                                )
                            ),
                      CURLOPT_HTTPHEADER => array(
                        "Content-Type: multipart/form-data",
                        "X-Requested-With: XMLHttpRequest",
                        "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NhMmNlNkNjNhMmU2MmUxIzZDRkODY5MS1mMDMzLTQ1MWMtYjU-3EHc",
                      ),
                    ));
                    
                    $response = curl_exec($curl);
                    $err = curl_error($curl);
                    
                    curl_close($curl);
                    
                    if ($err) {
                      echo "cURL Error #:" . $err;
                    } else {
                      echo $response;
                    }

            
        

Example Request (jQuery AJAX)

            
                    var form = new FormData();
                    form.append("invoiceid", "1");

                    var settings = {
                        "async": true,
                        "crossDomain": true,
                        "url": "https://apiv2.keliweb.it/api/v2/keliweb/get-invoice",
                        "method": "POST",
                        "headers": {
                            "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImNjMDEwYWVlYmUzMjMxMmZlZjBiNzRjYTBhMmNlNDc2MjNjNhMMTA1MzJjODk1In0",
                            "cache-control": "no-cache",
                        },
                        "processData": false,
                        "contentType": false,
                        "mimeType": "multipart/form-data",
                        "data": form
                    }

                    $.ajax(settings).done(function (response) {
                        console.log(response);
                    });
            
        

Example Response (JSON payload)

            
                    {
                        "result"                     : "success",
                        "invoiceid"                  : "1",
                        "invoicenum"                 : "",
                        "userid"                     : "2361",
                        "date"                       : "2016-01-01",
                        "duedate"                    : "2016-01-08",
                        "datepaid"                   : "0000-00-00 00:00:00",
                        "subtotal"                   : "15.95",
                        "credit"                     : "0.00",
                        "tax"                        : "0.00",
                        "tax2"                       : "0.00",
                        "total"                      : "15.95",
                        "balance"                    : "15.95",
                        "taxrate"                    : "0.00",
                        "taxrate2"                   : "0.00",
                        "status"                     : "Unpaid",
                        "paymentmethod"              : "paypal",
                        "notes"                      : "",
                        "ccgateway"                  : "",
                        "items[item][0][id]"         : "1",
                        "items[item][0][type]"       : "Hosting",
                        "items[item][0][relid]"      : "1",
                        "items[item][0][description]": "Sample Monthly Product (01\/01\/2016 - 31\/01\/2016)",
                        "items[item][0][amount]"     : "15.95",
                        "items[item][0][taxed]"      : "0",
                        "transactions"               : ""
                    }