mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
Add Go snippets
This commit is contained in:
committed by
Erdem Yerebasmaz
parent
f65bcc1653
commit
dc64895b65
23
snippets/go/send_payment.go
Normal file
23
snippets/go/send_payment.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/breez/breez-sdk-go/breez_sdk"
|
||||
)
|
||||
|
||||
func SendPayment() {
|
||||
// ANCHOR: send-payment
|
||||
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(3_000_000)
|
||||
sendPaymentRequest := breez_sdk.SendPaymentRequest{
|
||||
Bolt11: bolt11,
|
||||
AmountMsat: &amountMsat,
|
||||
}
|
||||
if response, err := sdk.SendPayment(sendPaymentRequest); err == nil {
|
||||
log.Printf("%#v", response)
|
||||
}
|
||||
// ANCHOR_END: send-payment
|
||||
}
|
||||
Reference in New Issue
Block a user