Skip to main content

Giving Endpoints

The Giving module manages donations, funds, payment processing, subscriptions, and related financial operations. It supports multiple payment gateways (Stripe, PayPal), handles one-time and recurring donations, tracks donation batches, and provides webhook processing for asynchronous payment events.

Base path: /giving

Donations

Base path: /giving/donations

MethodPathAuthPermissionDescription
GET/JWTDonations.View or own personIdList all donations. Filter by ?batchId= or ?personId=
GET/:idJWTDonations.ViewGet a donation by ID
GET/myJWTGet current user's donations
GET/summaryJWTDonations.ViewSummaryGet donation summary. Filter by ?startDate=&endDate=&type=. Use type=person for per-person breakdown
GET/testEmailPublicSend a test email (development/debugging)
POST/JWTDonations.EditCreate or update donations (batch)
DELETE/:idJWTDonations.EditDelete a donation

Example: List Donations by Batch

GET /giving/donations?batchId=abc-123
Authorization: Bearer <token>
[
{
"id": "don-456",
"batchId": "abc-123",
"personId": "per-789",
"donationDate": "2025-03-15T00:00:00.000Z",
"amount": 100.00,
"method": "card"
}
]

Example: Get Donation Summary

GET /giving/donations/summary?startDate=2025-01-01&endDate=2025-12-31
Authorization: Bearer <token>
[
{
"week": "2025-01-06",
"fund": "General Fund",
"totalAmount": 2500.00,
"count": 15
}
]

Donation Batches

Base path: /giving/donationbatches

Extends GenericCrudController with CRUD routes: getById, getAll, post, delete. The delete operation also removes all donations within the batch.

MethodPathAuthPermissionDescription
GET/JWTDonations.ViewSummaryList all donation batches
GET/:idJWTDonations.ViewSummaryGet a donation batch by ID
POST/JWTDonations.EditCreate or update donation batches
DELETE/:idJWTDonations.EditDelete a batch and all its donations

Base path: /giving/donate

Handles the public-facing donation flow including charges, subscriptions, webhooks, and fee calculations. No base CRUD routes are enabled; all endpoints are custom.

MethodPathAuthPermissionDescription
GET/gateways/:churchIdPublicGet available payment gateways for a church (public keys only)
POST/client-tokenJWTGenerate a client token for gateway initialization
POST/create-orderJWTCreate a payment order (PayPal-style checkout)
POST/chargeJWTProcess a one-time donation charge
POST/subscribeJWTCreate a recurring donation subscription
POST/logPublicLog a donation. Body: { donation, fundData }
POST/webhook/:providerPublicReceive payment webhook events (Stripe, PayPal). Requires ?churchId=
POST/replay-stripe-eventsJWTDonations.EditReplay Stripe events for a date range. Body: { startDate, endDate, dryRun }
POST/feePublicCalculate transaction fees. Body: { type, provider, gatewayId, amount, currency }. Requires ?churchId=
POST/captcha-verifyPublicVerify reCAPTCHA token. Body: { token }

Example: Process a Donation Charge

POST /giving/donate/charge
Authorization: Bearer <token>

{
"provider": "stripe",
"amount": 50.00,
"currency": "usd",
"person": { "id": "per-123", "email": "donor@example.com" },
"funds": [{ "id": "fund-001", "name": "General Fund", "amount": 50.00 }],
"church": { "name": "First Church", "subDomain": "firstchurch" }
}
{
"id": "ch_abc123",
"status": "succeeded",
"provider": "stripe"
}

Example: Create a Recurring Subscription

POST /giving/donate/subscribe
Authorization: Bearer <token>

{
"provider": "stripe",
"amount": 100.00,
"customerId": "cus_abc123",
"interval": { "interval_count": 1, "interval": "month" },
"billing_cycle_anchor": 1710460800,
"person": { "id": "per-123", "email": "donor@example.com" },
"funds": [{ "id": "fund-001", "name": "General Fund", "amount": 100.00 }],
"church": { "name": "First Church", "subDomain": "firstchurch" }
}
{
"id": "sub_xyz789",
"status": "active",
"provider": "stripe"
}

Funds

Base path: /giving/funds

Extends GenericCrudController with CRUD routes: getById, getAll, post, delete. The view permission is null (no permission required for viewing funds).

MethodPathAuthPermissionDescription
GET/JWTList all funds
GET/:idJWTGet a fund by ID
GET/churchId/:churchIdPublicGet all funds for a specific church (public)
POST/JWTDonations.EditCreate or update funds
DELETE/:idJWTDonations.EditDelete a fund

Fund Donations

Base path: /giving/funddonations

Tracks how individual donations are allocated across funds. No base CRUD routes are enabled; all endpoints are custom.

