Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add payer_offer to fetchinvoice #7741

Open
hMsats opened this issue Oct 15, 2024 · 1 comment
Open

[Feature Request] Add payer_offer to fetchinvoice #7741

hMsats opened this issue Oct 15, 2024 · 1 comment

Comments

@hMsats
Copy link
Contributor

hMsats commented Oct 15, 2024

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 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 without registration, by just paying the initial bet and receiving double the reward if guessed right :-)

@hMsats
Copy link
Contributor Author

hMsats commented Oct 27, 2024

Also as a demonstration of my modified spark-wallet, I made a video where someone pays 100 sats + 30 sats deposit (let's say for a (very cheap) stay in an apartment) and after a few days gets the deposit back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant