invoice

Invoice Generator API

"Customers don't measure you on how hard you tried. They measure you on what you deliver."

An invoice API is a set of programming instructions and standards that allow developers to interact with and create invoices within a software application. Invoice APIs can be used by businesses to automate their invoicing process, improve accuracy, and save time and effort.

With an invoice API, developers can integrate invoicing functionality directly into their applications, allowing users to create, manage, and send invoices seamlessly from within the software. An invoice API may include features such as creating and editing invoices, generating and sending invoices via email, tracking invoice status and payment information, and generating reports and analytics on invoicing data.

Invoice APIs can be useful for a variety of businesses, including freelancers, small businesses, and large enterprises. They can be used in a variety of industries, such as e-commerce, finance, and accounting.

Invoice API Features

  • Create invoices: This API allow you to create invoices programmatically with all the necessary details, such as invoice number, client details, line items, and tax information.
  • Customizable templates: This API allow you to customize the invoice templates, including the layout, design, and branding.
  • Multicurrency support: This API support multiple currencies for international invoicing.
  • Barcode attached: This API support barcode attachment on top of every invoice for billing tracking purpose for invoicing.
  • Reporting: This API provide reporting functionality, including generating reports on invoices, payments, and other billing-related data.

Some common benefits of using an invoice API include increased efficiency and productivity, improved accuracy, reduced administrative workload, faster payment processing, and enhanced customer satisfaction. By automating the invoicing process, businesses can free up valuable time and resources that can be directed towards other important tasks.

Your API Authentication Key

We use API keys to authenticate all the requests. You can view and manage your API keys in the My Account -> My APIs Center page. Your API keys can be used to access our all the APIs, So be sure to keep them secure. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

                                                    
                                                        XXXX-XXXX-XXXX-XXXX (login to see your free API Key) 
                                                    
                                                
Signup and activate free trial plan to try our APIs. See Trial Plan.

API Base URL and Endpoints

The API Base URL serves as the foundation or root of the API's endpoints. It represents the common prefix shared by all API endpoints. An Endpoint URL represents a specific operation or resource provided by the API. It is appended to the API Base URL to form a complete URL for a particular API call.


Base URL:

                                                
                                                    https://zerosack.org/marketplace/apis/v1 
                                                
                                            

Endpoint to generate invoice:

                                                
                                                    POST /invoice 
                                                
                                            

API Request Method POST

This API use POST HTTP method to get data from our server. All API requests must be made over HTTPS ("S" stands for secure). Calls made over plain HTTP or without authentication key will not allowed.

Request Parameters

In APIs, request parameters are values that are sent along with an API request to provide additional information or data necessary for the server to process the request correctly. These parameters are part of the URL, the request headers, or the request body, depending on the API design and the HTTP method used.

Parameter Description
key
required
This is your authentication api key to get requested data from our servers. This is mandatory parameter otherwise data request will be failed. Go to API Key.
invoice_from
required
Name, Address, and contact details of a biller company or business (in json format). See format.
invoice_to
required
Name, Address, and contact details of a buyer person or business (in json format). See format.
invoice_number
required
Invoice identification number. QR code will be generated based on this number. Eg: IN0001234.
invoice_date
required
Invoicing date as per your records. Eg: January 15, 2023.
invoice_items
required
Product or service name, price, and quantity (Array of objects). See format.
amount_paid
required
Any priory amount paid by the buyer to biller. Possible values Eg: 0 or 1250.
currency
required
Invoice currency code and currency symbol. Eg: INR | $. See format.
tax_title
required
Tax title name. Eg: GST | VAT.
tax_percent
required
Tax percent value. Eg: 18.
logo
optional
Company or biller logo URL. Only PNG or JPG image allowed. Eg: https://example.com/url-to-logo.png.
note
optional
Any note you want to write in to invoice. Eg: Thank you being awesome client.
terms
optional
Payment or invoice terms and conditions. Eg: Payment due in 30 days or Bank details for wire transfer.
watermark
optional
Any watermark in text format. Eg: ZNPL | Paid.

Example Post Data Request (in Json format)

                                                    
                                                    {
    "key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
    "invoice_from": {
        "biller_name": "Zerosack Networks Pvt. Ltd.",
        "biller_address": "304 Street Name, Landmark Road, \n City, Area Code, State, Country",
        "biller_contact": "Mobile: +91-8888-8888-88 \n Email: xyz@gmail.com"
    },
    "invoice_to": {
        "buyer_name": "John Doe",
        "buyer_address": "304 Street Name, Landmark Road, \n City, Area Code, State, Country",
        "buyer_contact": "Mobile: +91-8888-8888-88 \n Email: xyz@gmail.com"
    },
    "invoice_number": "IN0001234",
    "invoice_date": "January 15, 2023",
    "invoice_items": [
        {
            "item_no": "1",
            "item_name": "product or service name-1 in which purpose this invoice created \n (order\/service ID #123)",
            "item_qty": "2",
            "item_unit_price": "150"
        },
        {
            "item_no": "2",
            "item_name": "product or service name-2 in which purpose this invoice created \n (order\/service ID #123)",
            "item_qty": "1",
            "item_unit_price": "450"
        }
    ],
    "amount_paid": "0",
    "currency": {
        "currency_code": "USD",
        "currency_symbol": "$"
    },
    "tax_title": "GST",
    "tax_percent": "18",
    "logo": "https:\/\/example.com\/url-to-logo.png",
    "note": "Thank you being awesome client",
    "terms": "Payment due in 30 days",
    "watermark": "ZNPL"
} 
                                                    
                                                

