diff --git a/snippets/dart_snippets/lib/send_payment.dart b/snippets/dart_snippets/lib/send_payment.dart index 7735440..869a716 100644 --- a/snippets/dart_snippets/lib/send_payment.dart +++ b/snippets/dart_snippets/lib/send_payment.dart @@ -1,9 +1,11 @@ import 'package:breez_sdk/breez_sdk.dart'; import 'package:breez_sdk/bridge_generated.dart'; -Future buyBitcoin({required String bolt11}) async { +Future sendPayment({required String bolt11}) async { // ANCHOR: send-payment - SendPaymentRequest req = SendPaymentRequest(bolt11: bolt11); + // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. + SendPaymentRequest req = SendPaymentRequest(bolt11: bolt11, amountMsat: 3000000); SendPaymentResponse resp = await BreezSDK().sendPayment(req: req); // ANCHOR_END: send-payment return resp; diff --git a/snippets/react-native/send_payment.ts b/snippets/react-native/send_payment.ts index 6a00110..2a86cbe 100644 --- a/snippets/react-native/send_payment.ts +++ b/snippets/react-native/send_payment.ts @@ -2,11 +2,9 @@ import { sendPayment } from "@breeztech/react-native-breez-sdk" const exampleSendLightningPayment = async () => { // ANCHOR: send-payment - const bolt11 = "..." - - const sendPaymentResponse = await sendPayment({ - bolt11, - amountMsat: 3000000 - }) + // The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amountMsat is required in case an amount is not specified in the bolt11 invoice'. + const amountMsat = 3000000 + const response = await sendPayment({bolt11, amountMsat}) // ANCHOR_END: send-payment } diff --git a/snippets/rust/src/send_payment.rs b/snippets/rust/src/send_payment.rs index c681ebe..051dac7 100644 --- a/snippets/rust/src/send_payment.rs +++ b/snippets/rust/src/send_payment.rs @@ -5,12 +5,14 @@ use breez_sdk_core::*; async fn send_payment(sdk: Arc) -> Result<()> { // ANCHOR: send-payment - let bolt11 = "...".into(); - - sdk.send_payment(SendPaymentRequest { - bolt11, - amount_msat: None - }).await?; + // The `amount_msat` param is optional and should only passed if the bolt11 doesn't specify an amount. + // The amount_msat is required in case an amount is not specified in the bolt11 invoice'. + let amount_msat: Option = None; + let req = SendPaymentRequest { + bolt11: "...".into(), + amount_msat, + }; + let response = sdk.send_payment(req).await?; // ANCHOR_END: send-payment Ok(())