Skip to content

feat: platform fee collection on contributions (#20)#50

Merged
dotunv merged 2 commits into
Savitura:mainfrom
jerrymusaga:feat/platform-fee-collection
Apr 29, 2026
Merged

feat: platform fee collection on contributions (#20)#50
dotunv merged 2 commits into
Savitura:mainfrom
jerrymusaga:feat/platform-fee-collection

Conversation

@jerrymusaga
Copy link
Copy Markdown
Contributor

Closes #20

Summary

  • Atomic fee splitting: prepareSignedContributionPayment and prepareSignedContributionPathPayment now add a second operation in the same Stellar transaction routing the fee to the platform wallet — no separate transactions
  • Configurable via PLATFORM_FEE_BPS env var (basis points, e.g. 150 = 1.5%); defaults to 0 so existing deployments are unaffected
  • DB column platform_fee_amount added to contributions via migration 20260426_platform_fee.sql; the ledger monitor reads fee from the stellar_transactions.metadata and writes it on index
  • Frontend fee disclosure: ContributeModal fetches GET /api/config on mount and shows "Platform fee: 1.5% = 0.15 USDC — campaign receives X USDC" before the user confirms

Test plan

  • Set PLATFORM_FEE_BPS=150 in .env and contribute — verify two operations appear in the Stellar transaction (one to campaign wallet, one to platform wallet)
  • Check contributions table after ledger monitor indexes — platform_fee_amount should be populated
  • Set PLATFORM_FEE_BPS=0 (or unset) — contribution behaves exactly as before (single op, no fee)
  • Open ContributeModal, enter an amount — fee breakdown line appears; clear amount — line disappears
  • npm test — 30 pass, 1 pre-existing failure in campaign refund test (unrelated to this PR)

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 26, 2026

@jerrymusaga 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

Implements atomic fee splitting at contribution time via PLATFORM_FEE_BPS
env var (basis points). Both direct payments and path payments route the fee
to the platform wallet in the same Stellar transaction as the contribution.
The fee amount is recorded per-contribution in the DB and displayed
transparently in ContributeModal before the user confirms.
@jerrymusaga jerrymusaga force-pushed the feat/platform-fee-collection branch from a65a196 to a5ade6a Compare April 26, 2026 02:35
@dotunv
Copy link
Copy Markdown
Contributor

dotunv commented Apr 26, 2026

@jerrymusaga review for merge conflicts

@dotunv dotunv merged commit 421a82e into Savitura:main Apr 29, 2026
0 of 2 checks passed
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: Platform fee collection on contributions

2 participants