Response Format

API response format refers to the format in which data is returned from an API endpoint after a request is made. We use JSON format for API response data. JSON (JavaScript Object Notation): JSON is a lightweight data interchange format that is easy to read and write. It is widely used for API response data because it is easy to parse and manipulate in many programming languages.

Example Response

Sample invoice PDF file (if success)

Download Sample Invoice

Below response data in JSON format with base64 string data for invoice PDF file. You can convert this base64 string into PDF file using any language (like: JavaScript, PHP, Etc.), and save it to your server or download it directly into your project.

                                                    
                                                        {
                                                            "status": 1,
                                                            "status_message": "success",
                                                            "body": {
                                                                "base64_string": "JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYXJlbnQgMS ....."
                                                            }
                                                        } 
                                                    
                                                

In this effective response, the variable "base64_string" represents an invoice PDF file encoded in base64 string format. In a successful scenario "status" : 1, a single API credit call/request is deducted from your account. However, in the event of failure or any other condition, you will receive a "status" : 0, and in such cases, no API credit calls/requests will be counted against your account.

Sample Code

You can use our api with any programming language as well which can handle http GET requests. Here are some sample code snippets for making a GET request to an API endpoint in multiple programming languages:

JavaScript PHP Python C#
                                                            
                                                                
                                                                    var myHeaders = new Headers();
                                                                    myHeaders.append("Content-Type", "application/json");

                                                                    var postData = JSON.stringify({
                                                                        "key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
                                                                        ...,
                                                                        ...
                                                                    });

                                                                    var requestOptions = {
                                                                        method: "POST",
                                                                        headers: myHeaders,
                                                                        body: postData
                                                                    };

                                                                    fetch("https://zerosack.org/marketplace/apis/v1/invoice", requestOptions)
                                                                    .then(response => response.json())
                                                                    .then(result => console.log(result))
                                                                    .catch(error => console.log("error", error));
                                                                 
                                                            
                                                        
                                                            
                                                                
                                                                    $curl = curl_init();

                                                                    $postData = json_encode(
                                                                        [
                                                                            "key" => "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)", 
                                                                            ...,
                                                                            ... 
                                                                         ]
                                                                    );
                                                                    
                                                                    curl_setopt_array($curl, array(
                                                                    CURLOPT_URL => "https://zerosack.org/marketplace/apis/v1/invoice",
                                                                    CURLOPT_RETURNTRANSFER => true,
                                                                    CURLOPT_CUSTOMREQUEST => "POST",
                                                                    CURLOPT_POSTFIELDS => $postData,
                                                                    CURLOPT_HTTPHEADER => array("Content-Type: application/json"),
                                                                    ));
                                                                    
                                                                    $response = curl_exec($curl);
                                                                    
                                                                    curl_close($curl);
                                                                    echo $response;
                                                                 
                                                            
                                                        
                                                            
                                                                
                                                                    import requests
                                                                    import json
                                                                    
                                                                    url = "https://zerosack.org/marketplace/apis/v1/invoice"
                                                                    
                                                                    payload = json.dumps({
                                                                        "key": "XXXX-XXXX-XXXX-XXXX (login to see your free API Key)",
                                                                        ...,
                                                                        ...
                                                                    })
                                                                    
                                                                    headers = {"Content-Type": "application/json"}
                                                                    
                                                                    response = requests.request("POST", url, headers=headers, data=payload)
                                                                    
                                                                    print(response.text)
                                                                 
                                                            
                                                        
                                                            
                                                                
                                                                    var client = new HttpClient();
                                                                    var request = new HttpRequestMessage(HttpMethod.Post, "https://zerosack.org/marketplace/apis/v1/invoice");
                                                                    request.Headers.Add("Cookie", "PHPSESSID=st6pbm0imcng6n3k8ju6pvg3j3");
                                                                    var content = new StringContent("{\r\n    \"key\": \"XXXX-XXXX-XXXX-XXXX (login to see your free API Key)\",\r\n    ...,      ...}", null, "application/json");
                                                                    request.Content = content;
                                                                    var response = await client.SendAsync(request);
                                                                    response.EnsureSuccessStatusCode();
                                                                    Console.WriteLine(await response.Content.ReadAsStringAsync());                                                                                                                                
                                                                 
                                                            
                                                        

Also you can use Postman platform which enables you to create mock servers to assist with API development and testing. A mock server simulates the behavior of a real API server by accepting requests and returning responses. By adding a mock server to your collection and adding examples to your requests, you can simulate the behavior of a real API.

Do you Need Help? Contact us.

Disclaimers: This APIs is provided "as is" without warranty of any kind. If you have issue / feedback / bug report regarding the same, You can reach out to us.