Developer Center

E-Invoice Module Development

You can review and download the sample codes on GitHub.

In this document, it is explained how to create, update and synchronize invoices on the service provider with the "HOOKS" structure.

With this document, you can easily develop an add-on module for e-invoice service provider integration.

You can view the sample codes on gitHub.com

Content Map

Getting Started with Integration

In order to create the integration, you must first refer to the "ADDON" module structure and carry out the development work through the "ADDON" module. You can find the addon module development document here.

Actions applied to the invoice are captured thanks to "HOOKS". Below are detailed explanations and instructions about HOOKS.

Identifying Hook

To define hooks, you can start the catch action by adding the sample hook codes provided in the instructions below to the bottom line of your module class file.

Important Reminder:  Make sure the addon module status is "active" for the hooks to work.

Please click to review what data is in the parameter string passed to the hook.

To find out the parameters in the "$items" variable shown in the examples, you can browse the "invoices_items" table from the database.

Capture the Generated Invoice

When an invoice is created in the system, you can capture it with the following method.

Hook::add("InvoiceCreated",1,function($invoice = []){
    $items  = Invoices::get_items($invoice["id"]); // database: invoices_items
    // You can send the data obtained from the $invoice and $items variables to your API provider.
});

Capture the Updated Invoice

After the item or details of an invoice are updated, you can capture the invoice with the following method.

Hook::add("InvoiceModified",1,function($invoice = []){
    $items  = Invoices::get_items($invoice["id"]); // database: invoices_items
    // You can send the data obtained from the $invoice and $items variables to your API provider.
});

Capture the Deleted Invoice

After an invoice is deleted, you can capture the invoice with the following method.

Hook::add("InvoiceDeleted",1,function($invoice = []){
    // You can send the data obtained from the $invoice variables to your API provider.
});

Capturing a "Cancelled" Invoice

When the status of an invoice is marked as "Cancelled", you can capture it with the following method.

Hook::add("InvoiceCancelled",1,function($invoice = []){
    $items  = Invoices::get_items($invoice["id"]); // database: invoices_items
    // You can send the data obtained from the $invoice and $items variables to your API provider.
});

Capturing a "Refunded" Invoice

When the status of an invoice is marked as "Refunded", you can capture it with the following method.

Hook::add("InvoiceRefunded",1,function($invoice = []){
    $items  = Invoices::get_items($invoice["id"]); // database: invoices_items
    // You can send the data obtained from the $invoice and $items variables to your API provider.
});

Capturing a "Unpaid" Invoice

When the status of an invoice is marked as "Unpaid", you can capture it with the following method.

Hook::add("InvoiceUnpaid",1,function($invoice = []){
    $items  = Invoices::get_items($invoice["id"]); // database: invoices_items
    // You can send the data obtained from the $invoice and $items variables to your API provider.
});

Capturing a "Paid" Invoice

When the status of an invoice is marked as "Paid", you can capture it with the following method.

Hook::add("InvoicePaid",1,function($invoice = []){
    $items  = Invoices::get_items($invoice["id"]); // database: invoices_items
    // You can send the data obtained from the $invoice and $items variables to your API provider.
});

Capturing a "Formalised" Invoice

When the status of an invoice is marked as "Formalised", you can capture it with the following method.

Hook::add("InvoiceFormalized",1,function($invoice = []){
    $items  = Invoices::get_items($invoice["id"]); // database: invoices_items
    // You can send the data obtained from the $invoice and $items variables to your API provider.
});

Defining a Cronjob

You can use the following hook to formalize an invoice or define an formalised document (PDF) for an invoice via cronjob.

Hook::add("PerMinuteCronJob",1,function(){
    // Enter your code here....
});

Defining Document to Invoice

To define a document to an invoice (PDF), find the "cronjob_define_doc_file" function in the class file on the GitHub repository and use the sample codes in it.

Do you have any questions?

Feel free to contact us
Contact Us
Copyright © 2024. All Rights Reserved.
Join Our Discord Channel
Top