Skip to content

Receiver create_session should accept an amount param #895

Closed

Description

@benalleng

In our liana integration in creating our receiver session @arminsabouri realized that it would be nice to allow the amount as a param to be passed to the session for rust-payjoin to handle the bip-21 amount creation instead of leaving that up to the wallet.

The code is minimal but considering it is required it seems like a footgun to require the integration dev to know to do this after starting a receiver session.

let mut pj_uri = session.pj_uri();
pj_uri.amount = Some(amount);

Activity

  1. nothingmuch commented on Jul 24, 2025

    @nothingmuch
    Contributor

    note that this is not just a convenience thing but is important for representing payjoin history accurately (because unless it's stored, and the two parties pay at different effective feerates, the actual payment amount is underdetermined and cannot be inferred from the confirmed transaction reliably)

    #336

  2. DanGould commented on Jul 24, 2025

    @DanGould
    Member

    Yes, I agree the constructor taking Option<Amount> would be convenient.

    I'm not sure if saving the amount in the URI necessarily helps recall payjoin history. I think The diff between original PSBT and payjoin PSBT is necessary, because a sender is not compelled to pay the amount posted in the URI.

  3. nothingmuch commented on Jul 25, 2025

    @nothingmuch
    Contributor

    Yes, I agree the constructor taking Option<Amount> would be convenient.

    I'm not sure if saving the amount in the URI necessarily helps recall payjoin history. I think The diff between original PSBT and payjoin PSBT is necessary, because a sender is not compelled to pay the amount posted in the URI.

    Yes, I kinda conflated two things, but I think both are important:

    1. the amount the receiver requested
    2. the amount the sender gave the receiver, not counting the fees both parties paid

    there's also the net balance change for the receiver, but this is inferred from just the on chain tx

  4. self-assigned this
    on Aug 4, 2025
  5. spacebear21 commented on Aug 12, 2025

    @spacebear21
    Collaborator

    Closed by #920

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions