Skip to content

feat: add tip support to pay() — optional gratuity on top of invoice amount #51

Description

@MarcusDavidG

Summary

Allow payers to include an optional tip amount on top of the invoice amount when calling pay().

Motivation

Freelancers and service providers often receive gratuities. Having tip support on-chain makes it transparent and eliminates the need for a separate transfer.

Proposed Change

  • Add optional tip: Option<i128> param to pay()
  • Transfer tip separately to a configurable tip recipient (creator by default)
  • Emit a tip_received event with the tip amount
  • Store tips in the Payment struct (field already exists as tip: i128)

Acceptance Criteria

  • tip is transferred to creator on pay()
  • tip amount stored in Payment struct
  • tip_received event emitted
  • test: tip is isolated from invoice funded amount
  • test: invoice can still release independently of tip

Labels

enhancement, good first issue

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions