Donations
The Daffy API let's you get information about users donations and creating new ones.
⚠️
Only public donations will be shown for users other than yourself. Also, the donation info will be limited for other user donations.
Get Own Donations
Resource
GET /v1/donations
Sample Response
{
"items": [
{
"id": 1,
"amount": 20,
"status": "completed",
"note": "Thank you",
"scheduled_donation_id": null,
"visibility": "public",
"created_at": "2022-11-23T01:28:17.821Z",
"mailed_at": "2022-11-26T01:00:00.821Z",
"non_profit": {
"ein": "261544963",
"name": "Khan Academy",
"website": "https://www.khanacademy.org/",
"city": "Mountain View",
"state": "CA",
"logo": "https://s3.us-west-2.amazonaws.com/production-daffy-static-content/non_profit/logos/4904275",
"public_path": "/charities/261544963-khan-academy-mountain-view-ca",
"public_url": "https://www.daffy.org/charities/261544963-khan-academy-mountain-view-ca",
"cause_id": 1
}
"fund": {
"id": 1,
"name": "Charitable Fund"
},
"user": {
"id": 1,
"name": "Api User",
"city": "Sunnyvale, California",
"avatar": "https://static.daffy.org/avatars/1/api-user-avatar",
"slug": "api-user-one"
}
},
...]
"meta": {
"count": 52,
"last": 2,
"page": 1
}
}
Response Reference
Domain objects live under the items
key, see pagination for more details.
Name | Type | Description |
---|---|---|
id | number | Donation ID |
amount | number | Donation amount in USD |
status | string | The status of the donation [scheduled, waiting_for_funds, approved, rejected, completed, not_completed, check_mailed] |
note | string | The public donation note if present |
scheduled_donation_id | number | The ID of the scheduled donation, if present |
visibility | string | Wether this donation is public or not |
created_at | iso date | When the donation was created |
mailed_at | iso date | When the donation was mailed (or null) |
non_profit.ein | string | Non Profit Employer Identification Number |
non_profit.name | string | Non Profit name |
non_profit.website | string | Non Profit URL |
non_profit.city | string | Non Profit city |
non_profit.state | string | Non Profit state |
non_profit.logo | url | Non Profit Logo |
non_profit.public_path | path | Non Profit path (on daffy.org) |
non_profit.public_url | url | Non Profit URL (on daffy.org) |
non_profit.cause_id | number | Non Profit cause ID |
fund.id | number | Fund ID |
fund.name | string | Fund name |
user.id | number | User ID |
user.name | string | User name |
user.city | string | User city |
user.avatar | url | User avatar URL |
user.slug | string | User slug / nickname |
Sample Request
curl "https://public.daffy.org/v1/donations" -H 'X-Api-Key: <YOUR KEY HERE>'
Get Users Donations
Resource
GET /v1/users/:user_id/donations
Path Params
Name | Type | Description |
---|---|---|
:user_id | number | The user ID whose donations you want to get |
Sample Response
{
"items": [
{
"id": 1,
"user_id": 1234,
"status": "completed",
"note": "Thank you",
"created_at": "2022-11-23T01:28:17.821Z",
"mailed_at": "2022-11-26T02:25:13.532Z",
"non_profit": {
"ein": "261544963",
"name": "Khan Academy",
"website": "https://www.khanacademy.org/",
"city": "Mountain View",
"state": "CA",
"logo": "https://s3.us-west-2.amazonaws.com/production-daffy-static-content/non_profit/logos/4904275",
"public_path": "/charities/261544963-khan-academy-mountain-view-ca",
"public_url": "https://www.daffy.org/charities/261544963-khan-academy-mountain-view-ca",
"cause_id": 1
}
},
...
],
"meta": {
"count": 10,
"last": 1,
"page": 1
}
}
Response Reference
Domain objects live under the items
key, see pagination for more details.
Name | Type | Description |
---|---|---|
id | number | Donation ID |
user_id | number | User ID |
status | string | The status of the donation [scheduled, waiting_for_funds, approved, rejected, completed, not_completed, check_mailed] |
note | string | The public donation note if present |
created_at | iso date | When the donation was created |
mailed_at | iso date | When the donation was mailed (or null) |
non_profit.ein | string | Non Profit Employer Identification Number |
non_profit.name | string | Non Profit name |
non_profit.website | string | Non Profit URL |
non_profit.city | string | Non Profit city |
non_profit.state | string | Non Profit state |
non_profit.logo | url | Non Profit Logo |
non_profit.public_path | path | Non Profit path (on daffy.org) |
non_profit.public_url | url | Non Profit URL (on daffy.org) |
non_profit.cause_id | number | Non Profit cause ID |
Sample Request
curl "https://public.daffy.org/v1/users/1234/donations" -H 'X-Api-Key: <YOUR KEY HERE>'
Get Donation
Resource
GET /v1/users/:user_id/donations/:donation_id
Path Params
Name | Type | Description |
---|---|---|
:user_id | number | The user ID whose donation you want to get |
:donation_id | number | The donation ID |
Sample Response
Same as GET /v1/users/:user_id/donations
items.
Sample Request
curl "https://public.daffy.org/v1/users/1234/donations/5678" -H 'X-Api-Key: <YOUR KEY HERE>'
Create Donation
Resource
POST /v1/donations
Sample Request Body
{
"amount": 25,
"ein": "941156258",
"note": "love what they do!",
"private_memo": "This is the private memo, is not displayed publicly."
}
Name | Type | Description |
---|---|---|
amount | number | The amount of the donation in dollars |
ein | string | The Employer Identification Number of the non-profit |
note | string | The public note attached to the donation |
private_memo | string | A private memo attached to the donation, not displayed publicly |
Sample Response
Same as GET /v1/users/:user_id/donations/:donation_id
Sample Request
CURL -X POST "https://public.daffy.org/v1/users/1234/donations" \
-H 'X-Api-Key: <YOUR KEY HERE>' \
-H 'Content-Type: application/json' \
-d '{"amount":25,"ein":"941156258","note":"love what they do!","private_memo": "This is the private memo, is not displayed publicly."}'
Cancel Donation
Resource
DELETE /v1/donations/:donation_id
⚠️
You can only cancel donations for the user that owns the provided API key and that haven't been already accepted or rejected by Daffy.
Path Params
Name | Type | Description |
---|---|---|
:donation_id | number | The donation ID |
Sample Response
{}
Sample Request
CURL -X DELETE "https://public.daffy.org/v1/donations/1234" -H 'X-Api-Key: <YOUR KEY HERE>'