Skip to content

[Feature Request] Add payer_offer to fetchinvoice #7741

Open
@hMsats

Description

@hMsats

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 :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions