lnbits 1.0.1 copy "lnbits: ^1.0.1" to clipboard
lnbits: ^1.0.1 copied to clipboard

A Flutter package for interacting with the LNBits API. This package provides convenient methods to create, pay, check, and decode invoices, as well as getting wallet details.

LNBits Flutter Package #

pub package pub package

A Flutter package for interacting with the LNBits API. This package provides convenient methods to create, pay, check, and decode invoices, as well as getting wallet details.

Getting Started #

In your pubspec.yaml file add:

dependencies:
  lnbits: 1.0.0

Then run flutter pub get.

Usage #

First, import the package:

import 'package:lnbits/lnbits.dart';

Create an instance of LNBitsAPI:

final api = LNBitsAPI(
  url: 'https://your-lnbits-instance.com',
  adminKey: 'your-admin-key',
  invoiceKey: 'your-invoice-key',
);

Now, you can use the various methods provided:

// Get Wallet Details
final walletDetails = await api.getWalletDetails();

// Create an Invoice
// Required parameters:
// - amount: The amount of the invoice (in satoshis)
// Optional parameters:
// - memo: A memo to attach to the invoice
// - webhook: A webhook url to get response once paid
// - expiry: Enter the expiry of the invoice in seconds
final invoice = await api.createInvoice(amount: 1000, memo: 'Test');

// Pay an Invoice
// Required parameters:
// - bolt11: The invoice string in BOLT11 format
final paymentHash = await api.payInvoice(bolt11: 'invoice');

// Check an Invoice
// Required parameters:
// - paymentHash: The payment hash of the invoice to check
final isPaid = await api.checkInvoice(paymentHash: 'payment_hash');

// Decode an Invoice
// Required parameters:
// - invoice: The invoice string in BOLT11 format
final decodedInvoice = await api.decodeInvoice(invoice: 'invoice');

Issues and Feedback #

For any issues with the package or to provide feedback, please open an issue on GitHub.

License #

This project is licensed under the MIT License.

Future Developments #

  • Plugins
16
likes
140
pub points
24%
popularity

Publisher

verified publisherninjapay.me

A Flutter package for interacting with the LNBits API. This package provides convenient methods to create, pay, check, and decode invoices, as well as getting wallet details.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http

More

Packages that depend on lnbits