MethodPathAuthPermissionDescription
GET/JWTDonations.ViewList fund donations. Filter by ?donationId=, ?personId=, ?fundId=, or ?fundName=. Optionally add ?startDate=&endDate= for date filtering
GET/:idJWTDonations.ViewGet a fund donation by ID
GET/myJWTGet current user's fund donations
POST/JWTDonations.EditCreate or update fund donations (batch)
DELETE/:idJWTDonations.EditDelete a fund donation

Gateways

Base path: /giving/gateways

Manages payment gateway configurations (Stripe, PayPal, etc.). No base CRUD routes are enabled; all endpoints are custom. Gateway secrets are encrypted at rest.

MethodPathAuthPermissionDescription
GET/JWTList all gateways for the church
GET/:idJWTSettings.EditGet a gateway by ID
GET/churchId/:churchIdPublicGet gateways for a church (public keys only)
GET/configured/:churchIdPublicCheck if a church has a configured payment gateway
POST/JWTSettings.EditCreate or update gateways (encrypts keys, provisions webhooks and products)
PATCH/:idJWTSettings.EditPartially update a gateway
DELETE/:idJWTSettings.EditDelete a gateway (also removes its webhooks)

Example: Check Gateway Configuration

GET /giving/gateways/configured/church-123
{
"configured": true
}

Customers

Base path: /giving/customers

Extends GenericCrudController with CRUD routes: getAll, delete. Links people to their payment gateway customer records.

MethodPathAuthPermissionDescription
GET/JWTDonations.ViewSummaryList all customers
GET/:idJWTDonations.ViewSummary or own recordGet a customer by ID
GET/:id/subscriptionsJWTDonations.ViewSummary or own recordGet gateway subscriptions for a customer
DELETE/:idJWTDonations.EditDelete a customer

Subscriptions

Base path: /giving/subscriptions

Manages recurring donation subscriptions. No base CRUD routes are enabled; all endpoints are custom.

MethodPathAuthPermissionDescription
GET/JWTDonations.ViewSummaryList all subscriptions
GET/:idJWTDonations.ViewSummaryGet a subscription by ID
POST/JWTDonations.Edit or own subscriptionUpdate subscriptions with the payment gateway
DELETE/:idJWTDonations.Edit or own subscriptionCancel a subscription and remove from database. Body: { provider, reason }

Subscription Funds

Base path: /giving/subscriptionfunds

Tracks fund allocations for recurring subscriptions. No base CRUD routes are enabled; all endpoints are custom.

MethodPathAuthPermissionDescription
GET/JWTDonations.View or own subscriptionList subscription funds. Filter by ?subscriptionId=
GET/:idJWTDonations.ViewSummaryGet a subscription fund by ID
DELETE/:idJWTDonations.EditDelete a subscription fund
DELETE/subscription/:idJWTDonations.Edit or own subscriptionDelete all funds for a subscription

Payment Methods

Base path: /giving/paymentmethods

Manages stored payment methods (cards, bank accounts) via payment gateway APIs. No base CRUD routes are enabled; all endpoints are custom.

MethodPathAuthPermissionDescription
GET/personid/:idJWTDonations.View or own personIdGet all stored payment methods for a person (cards, bank accounts)
POST/addcardJWTAttach a card payment method. Body: { id, personId, customerId, email, name, churchId, provider }
POST/updatecardJWTDonations.Edit or own personIdUpdate card details. Body: { personId, paymentMethodId, cardData, provider }
POST/ach-setup-intentJWTDonations.Edit or own personIdCreate a Stripe ACH SetupIntent for bank account linking. Body: { personId, customerId, email, name, churchId }
POST/ach-setup-intent-anonPublicCreate an anonymous ACH SetupIntent for guest donations. Body: { email, name, churchId, gatewayId }
POST/addbankaccountJWTDonations.Edit or own personIdAdd a bank account via token (deprecated; use ach-setup-intent). Body: { id, personId, customerId, email, name }
POST/updatebankJWTDonations.Edit or own personIdUpdate bank account details. Body: { paymentMethodId, personId, bankData, customerId }
POST/verifybankJWTDonations.Edit or own customerVerify a bank account with micro-deposits. Body: { paymentMethodId, customerId, amountData }
DELETE/:id/:customeridJWTDonations.Edit or own customerDelete a payment method (card or bank account)

Event Log

Base path: /giving/eventLog

Extends GenericCrudController with CRUD routes: getById, getAll, post, delete. Tracks payment gateway webhook events for auditing and deduplication.

MethodPathAuthPermissionDescription
GET/JWTDonations.ViewSummaryList all event logs
GET/:idJWTDonations.ViewSummaryGet an event log by ID
GET/type/:typeJWTDonations.ViewSummaryGet event logs filtered by event type
POST/JWTDonations.EditCreate or update event logs
DELETE/:idJWTDonations.EditDelete an event log