invoiceninja 0.0.1 invoiceninja: ^0.0.1 copied to clipboard
A Dart package to integrate with Invoice Ninja
Invoice Ninja #
This package provides a simple way to charge for features/products in a Flutter app
Features #
- Accept online payment in mobile, web and desktop Flutter apps
- Supports many payment gateways including Stripe, PayPal and Authorize.net
- Easily create professional PDF invoices
- Includes a self-service client portal
- Many more features...
Note: the package requires the new v5 version of the app [Demo | More info]
Installing #
dependencies:
invoiceninja: ^0.0.1
Import #
import 'package:invoiceninja/invoiceninja.dart';
Configure #
InvoiceNinja.configure(
'demo',
url: 'demo.invoiceninja.com',
debugEnabled: true,
);
Load the product list #
final products = await InvoiceNinja.products.load();
Find the product by key #
final product = await InvoiceNinja.products.findByKey('product_key');
Create the client #
var client = Client.forContact(email: 'test@example.com');
client = await InvoiceNinja.clients.save(client);
Create the invoice #
var invoice = Invoice.forClient(client, products: [product]);
invoice = await InvoiceNinja.invoices.save(invoice);
Display the PDF #
launch(
'https://docs.google.com/gview?embedded=true&url=${invoice.pdfUrl}',
forceWebView: true,
);
Accept the payment #
var invoiceKey = invoice.key;
launch(invoice.url);
// ...
final invoice = await InvoiceNinja.invoices.findByKey(invoiceKey);
if (invoice.isPaid) {
// ...
}
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.