Skip to content
Merged
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions 47.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,88 @@ Response:
}
```

### `make_hold_invoice`

Creates a hold invoice using a pre-generated preimage.

Request:
```jsonc
{
"method": "make_hold_invoice",
"params": {
"amount": 123, // value in msats
"description": "string", // invoice's description, optional
"description_hash": "string", // invoice's description hash, optional
"expiry": 213 // expiry in seconds from time invoice is created
Comment thread
frnandu marked this conversation as resolved.
Outdated
"payment_hash": "string" // Payment hash for the payment generated from the preimage
Comment thread
frnandu marked this conversation as resolved.
}
}
```
Comment thread
frnandu marked this conversation as resolved.

Response:
```jsonc
{
"result_type": "make_hold_invoice",
"result": {
"type": "incoming", // "incoming" for invoices, "outgoing" for payments
"invoice": "string", // encoded invoice, optional
"description": "string", // invoice's description, optional
"description_hash": "string", // invoice's description hash, optional
"payment_hash": "string", // Payment hash for the payment
"amount": 123, // value in msats
"created_at": unixtimestamp, // invoice/payment creation time
"expires_at": unixtimestamp, // invoice expiration time, optional if not applicable
Comment thread
frnandu marked this conversation as resolved.
"metadata": {} // generic metadata that can be used to add things like zap/boostagram details for a payer name/comment/etc.
}
}
```

### `cancel_hold_invoice`

Cancels a hold invoice using the payment hash

Request:
```jsonc
{
"method": "cancel_hold_invoice",
"params": {
"payment_hash": "string" // Payment hash for the payment generated from the preimage
}
}
```

Response:
```jsonc
{
"result_type": "cancel_hold_invoice",
"result": {}
}
```

### `settle_hold_invoice`

Settles a hold invoice using the preimage


Request:
```jsonc
{
"method": "settle_hold_invoice",
"params": {
"preimage": "string" // preimage for the payment
}
}
```

Response:
```jsonc
{
"result_type": "settle_hold_invoice",
"result": {}
}
```


## Notifications

### `payment_received`
Expand Down Expand Up @@ -492,6 +574,29 @@ Notification:
}
```

### `hold_invoice_accepted`

Description: Sent when a payer accepts (locks in) a hold invoice.
Comment thread
frnandu marked this conversation as resolved.
Outdated

Notification:
```jsonc
{
"notification_type": "hold_invoice_accepted",
"notification": {
"type": "incoming",
Comment thread
frnandu marked this conversation as resolved.
"invoice": "string", // encoded invoice
"description": "string", // invoice's description, optional
"description_hash": "string", // invoice's description hash, optional
"payment_hash": "string", // Payment hash for the payment
"amount": 123, // value in msats
"created_at": unixtimestamp, // invoice/payment creation time
"expires_at": unixtimestamp, // invoice expiration time, optional if not applicable
Comment thread
frnandu marked this conversation as resolved.
Outdated
"settled_at": unixtimestamp, // invoice/payment settlement time
Comment thread
frnandu marked this conversation as resolved.
Outdated
Comment thread
frnandu marked this conversation as resolved.
Outdated
"metadata": {} // generic metadata that can be used to add things like zap/boostagram details for a payer name/comment/etc.
}
}
```

Comment thread
frnandu marked this conversation as resolved.
## Example pay invoice flow

0. The user scans the QR code generated by the **wallet service** with their **client** application, they follow a `nostr+walletconnect://` deeplink or configure the connection details manually.
Expand Down Expand Up @@ -522,3 +627,14 @@ This NIP does not specify any requirements on the type of relays used. However,
"sig": "31f57b369459b5306a5353aa9e03be7fbde169bc881c3233625605dd12f53548179def16b9fe1137e6465d7e4d5bb27ce81fd6e75908c46b06269f4233c845d8"
}
```

### Example Hold Invoice Support Flow

1. Client generates a 32-byte hex-encoded preimage.
2. Computes SHA-256 to derive payment hash.
3. Sends `make_hold_invoice` with payment hash and desired parameters.
4. Waits for `hold_invoice_accepted` notification.
5. Upon receiving notification, either:

* Calls `settle_hold_invoice` with the original preimage to release funds, or
* Calls `cancel_hold_invoice` with payment hash to abort.