Skip to main content
GET
/
api
/
church
/
getdonations
/
:churchId
List Donations
curl --request GET \
  --url https://api.example.com/api/church/getdonations/:churchId
{
  "success": true,
  "message": "<string>",
  "data": [
    {
      "data[]._id": "<string>",
      "data[].church": "<string>",
      "data[].donationName": "<string>",
      "data[].donationStatus": {},
      "data[].startDate": "<string>",
      "data[].endDate": "<string>",
      "data[].donationDescription": "<string>",
      "data[].bankDetails": {
        "data[].bankDetails.accountName": "<string>",
        "data[].bankDetails.accountNumber": "<string>",
        "data[].bankDetails.bankName": "<string>"
      },
      "data[].donationSupportContact": {
        "data[].donationSupportContact.phone": "<string>",
        "data[].donationSupportContact.email": "<string>"
      },
      "data[].donationMetrics": {
        "data[].donationMetrics.targetAmount": 123,
        "data[].donationMetrics.minAmount": 123,
        "data[].donationMetrics.totalGotten": 123
      },
      "data[].donators": [
        {
          "data[].donators[].user": {
            "data[].donators[].user.name": "<string>",
            "data[].donators[].user.phoneNumber": "<string>"
          },
          "data[].donators[].donated": 123,
          "data[].donators[].transactionId": "<string>",
          "data[].donators[].paymentVerified": true
        }
      ],
      "data[].createdAt": "<string>",
      "data[].updatedAt": "<string>"
    }
  ]
}

Authentication

This endpoint requires:
  • Valid JWT token in Authorization header
  • Any authenticated user (both pastors and members can view donations)

Endpoint

GET /api/church/getdonations/:churchId

Path Parameters

churchId
string
required
The unique identifier (ObjectId) of the church whose donations you want to retrieve.

Response

success
boolean
Indicates if the donations were retrieved successfully.
message
string
A human-readable message describing the result.
data
array
Array of donation objects for the church.
data[]._id
string
Unique identifier for the donation.
data[].church
string
Reference to the church ObjectId.
data[].donationName
string
Name of the donation campaign.
data[].donationStatus
enum
Current status of the donation:
  • "on" - Active and accepting donations
  • "off" - Paused or inactive
  • "completed" - Target achieved
data[].startDate
date
Campaign start date.
data[].endDate
date
Campaign end date.
data[].donationDescription
string
Description of the donation purpose.
data[].bankDetails
object
Bank account information.
data[].bankDetails.accountName
string
Name on the bank account.
data[].bankDetails.accountNumber
string
Bank account number.
data[].bankDetails.bankName
string
Name of the bank.
data[].donationSupportContact
object
Contact information for donation support.
data[].donationSupportContact.phone
string
Phone number for inquiries.
data[].donationSupportContact.email
string
Email address for inquiries.
data[].donationMetrics
object
Financial metrics for the campaign.
data[].donationMetrics.targetAmount
number
The fundraising goal amount.
data[].donationMetrics.minAmount
number
The minimum donation amount allowed.
data[].donationMetrics.totalGotten
number
Total amount received so far.
data[].donators
array
Array of donator objects.
data[].donators[].user
object
Populated user object.
data[].donators[].user.name
string
Donor’s name.
data[].donators[].user.phoneNumber
string
Donor’s phone number.
data[].donators[].donated
number
Amount donated.
data[].donators[].transactionId
string
Stripe checkout session ID.
data[].donators[].paymentVerified
boolean
Whether the payment has been verified.
data[].createdAt
date
Timestamp when the donation was created.
data[].updatedAt
date
Timestamp of last update.

Example Request

curl -X GET "https://api.example.com/api/church/getdonations/60d5ec49f1b2c72b8c8e4f1b" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

{
  "success": true,
  "message": "These are the available donations for First Baptist Church",
  "data": [
    {
      "_id": "60d5ec49f1b2c72b8c8e4f1c",
      "church": "60d5ec49f1b2c72b8c8e4f1b",
      "donationName": "Building Fund 2026",
      "donationStatus": "on",
      "startDate": "2026-04-01T00:00:00.000Z",
      "endDate": "2026-12-31T23:59:59.000Z",
      "donationDescription": "Fundraising for new church building construction",
      "bankDetails": {
        "accountName": "First Baptist Church",
        "accountNumber": "1234567890",
        "bankName": "Community Bank"
      },
      "donationSupportContact": {
        "phone": "+1-555-0123",
        "email": "[email protected]"
      },
      "donationMetrics": {
        "targetAmount": 500000,
        "minAmount": 10,
        "totalGotten": 2500
      },
      "donators": [
        {
          "user": {
            "name": "John Smith",
            "phoneNumber": "+1-555-0199"
          },
          "donated": 100,
          "transactionId": "cs_test_a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6q7R8s9T0",
          "paymentVerified": true
        },
        {
          "user": {
            "name": "Jane Doe",
            "phoneNumber": "+1-555-0188"
          },
          "donated": 250,
          "transactionId": "cs_test_b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8S9t0U1",
          "paymentVerified": true
        }
      ],
      "createdAt": "2026-03-07T10:30:00.000Z",
      "updatedAt": "2026-03-07T14:20:00.000Z"
    },
    {
      "_id": "60d5ec49f1b2c72b8c8e4f1d",
      "church": "60d5ec49f1b2c72b8c8e4f1b",
      "donationName": "Mission Trip Fund",
      "donationStatus": "off",
      "startDate": "2026-06-01T00:00:00.000Z",
      "endDate": "2026-08-31T23:59:59.000Z",
      "donationDescription": "Supporting our summer mission trip to Guatemala",
      "bankDetails": {
        "accountName": "First Baptist Church",
        "accountNumber": "1234567890",
        "bankName": "Community Bank"
      },
      "donationSupportContact": {
        "phone": "+1-555-0123",
        "email": "[email protected]"
      },
      "donationMetrics": {
        "targetAmount": 15000,
        "minAmount": 25,
        "totalGotten": 0
      },
      "donators": [],
      "createdAt": "2026-03-07T11:00:00.000Z",
      "updatedAt": "2026-03-07T11:00:00.000Z"
    }
  ]
}

Error Responses

404 - Church Not Found

{
  "success": false,
  "message": "Unable to get donations",
  "data": "Church with this Id does not exist"
}

500 - Server Error

{
  "success": false,
  "message": "Unable to get donations",
  "data": "Error message details"
}

Response Details

Populated Fields

The endpoint populates the following fields:
  • donators.user - Includes user’s name and phoneNumber

Donation Status Values

  • "on" - Donation is active and accepting contributions
  • "off" - Donation is temporarily paused or not yet started
  • "completed" - Donation has reached its target or been manually marked as complete

Empty Results

If a church has no donations, the endpoint returns:
{
  "success": true,
  "message": "These are the available donations for First Baptist Church",
  "data": []
}

Notes

  • All donations for a church are returned, regardless of status
  • Donator information includes verified and unverified payments
  • The response includes full donor details (name and phone number)
  • Both pastors and members can view donation information
  • Useful for displaying donation campaigns on church websites or apps
  • Can be filtered client-side by donationStatus, date range, or other criteria

Build docs developers (and LLMs) love