Files
breez-sdk-docs/src/guide/payments.md

2.3 KiB

Sending and receiving Lightning payments

Rust
## Receiving Lightning Payments Breez SDK doesn't require you to open a channel and set up your inbound liquidity. Breez SDK automatically connects your node to the LSP peer and you can now receive payments:
let invoice = sdk.receive_payment(3000, "Invoice for 3000 sats".into()).await?;

Sending Lightning Payments

let bolt11 = "...";
sdk.send_payment(bolt11.into(), Some(3000)).await?;

Sending Spontaneous Lightning Payments

let node_id = "...";
sdk.send_payment(node_id.into(), Some(3000)).await?;
Swift
## Receiving Lightning Payments Breez SDK doesn't require you to open a channel and set up your inbound liquidity. Breez SDK automatically connects your node to the LSP peer and you can now receive payments:
do {
  let invoice = try sdk.receivePayment(amountSats: 3000, description: "Invoice for 3000 sats")
} catch SdkError.Error(let message) {
  print(message)
}

Sending Lightning Payments

let bolt11 = "...";
do {
  let payment = try sdk.sendPayment(bolt11: bolt11, amountSats: 3000)
} catch SdkError.Error(let message) {
  print(message)
}

Sending Spontaneous Lightning Payments

let nodeId = "...";
do {
  let payment = try sdk.sendSpontaneousPayment(nodeId: nodeId, amountSats: 3000)
} catch SdkError.Error(let message) {
  print(message)
}
React Native
## Receiving Lightning Payments Breez SDK doesn't require you to open a channel and set up your inbound liquidity. Breez SDK automatically connects your node to the LSP peer and you can now receive payments:
try {
    const invoice = await receivePayment(3000, "Invoice for 3000 sats")
} catch (error) {
    console.log(error)
}

Sending Lightning Payments

const bolt11 = "...";
try {
    const payment = await sendPayment(bolt11, 3000)
} catch (error) {
    console.log(error)
}

Sending Spontaneous Lightning Payments

const nodeId = "...";
try {
    const payment = await sendSpontaneousPayment(nodeId, 3000)
} catch (error) {
    console.log(error)
}