Skip to content

Commit

Permalink
add more docs for pay invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
ramin committed Mar 18, 2024
1 parent b86fefb commit 8455a8e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ if err != nil {
}

fmt.Println(invoice.Serialized)

```

### Pay Invoice

```go
resp, err := client.PayInvoice(eclair.PayInvoiceRequest{
Invoice: resp.Serialized,
})
fmt.Println(resp.Message)
```

#### Watching Events

Expand Down
22 changes: 22 additions & 0 deletions examples/invoices/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,26 @@ func main() {

fmt.Println(dresp.Message)

// Create Invoice

resp, err = client.CreateInvoice(eclair.CreateInvoiceRequest{
Description: "test6",
Amount: 169420,
})

if err != nil {
fmt.Println(err)
return
}

presp, err := client.PayInvoice(eclair.PayInvoiceRequest{
Invoice: resp.Serialized,
})

if err != nil {
fmt.Println(err)
}

fmt.Println(presp.Message)

}
1 change: 0 additions & 1 deletion invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ func (c *DeleteInvoiceRequest) FormData() (io.Reader, error) {
}

func (c *Client) DeleteInvoice(settings DeleteInvoiceRequest) (*DeleteInvoiceResponse, error) {

data, err := settings.FormData()
if err != nil {
return nil, err
Expand Down

0 comments on commit 8455a8e

Please sign in to comment.