Donation

This document defines the Donation resource.

Donations are a type of action that a user may take by donating on a fundraising page. Donations have fields to describe them such as when the donation was created, the amount that was donated, and typically are linked to the person who made the donation.

Sections:

Endpoints and URL structures

OSDI does not specify specific endpoints and link structures for compliant systems to use. Rather, because OSDI is a HAL+JSON API, endpoints and structures are defined in the links section of each returned resource, starting with the API Entry Point link.

HAL’s link structure lets an API consumer move through API levels, resources, and collections by parsing and following links. While most systems will not change the value of their links often and obey RESTful design principles, the value of each link when that resource is retrieved is the only canonical value, and it can change at any time.

The link relation label for a Donation resource is osdi:donation for a single Donation resource or osdi:donations for a collection of Donation resources.

Back to top…

Fields

The field names for this resource, with standard names, punctuation and capitalization, and values where appropriate.

Note: As with the entire OSDI specification, the specific fields a compliant system implements will vary between each system, as will the fields each system requires when creating or updating resources, which fields are writeable, and the operations you are allowed to perform on each resource.

Common Fields

A set of common fields that appear on all resources is included first, for reference.

Name Type Description
identifiers strings[] A unique string array of identifiers in the format [system name]:[id]. See the general concepts document for more information about identifiers.
created_date datetime A read-only property representing the date and time the resource was created on the local system.
modified_date datetime A read-only property representing the date and time the resource was last modified on the local system.

Control Headers

An “osdi:control” JSON object may contain common OSDI control headers which can be used on an OSDI POST, PUT, PATCH, Helper or other function calls to modify server behavior. Read More

Name Type Description
return_response boolean Defaults to true, if specified as false, the operation does not need to return the resource representation in the response

Back to top…

Donation Fields

Name Type Description
origin_system string Human readable text identifying the system where this donation was created.
action_date datetime Date the donation was made.
amount number Amount of total donation (after any credits) in specified currency.
credited_amount number Amount credited back to donor in specified currency.
credited_date datetime Date of the credit.
currency string ISO 4217 designation of currency. Example: USD, JPY
recipients Recipient[] Array of recipients associated with the donation.
payment Payment The payment details.
subscription_instance string A sequence number or some other value unique to this instance of the donation in the context of a subscription. Examples: 5, JAN-2014
voided boolean Indicates if the donation has been voided.
voided_date datetime Date of the void.
url string URL at which the donation was taken.
referrer_data Referrer Data* An object hash representing referrer and sourcing information about this donation.

Back to top…

These JSON hashes included in the table above are broken out into their own tables for readability, rather than independent resources with their own endpoints.

Recipient

An object representing the recipient of a donation.

Name Type Description
display_name string The recipient’s display name. Example: Barack Obama
legal_name string The recipient’s legal name. Example: Obama for America
amount float The amount donated to the recipient.

Payment

An object representing the payment details of a donation.

Name Type Description
method enum A flexible enumeration of “Credit Card”, “Check”, “Cash”, or “Electronic Funds Transfer”.
reference_number string A check number, transaction ID, or some other information referencing the payment.
authorization_stored boolean Indicates if payment information has been stored for future automatic payments.

Referrer Data

