Donation Tracking Module

The Donations module provides comprehensive tracking of charitable giving across multiple payment sources, with company matching and Gift Aid support.

Key Features

Multi-Source Tracking

Payroll, JustGiving, CAF, bank transfer, cash, and more

Company Matching

1:1, 2:1, or 3:1 company match programs

UK Gift Aid

Automatic 25% reclaim tracking and documentation

Multi-Currency

Live exchange rates for international giving

Donation Sources

SourceVerificationAudit Weight
Payroll deductionAutomatic100%
JustGiving APIAutomatic100%
CAF integrationAutomatic100%
Bank statementManager approved90%
Receipt uploadPhoto evidence50%
Manual entrySelf-reported30%

Company Matching

Organizations can configure matching programs:
// Match ratio configuration
type MatchRatio = 0.5 | 1 | 2 | 3;

// Example: 2:1 matching on a £50 donation
const donation = {
  amount: 50,
  matchRatio: 2,
  matched: 100,       // Company matches £100
  totalImpact: 150,   // Employee + Company = £150 total
};

Bulk Matching (Admin)

Admins can process multiple donations at once:
  1. Navigate to /evidence/donations
  2. Select donations (up to 50)
  3. Choose match ratio
  4. Confirm to apply
// API endpoint
POST /api/donations/bulk-match
{
  "donationIds": ["d1", "d2", "d3"],
  "matchRatio": 2
}

Gift Aid (UK)

For UK taxpayers, Gift Aid allows charities to reclaim 25% from HMRC:
DonationGift Aid ReclaimTotal to Charity
£50£12.50£62.50
£100£25.00£125.00
£500£125.00£625.00
Gift Aid eligibility is tracked per donor. The system automatically calculates and displays potential Gift Aid on all eligible donations.

API Usage

import {
  createDonation,
  processMatch,
  generateReceipt
} from "@repo/donation";

// Log a donation
const donation = await createDonation({
  userId: session.user.id,
  organizationId: session.organizationId,
  amount: 100,
  currency: "GBP",
  source: "payroll",
  charityId: "charity_123",
  giftAidEligible: true,
});

// Process company match (admin)
await processMatch({
  donationId: donation.id,
  matchRatio: 2,
  approvedBy: adminUserId,
});

// Generate tax receipt PDF
const pdfUrl = await generateReceipt({
  donationId: donation.id,
});
// Returns: /api/donations/{id}/receipt

Milestones

Celebrate donor achievements:
AmountAchievementEmail Sent
£50First GiftYes
£100Generous GiverYes
£250PhilanthropistYes
£500Change MakerYes
£1,000Major DonorYes
£2,500Impact ChampionYes

Email Notifications

EmailTriggerContent
Donation ReceivedDonation loggedAmount, charity, total impact
Tax ReceiptDonation confirmedPDF receipt link, Gift Aid info
Milestone AchievedHit thresholdBadge, YTD stats, next milestone
Donation MatchedCompany matchesOriginal + matched = total

PDF Tax Receipts

The system generates compliant PDF receipts:
  • UK tax year calculation (April 6 - April 5)
  • Gift Aid declaration and reclaim amount
  • Charity registration details
  • Donor information
  • Redis-cached for performance
GET /api/donations/{id}/receipt
Content-Type: application/pdf

Compliance Mapping

FrameworkMetricHow Donations Map
B-CorpCommunityCharitable giving percentage
CSRD S4CommunitiesCommunity investment value
Social Value ActTOMsCharitable giving (NT28)
UN SDG 17PartnershipsCharity partnerships
GRI 201EconomicCommunity investments