mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-18 22:34:19 +01:00
2.5 KiB
2.5 KiB
Sending Lightning Payments
Once you have outbound liquidity you can start sending payments too.
Rust
{{#include ../../snippets/rust/src/send_payment.rs:send-payment}}
Swift
do {
// 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'.
let req = SendPaymentRequest(bolt11: "...", amountMsat: 3000000)
let response = try sdk.sendPayment(req: req)
} catch {
// handle error
}
Kotlin
val bolt11 = "..."
try {
// 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'.
val amountMsat = 3000000L.toULong()
val req = SendPaymentRequest(bolt11, amountMsat)
val response = sdk.sendPayment(req)
} catch (e: Exception) {
// handle error
}
React Native
{{#include ../../snippets/react-native/send_payment.ts:send-payment}}
Dart
{{#include ../../snippets/dart_snippets/lib/send_payment.dart:send-payment}}
Python
bolt11 = "..."
try:
# 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'.
req = breez_sdk.SendPaymentRequest(bolt11=bolt11, amount_msat=3000000)
sdk_services.send_payment(req=req)
except Exception as error:
# Handle error
Go
bolt11 := "bolt11 invoice"
// 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'.
amountMsat := uint64(3000000)
sendPaymentRequest := breez_sdk.SendPaymentRequest{
Bolt11: bolt11,
AmountMsat: amountMsat,
}
if response, err := sdk.SendPayment(sendPaymentRequest); err == nil {
log.Printf("%#v", response)
}
C#
{{#include ../../snippets/csharp/SendPayment.cs:send-payment}}