invoiceninja

Last updated:

0 purchases

invoiceninja Image
invoiceninja Images
Add to Cart

Description:

invoiceninja

Invoice Ninja #
Create PDF invoices and accept payments in a Flutter app



YouTube Video #

Features #

Accept online payment in mobile, web and desktop Flutter apps
Supports many payment gateways including Stripe, PayPal and more
Create professional PDF invoices
Includes a self-service client portal
Many more features...

Installing #
dependencies:
invoiceninja: ^0.0.10
copied to clipboard
Import #
import 'package:invoiceninja/invoiceninja.dart';
copied to clipboard
The package provides two main classes:

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,
);
copied to clipboard
Load the product list #
final products = await InvoiceNinja.products.load();
copied to clipboard
Find the product by key #
final product = await InvoiceNinja.products.findByKey('product_key');
copied to clipboard
Create/persist the client #
var client = Client.forContact(email: '[email protected]');
client = await InvoiceNinja.clients.save(client);
copied to clipboard
Create/persist the invoice #
var invoice = Invoice.forClient(client, products: [product]);
invoice = await InvoiceNinja.invoices.save(invoice);
copied to clipboard
Display the PDF invoice #
launch(
'https://docs.google.com/gview?embedded=true&url=${invoice.pdfUrl}',
forceWebView: true,
);
copied to clipboard
Accept the payment #
var invoiceKey = invoice.key;
launch(invoice.url);

// ...

final invoice = await InvoiceNinja.invoices.findByKey(invoiceKey);
if (invoice.isPaid) {
// ...
}
copied to clipboard
You can use the WidgetsBindingObserver interface to run code when the app is resumed.
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,
);
copied to clipboard
Find a client by email #
final client = await InvoiceNinjaAdmin.clients.findByEmail(email);
copied to clipboard
Load all invoices #
final payments = await InvoiceNinjaAdmin.payments.load();
copied to clipboard
Load the payments list #
final payments = await InvoiceNinjaAdmin.payments.load();
copied to clipboard
Find a payment by id #
final payment = await InvoiceNinjaAdmin.payments.findById(id);
copied to clipboard
Create/persist an invoice and auto-bill it #
var invoice = Invoice.forClient(client, products: [product]);
invoice = await InvoiceNinjaAdmin.invoices.save(invoice, action: InvoiceAction.autoBill);
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.