Skip to content

Add reason to PaymentStatus failure #567

Open

Description

@reez

See the reason associated withfailed of PaymentStatus:

public enum PaymentStatus {
    case pending
    case succeeded
    case failed
}

Activity

  1. reez commented on Jun 9, 2025

    @reez
    Author

    ::Context::

    Maybe there's an alternative way (let me know if so), but if a user taps on the details of a payment I'd like to show them associated info about the failure. Right now I can just show them it failed, but would like to surface other info/hints on why so that the user can understand (and possibly take an informed action).

    At the moment I think I can only see the failure reason in the logs, but don't have access to the PaymentStatus's failed reason (that I know of? I might be overlooking something though) to surface to the user.

  2. Camillarhi commented on Jun 10, 2025

    @Camillarhi
    Contributor

    Hi @reez,

    Great point! Currently, PaymentStatus for Failed doesn’t include the failure reason, which limits what users can be shown. Since failures can happen for different reasons (routing issues, insufficient funds, etc.), it would be helpful to attach this info to the status.

    @tnull could confirm if extending PaymentStatus to include failure details aligns with the project’s direction. This way, we could surface actionable feedback to users without relying on logs.

    Happy to discuss approaches or help with implementation once we agree on the design!

  3. tnull commented on Jun 11, 2025

    @tnull
    Collaborator

    @tnull could confirm if extending PaymentStatus to include failure details aligns with the project’s direction. This way, we could surface actionable feedback to users without relying on logs.

    Yeah, as mentioned over at #566 (review) I kind of like the simplicity of the current enum, however, I also see that it would add utility to extend the failure case to include a reason. If we'd want to do that, we should however make it mandatory to supply the reason, i.e., create a new Failure type that would also cover any local- or BDK-specific reasons, not only the ones coming from LDK.

  4. Camillarhi commented on Jun 11, 2025

    @Camillarhi
    Contributor

    @tnull could confirm if extending PaymentStatus to include failure details aligns with the project’s direction. This way, we could surface actionable feedback to users without relying on logs.

    Yeah, as mentioned over at #566 (review) I kind of like the simplicity of the current enum, however, I also see that it would add utility to extend the failure case to include a reason. If we'd want to do that, we should however make it mandatory to supply the reason, i.e., create a new Failure type that would also cover any local- or BDK-specific reasons, not only the ones coming from LDK.

    Thanks for the feedback! Making the failure reason mandatory makes sense - ensures we always have something meaningful to show users.
    A few questions to help scope this:

    1. Should the Failure type be a separate enum covering all failure categories?
    2. Are you thinking high-level reasons for users ("Insufficient funds", "Route not found") or more technical details?
    3. For BDK-specific reasons, would we want to reuse any existing error types, or create new ones tailored to payment failures?
    4. Would you prefer an enum (for fixed error categories) or a struct with optional fields (for more flexibility)?

    I'm happy to work on this once we agree on the approach.

  5. tnull commented on Nov 7, 2025

    @tnull
    Collaborator

    @tnull could confirm if extending PaymentStatus to include failure details aligns with the project’s direction. This way, we could surface actionable feedback to users without relying on logs.

    Yeah, as mentioned over at #566 (review) I kind of like the simplicity of the current enum, however, I also see that it would add utility to extend the failure case to include a reason. If we'd want to do that, we should however make it mandatory to supply the reason, i.e., create a new Failure type that would also cover any local- or BDK-specific reasons, not only the ones coming from LDK.

    Thanks for the feedback! Making the failure reason mandatory makes sense - ensures we always have something meaningful to show users. A few questions to help scope this:

    1. Should the Failure type be a separate enum covering all failure categories?
    2. Are you thinking high-level reasons for users ("Insufficient funds", "Route not found") or more technical details?
    3. For BDK-specific reasons, would we want to reuse any existing error types, or create new ones tailored to payment failures?
    4. Would you prefer an enum (for fixed error categories) or a struct with optional fields (for more flexibility)?

    I'm happy to work on this once we agree on the approach.

    Well, as mentioned above, still not convinced we should touch PaymentStatus right now at all. But I imagine if we want to add a reason, that would probably be a free-form/human readable String.

    Note that adding it to the enum might require to expose PaymentStatus it as an enum-interface in Uniffi, which requires it to be Arced everywhere, which in turn might require to add a bunch of additional boilerplate, increasing complexity even further.

  6. Camillarhi commented on Nov 7, 2025

    @Camillarhi
    Contributor

    Well, as mentioned above, still not convinced we should touch PaymentStatus right now at all. But I imagine if we want to add a reason, that would probably be a free-form/human readable String.

    Note that adding it to the enum might require to expose PaymentStatus it as an enum-interface in Uniffi, which requires it to be Arced everywhere, which in turn might require to add a bunch of additional boilerplate, increasing complexity even further.

    ooh I see why it would be better to hold off on this, thanks

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

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