Skip to content

feat: add reward tiers and backer perks for campaigns#76

Open
AugistineCreates wants to merge 2 commits into
Savitura:mainfrom
AugistineCreates:feature/reward-tiers
Open

feat: add reward tiers and backer perks for campaigns#76
AugistineCreates wants to merge 2 commits into
Savitura:mainfrom
AugistineCreates:feature/reward-tiers

Conversation

@AugistineCreates
Copy link
Copy Markdown

This pr closes #61

This PR introduces the highly anticipated "Reward Tiers and Backer Perks" system to CrowdPay, giving creators the ability to define distinct pledge levels and reward their contributors. This mirrors successful crowdfunding mechanics (like Kickstarter and Indiegogo) and encourages higher contribution amounts by offering tangible perks.

Key Changes

Database Updates

  • New reward_tiers table: Stores defined reward tiers for a campaign, including min_amount, limit, claimed_count, and estimated_delivery.
  • New contribution_rewards table: A join table mapping a contribution_id to its assigned reward_tier_id.

Backend Implementation

  • Campaign Routes (/campaigns):
    • Updated the campaign creation validation and logic to process an optional reward_tiers array, inserting them into the database alongside the campaign.
    • Added a helper function to validate and normalize tier input limits (e.g., maximum of 10 tiers).
    • Added a new endpoint GET /campaigns/:id/tiers to retrieve active tiers.
  • Ledger Monitor (ledgerMonitor.js):
    • Enhanced handlePayment to automatically evaluate and assign the highest qualifying reward tier to a contributor when their payment is indexed on-chain, whilst respecting tier limits and incrementing the claimed_count.
  • Contributions Routes (/contributions):
    • Updated GET /finalization/:txHash to return the unlocked reward tier alongside the finalization status, allowing the frontend to immediately notify the user.

Frontend Implementation

  • Campaign Creation UI (CreateCampaign.jsx):
    • Added a new step in the creation flow: "3. Rewards (Optional)".
    • Creators can define tier titles, descriptions, minimum amounts, limited availability, and estimated delivery dates.
  • Campaign Details Page (Campaign.jsx):
    • Tiers are fetched and prominently displayed as visually distinct cards above the "Contribute" section, showing remaining limits and details.
  • Contribution Modal (ContributeModal.jsx):
    • Live Matching: As the user types their contribution amount, a "🎁 Unlocked Reward" badge dynamically updates to show the highest qualifying perk.
    • Finalization Success State: Once the Stellar ledger indexes the payment, the success screen highlights the unlocked perk details with a celebratory UI element.

Testing Steps

  1. Database Migration: Ensure the new 20260429_reward_tiers.sql migration has run successfully.
  2. Create a Campaign: Go through the campaign creation flow and add 1-2 test reward tiers.
  3. View Campaign: Navigate to the created campaign's details page and verify the tiers are displayed accurately.
  4. Contribute: Open the contribution modal. Type an amount that qualifies for a tier and verify the live matching UI appears.
  5. Verify Unlocking: Submit the contribution and wait for the ledger indexing. Verify the success screen displays the "Reward Unlocked" celebratory message.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 29, 2026

@AugistineCreates Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Reward tiers and backer perks for campaigns

1 participant