Skip to content

lnpay/lnpay-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lnpay

Golang API wrapper for https://lnpay.co/.

Install

go get github.com/lnpay/lnpay-go

Usage

lnpaySecretKey := lnpay.TEST_KEY
// use your key here: "sak_..."
// you can find it at https://lnpay.co/developers/dashboard

client := lnpay.NewClient(lnpaySecretKey)
wallet, _ := client.CreateWallet("first wallet")

lntx, _ := wallet.Invoice(lnpay.InvoiceParams{
    Memo: "wallet funding",
    NumSatoshis: 1000,
    PassThru: map[string]interface{}{
        "useless_data": 123,
    },
})

fmt.Printf("created invoice with lntx_id %s and payment hash %s.\n", lntx.ID, lntx.RHashDecoded)

details, _ := wallet.Details()
fmt.Printf("wallet %s (%s) has a balance of %d satoshis.\n", details.ID, details.UserLabel, details.Balance)

wtx, _ := wallet.Pay(PayParams{PaymentRequest: "lnbc1..."})
fmt.Printf("sent payment of %d satoshis to node %s.\n", wtx.NumSatoshis, wtx.LnTx.DestPubKey)

About

A library that talks to the LNPay.co Golang API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages