InvoiceNinja: Supports the public 'Storefront' routes which allow reading the list of products and creating/finding clients and invoices. Using this class works with restricted access to the account.
InvoiceNinjaAdmin: Supports the REST Admin API which uses token based security. Using this class requires an API token to access the account.
Storefront API
Configure
InvoiceNinja.configure(
'KEY', // Set your company key or use 'KEY' to test
url: 'https://demo.invoiceninja.com', // Set your selfhost app URL
debugEnabled: true,
);
Load the product list
final products = awaitInvoiceNinja.products.load();
Find the product by key
final product = awaitInvoiceNinja.products.findByKey('product_key');
Create/persist the client
var client = Client.forContact(email: 'test@example.com');
client = awaitInvoiceNinja.clients.save(client);
Create/persist the invoice
var invoice = Invoice.forClient(client, products: [product]);
invoice = awaitInvoiceNinja.invoices.save(invoice);
Consider giving issue #57536 a thumbs up to make this better in the future.
Admin API
Configure
InvoiceNinjaAdmin.configure(
'TOKEN', // Set your API token or use 'TOKEN' to test
url: 'https://demo.invoiceninja.com', // Set your selfhost app URL
debugEnabled: true,
);
Find a client by email
final client = awaitInvoiceNinjaAdmin.clients.findByEmail(email);
Load all invoices
final payments = awaitInvoiceNinjaAdmin.payments.load();
Load the payments list
final payments = awaitInvoiceNinjaAdmin.payments.load();
Find a payment by id
final payment = awaitInvoiceNinjaAdmin.payments.findById(id);