ElementsProject / ElementsProject/lightning

[Feature Request] Add payer_offer to fetchinvoice

Open
#7,741 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
3.1k
Forks
1k
Avg merge
4d 10h
Merged PRs (30d)
13

Description

When a client is paying a qr-code of an offer, give the client the possibility to include/send an offer for any amount. This allows the service to pay/refund to the client's wallet directly, without further client-service interaction. Note that it is already possible for a client (or his wallet) to send his offer to the service by using `payer_note=lno1...` in `fetchinvoice` but this would allow wallets to include it in a standard manner.

I'm aware of `invoicerequest` and `sendinvoice` but as far as I understand it, this still requires service-client interaction for a refund after the payment by the client.

EDIT:

As a demonstration, I have now implemented this in my working [spark-wallet](https://github.com/hMsats/spark-wallet-euro) by changing:

```
const { invoice: bolt12_invoice, changes } = await this.fetchinvoice(bolt12_offer, amount_msat, quantity, null, null, null, null, payer_note)
```

into
```
const {offer_id, active, single_use, bolt12: payer_offer, used, created } = await this.offer("any")
const { invoice: bolt12_invoice, changes } = await this.fetchinvoice(bolt12_offer, amount_msat, quantity, null, null, null, null, payer_offer)
```

in `src/cmd.js`

This allows me to play my [lightning game](https://SatoshiBets.nl) without registration, by just paying the initial bet and receiving double the reward if guessed right :-)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.