Name Type Description
referrer_data.source string The source code that was used when this donation was created. Typically used to track individual links, such as a post on social media or a link in a specific email. (ex: “facebook-101016-mainpage”)
referrer_data.referrer string The code or ID representing a person or group that referred this donation. Typically used to track which person referred the person who made this donation. (ex: “jane-doe”)
referrer_data.website string The top level domain of the website where the person clicked from to then subsequently make this donation. (ex: “facebook.com”)
referrer_data.url string The specific URL where the person clicked from to then subsequently make this donation. (ex: “https://facebook.com/posts/12345”)

Back to top…

Name Type Description
self Donation* A self-referential link to the donation.
person Person* A link to a single Person resource representing the person who donated.
fundraising_page Fundraising Page* A link to a Fundraising Page resource representing the fundraising page on which this donation was submitted.
attendance Attendance* A link to the Attendance resource which was “purchased” with this donation. Typically used to represent tickets sold for events. There is no requirement that the amount of this donation is equal to the cost of the tickets represented in the linked Attendance.

Back to top…

Helpers

Helpers faciliate combined creation operations (POST) that are commonly performed by users. Each resource may have one or more associated helpers, which perform different operations and have separate syntax. Some initial OSDI implementations may only support helpers, rather than full RESTful access.

The helpers that operate on this resource are described in the table below. Click on the helper to view its documentation and syntax.

Name Description
record_donation_helper Provides a simple method for adding a new donation and a new person to a system at the same time.

Back to top…

Back to top…

Scenarios

The scenarios below show some common Create, Read, Update, Delete (CRUD) operations that can be performed on this resource, as well as any resource-specific behaviors worth highlighting. The following examples are for informational purposes. The authoritative resource definitions are above in the Fields tables and should be followed in the event of a conflict with the examples.

Scenario: Retrieving a collection of Donation resources (GET)

Donation resources are sometimes presented as collections of donations. For example, calling the donations endpoint on a particular fundraising page will return a collection of all the donations made on that fundraising page.

Request

GET https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations

Header:
OSDI-API-Token:[your api key here]

Response

200 OK

Content-Type: application/hal+json
Cache-Control: max-age=0, private, must-revalidate

{
    "total_pages": 10,
    "per_page": 25,
    "page": 1,
    "total_records": 250,
    "_links": {
        "next": {
            "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations?page=2"
        },
        "osdi:donations": [
            {
                "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3"
            },
            {
                "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/1efc3644-af25-4253-90b8-a0baf12dbd1e"
            },
            {
                "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/c945d6fe-929e-11e3-a2e9-12313d316c29"
            },
            {
                "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/adb951cb-51f9-420e-b7e6-de953195ec86"
            },
            //(truncated for brevity)
        ],
        "curies": [
            {
                "name": "osdi",
                "href": "https://osdi-sample-system.org/docs/v1/{rel}",
                "templated": true
            }
        ],
        "self": {
            "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations"
        }
    },
    "_embedded": {
        "osdi:donations": [
            {
                "identifiers": [
                    "osdi_sample_system:d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3",
                    "foreign_system:1"
                ],
                "origin_system": "OSDI Sample System",
                "created_date": "2014-03-20T21:04:31Z",
                "modified_date": "2014-03-20T21:04:31Z",
                "action_date": "2014-03-18T11:02:15Z",
                "currency": "USD",
                "amount": 40.00,
                "credited_amount": 5.00,
                "credited_date": "2013-04-12T21:42:34",
                "voided": false,
                "voided_date": null,
                "url": "htts://actblue.com/page/BobsCandidates",
                "payment": {
                    "method": "Credit Card",
                    "reference_number": "1232456",
                    "authorization_stored": true
                },
                "recipients": [
                    {
                        "amount": 20.00,
                        "display_name": "Barack Obama",
                        "legal_name": "Obama for America"
                    },
                    {
                        "amount": 20.00,
                        "display_name": "Joe Candidate",
                        "legal_name": "Joe for Congress"
                   }
                ],
                "referrer_data": {
                    "source": "facebook-101016-mainpage",
                    "referrer": "jane-doe",
                    "website": "facebook.com",
                    "url": "https://facebook.com/posts/12345"
                },
                "_links": {
                    "self": {
                        "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3"
                    },
                    "osdi:fundraising_page": {
                        "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29"
                    },
                    "osdi:person": {
                        "href": "https://osdi-sample-system.org/api/v1/people/65345d7d-cd24-466a-a698-4a7686ef684f"
                    }
                }
            },
            {
                "identifiers": [
                    "osdi_sample_system:1efc3644-af25-4253-90b8-a0baf12dbd1e"
                ],
                "origin_system": "OSDI Sample System",
                "created_date": "2014-03-20T20:44:13Z",
                "modified_date": "2014-03-20T20:44:13Z",
                "action_date": "2014-03-12T01:45:34Z",
                "currency": "USD",
                "amount": 5.00,
                "voided": false,
                "voided_date": null,
                "url": "htts://actblue.com/page/BobsCandidates",
                "payment": {
                    "method": "Credit Card",
                    "reference_number": "12324567",
                    "authorization_stored": false
                },
                "recipients": [
                    {
                        "amount": 5.00,
                        "display_name": "Barack Obama",
                        "legal_name": "Obama for America"
                    }
                ],
                "referrer_data": {
                    "source": "email-101116-subjecttest1"
                },
                "_links": {
                    "self": {
                        "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/1efc3644-af25-4253-90b8-a0baf12dbd1e"
                    },
                    "osdi:fundraising_page": {
                        "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29"
                    },
                    "osdi:person": {
                        "href": "https://osdi-sample-system.org/api/v1/people/adb951cb-51f9-420e-b7e6-de953195ec86"
                    }
                }
            },
            {
                "identifiers": [
                    "osdi_sample_system:c945d6fe-929e-11e3-a2e9-12313d316c29"
                ],
                "origin_system": "OSDI Sample System",
                "created_date": "2014-03-20T20:44:13Z",
                "modified_date": "2014-03-20T20:44:13Z",
                "action_date": "2014-03-12T01:45:34Z",
                "currency": "USD",
                "amount": 15.00,
                "voided": false,
                "voided_date": null,
                "url": "htts://actblue.com/page/BobsCandidates",
                "payment": {
                    "method": "Credit Card",
                    "reference_number": "12324567",
                    "authorization_stored": false
                },
                "recipients": [
                    {
                        "amount": 15.00,
                        "display_name": "Barack Obama",
                        "legal_name": "Obama for America"
                    }
                ],
                "referrer_data": {
                    "source": "event-rsvp-1"
                },
                "_links": {
                    "self": {
                        "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/c945d6fe-929e-11e3-a2e9-12313d316c29"
                    },
                    "osdi:fundraising_page": {
                        "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29"
                    },
                    "osdi:person": {
                        "href": "https://osdi-sample-system.org/api/v1/people/adb951cb-51f9-420e-b7e6-de953195ec86"
                    },
                    "osdi:attendance": {
                        "href": "https://osdi-sample-system.org/api/v1/events/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc"
                    }
                }
            },
            {
                "identifiers": [
                    "osdi_sample_system:adb951cb-51f9-420e-b7e6-de953195ec86"
                ],
                "origin_system": "OSDI Sample System",
                "created_date": "2014-03-20T20:44:13Z",
                "modified_date": "2014-03-20T20:44:13Z",
                "action_date": "2014-03-12T01:45:34Z",
                "currency": "USD",
                "amount": 16.00,
                "voided": false,
                "voided_date": null,
                "url": "htts://actblue.com/page/BobsCandidates",
                "payment": {
                    "method": "Credit Card",
                    "reference_number": "12324567",
                    "authorization_stored": false
                },
                "recipients": [
                    {
                        "amount": 16.00,
                        "display_name": "Barack Obama",
                        "legal_name": "Obama for America"
                    }
                ],
                "referrer_data": {
                    "source": "donation-ask-20918"
                },
                "_links": {
                    "self": {
                        "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/adb951cb-51f9-420e-b7e6-de953195ec86"
                    },
                    "osdi:fundraising_page": {
                        "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29"
                    },
                    "osdi:person": {
                        "href": "https://osdi-sample-system.org/api/v1/people/adb951cb-51f9-420e-b7e6-de953195ec86"
                    }
                },
            },
            // (truncated for brevity)
        ]
    }
}

Back to top…

Scenario: Scenario: Retrieving an individual Donation resource (GET)

Calling an individual Donation resource will return the resource directly, along with all associated fields and appropriate links to additional information about the donation.

Request

GET https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3

Header:
OSDI-API-Token:[your api key here]

Response

200 OK

Content-Type: application/hal+json
Cache-Control: max-age=0, private, must-revalidate

{
    "identifiers": [
        "osdi_sample_system:d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3",
        "foreign_system:1"
    ],
    "origin_system": "OSDI Sample System",
    "created_date": "2014-03-20T21:04:31Z",
    "modified_date": "2014-03-20T21:04:31Z",
    "action_date": "2014-03-18T11:02:15Z",
    "currency": "USD",
    "amount": 40.00,
    "credited_amount": 5.00,
    "credited_date": "2013-04-12T21:42:34",
    "voided": false,
    "voided_date": null,
    "url": "htts://actblue.com/page/BobsCandidates",
    "payment": {
        "method": "Credit Card",
        "reference_number": "1232456",
        "authorization_stored": true
    },
    "recipients": [
        {
            "amount": 20.00,
            "display_name": "Barack Obama",
            "legal_name": "Obama for America"
        },
        {
            "amount": 20.00,
            "display_name": "Joe Candidate",
            "legal_name": "Joe for Congress"
       }
    ],
    "referrer_data": {
        "source": "facebook-101016-mainpage",
        "referrer": "jane-doe",
        "website": "facebook.com",
        "url": "https://facebook.com/posts/12345"
    },
    "_links": {
        "self": {
            "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc3"
        },
        "osdi:fundraising_page": {
            "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29"
        },
        "osdi:person": {
            "href": "https://osdi-sample-system.org/api/v1/people/65345d7d-cd24-466a-a698-4a7686ef684f"
        }
    }
}

Back to top…

Scenario: Creating a new donation (POST)

Posting to the donations collection endpoint and including a link to an existing Person resource will allow you to create a new donation associated with that fundraising page and person. The response is the new donation that was created. While each implementing system will require different fields, any optional fields not included in a post operation should not be set at all by the receiving system, or should be set to default values.

For information on how to create a person along with a donation, see the Record Donation Helper documentation.

Request

POST https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/

Header:
OSDI-API-Token:[your api key here]

{
    "identifiers": [
        "foreign_system:1"
    ],
    "origin_system": "OpenSupporter",
    "action_date": "2014-03-18T11:02:15Z",
    "currency": "USD",
    "amount": 40.00,
    "voided": false,
    "voided_date": null,
    "url": "htts://actblue.com/page/BobsCandidates",
    "payment": {
        "method": "Credit Card",
        "reference_number": "1232456",
        "authorization_stored": true
    },
    "recipients": [
        {
            "amount": 20.00,
            "display_name": "Barack Obama",
            "legal_name": "Obama for America"
        },
        {
            "amount": 20.00,
            "display_name": "Joe Candidate",
            "legal_name": "Joe for Congress"
       }
    ],
    "referrer_data": {
        "source": "api"
    },
    "_links" : {
        "osdi:person" : { 
            "href" : "https://osdi-sample-system.org/api/v1/people/65345d7d-cd24-466a-a698-4a7686ef684f" 
        },
        "osdi:attendance": {
            "href": "https://osdi-sample-system.org/api/v1/events/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc"
        }
    }
}

Response

200 OK

Content-Type: application/hal+json
Cache-Control: max-age=0, private, must-revalidate

{
    "identifiers": [
        "osdi_sample_system:d91b4b2e-ae0e-4cd3-9ed7-de9uemdse",
        "foreign_system:1"
    ],
    "created_date": "2014-03-20T21:04:31Z",
    "modified_date": "2014-03-20T21:04:31Z",
    "action_date": "2014-03-18T11:02:15Z",
    "currency": "USD",
    "amount": 40.00,
    "voided": false,
    "voided_date": null,
    "url": "htts://actblue.com/page/BobsCandidates",
    "payment": {
        "method": "Credit Card",
        "reference_number": "1232456",
        "authorization_stored": true
    },
    "recipients": [
        {
            "amount": 20.00,
            "display_name": "Barack Obama",
            "legal_name": "Obama for America"
        },
        {
            "amount": 20.00,
            "display_name": "Joe Candidate",
            "legal_name": "Joe for Congress"
       }
    ],
    "referrer_data": {
        "source": "api"
    },
    "_links": {
        "self": {
            "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/d91b4b2e-ae0e-4cd3-9ed7-de9uemdse"
        },
        "osdi:fundraising_page": {
            "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29"
        },
        "osdi:person": {
            "href": "https://osdi-sample-system.org/api/v1/people/65345d7d-cd24-466a-a698-4a7686ef684f"
        },
        "osdi:attendance": {
            "href": "https://osdi-sample-system.org/api/v1/events/c945d6fe-929e-11e3-a2e9-12313d316c29/attendances/d91b4b2e-ae0e-4cd3-9ed7-d0ec501b0bc"
        }
    }
}

Back to top…

Scenario: Modifying a donation (PUT)

You can update a donation by calling a PUT operation on that donation’s endpoint. Your PUT should contain fields that you want to update. Missing fields will be ignored by the receiving system. Systems may also ignore PUT values, depending on whether fields you are trying to modify are read-only or not. You may set an attribute to nil by including the attribute using nil for value.

Note: Modifying members of an array separately is not supported. To change the contents of an array, first GET the current contents and then PUT back only those you wish to keep.

Request

PUT https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/d91b4b2e-ae0e-4cd3-9ed7-de9uemdse/

Header:
OSDI-API-Token:[your api key here]

{
    "action_date": "2014-03-17T11:02:15Z"
}

Response

200 OK

Content-Type: application/hal+json
Cache-Control: max-age=0, private, must-revalidate

{
    "identifiers": [
        "osdi_sample_system:d91b4b2e-ae0e-4cd3-9ed7-de9uemdse",
        "foreign_system:1"
    ],
    "created_date": "2014-03-20T21:04:31Z",
    "modified_date": "2014-03-20T22:04:31Z",
    "action_date": "2014-03-17T11:02:15Z",
    "currency": "USD",
    "amount": 40.00,
    "voided": false,
    "voided_date": null,
    "url": "htts://actblue.com/page/BobsCandidates",
    "payment": {
        "method": "Credit Card",
        "reference_number": "1232456",
        "authorization_stored": true
    },
    "recipients": [
        {
            "amount": 20.00,
            "display_name": "Barack Obama",
            "legal_name": "Obama for America"
        },
        {
            "amount": 20.00,
            "display_name": "Joe Candidate",
            "legal_name": "Joe for Congress"
       }
    ],
    "referrer_data": {
        "source": "facebook-101016-mainpage",
        "referrer": "jane-doe",
        "website": "facebook.com",
        "url": "https://facebook.com/posts/12345"
    },
    "_links": {
        "self": {
            "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/d91b4b2e-ae0e-4cd3-9ed7-de9uemdse"
        },
        "osdi:fundraising_page": {
            "href": "https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29"
        },
        "osdi:person": {
            "href": "https://osdi-sample-system.org/api/v1/people/65345d7d-cd24-466a-a698-4a7686ef684f"
        }
    }
}

Back to top…

Scenario: Deleting a donation (DELETE)

You may delete a donation by calling the DELETE command on the donation’s endpoint.

Request

DELETE https://osdi-sample-system.org/api/v1/fundraising_pages/c945d6fe-929e-11e3-a2e9-12313d316c29/donations/d91b4b2e-ae0e-4cd3-9ed7-de9uemdse

Header:
OSDI-API-Token:[your api key here]

Response

200 OK

Content-Type: application/hal+json
Cache-Control: max-age=0, private, must-revalidate

{
    "notice": "This donation was successfully deleted."
}

Back to top…