Skip to content

feat: Refund eligibility and on-chain refund workflow for creators #757

Description

@dotunv

Overview

Add a refund-eligibility workflow that lets campaign creators (and admins) process partial or full on-chain refunds to contributors, with automatic campaign balance adjustment.

Motivation

Campaigns can fail, be cancelled, or creators may want to issue goodwill refunds. Today there's no structured refund path — creators have no way to return escrowed funds to a specific contributor through the UI, and the campaign/escrow bookkeeping isn't updated when refunds happen off-platform.

Proposed Design

  1. Add a refunds table: contribution_id, campaign_id, amount, reason, status, processed_at, tx_hash
  2. Add a creator view "Refunds" section listing contributions eligible for refund (status, amount, contributor)
  3. Creator can initiate a partial or full refund on a contribution
  4. Refunding submits an escrow return transaction on-chain returning funds to the contributor's wallet
  5. On success, campaign raised_amount (and USD equivalent) decreases and the contribution is marked refunded
  6. Refund requires confirmation with explicit amount and reason
  7. Admin can force-refund and can add a note; refunds are logged in the audit trail
  8. Contributor receives a notification and email when their contribution is refunded

Acceptance Criteria

  • Creator can view list of eligible contributions for a campaign
  • Creator can initiate partial or full refund with an amount and reason
  • Refund submits a real escrow-return transaction on-chain
  • Campaign raised_amount decreases on successful refund
  • Contribution status is updated to refunded with original and refunded amounts
  • Refund requires confirmation (no accidental double clicks)
  • Admin can force-refund and leave an internal note
  • Contributor gets a notification/email on refund
  • Refund failure rolls back state and logs the error
  • Tests cover: partial, full, failure rollback, admin force-refund, double-refund guard

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

    Stellar WaveIssues in the Stellar wave programbackendBackend / API workblockchainStellar / blockchain workenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions