Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Receiving Lightning payments API docs

With the Breez SDK you aren't required to open a channel and set up your inbound liquidity. The Breez SDK automatically connects your node to the LSP peer and you can now receive payments.

Rust
let receive_payment_response = sdk .receive_payment(ReceivePaymentRequest { amount_msat: 3_000_000, description: "Invoice for 3000 sats".into(), ..Default::default() }) .await?; let invoice = receive_payment_response.ln_invoice;
Swift
Kotlin
React Native
Dart
Python
Go
C#

Developer note

Consider implementing the Notification Plugin when using the Breez SDK in a mobile application. By registering a webhook the application can receive a payment notification to process the payment in the background.

Calculating fees API docs

When the amount to be received exceeds the inbound liquidity of the node, a new channel will be opened by the LSP in order for the node to receive it. This can checked by retrieving the NodeState from the SDK and comparing the inbound liquidity to the amount to be received. If the amount is greater or equal to the inbound liquidity, a new channel opening is required.

To calculate the fees for a channel being opened by the LSP:

Rust
let channel_fees = sdk .open_channel_fee(OpenChannelFeeRequest { amount_msat, expiry: None, }) .await?;
Swift
Kotlin
React Native
Dart
Python
Go
C#