Donations
Add a new donation
POST
/
admin
/
donation
Add a new donation
curl --request POST \
--url https://api.gratona.com/v1/admin/donation \
--header 'Content-Type: application/json' \
--header 'X-HYS-API-Key: <api-key>' \
--data '
{
"designation": "entity-1",
"donor_id": "1",
"amount": 10,
"split_amounts": [
6,
4
],
"dont_notify": 1,
"charge_donor": 1,
"method": "3",
"result": "result note",
"client_id": "1",
"created_at": "2022-01-01",
"addSoftCredit": true,
"soft_credit_donor_id": 2,
"soft_credit_type": 1,
"soft_credit_amount": 5,
"soft_credit_split_amounts": [
3,
2
]
}
'import requests
url = "https://api.gratona.com/v1/admin/donation"
payload = {
"designation": "entity-1",
"donor_id": "1",
"amount": 10,
"split_amounts": [6, 4],
"dont_notify": 1,
"charge_donor": 1,
"method": "3",
"result": "result note",
"client_id": "1",
"created_at": "2022-01-01",
"addSoftCredit": True,
"soft_credit_donor_id": 2,
"soft_credit_type": 1,
"soft_credit_amount": 5,
"soft_credit_split_amounts": [3, 2]
}
headers = {
"X-HYS-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-HYS-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
designation: 'entity-1',
donor_id: '1',
amount: 10,
split_amounts: [6, 4],
dont_notify: 1,
charge_donor: 1,
method: '3',
result: 'result note',
client_id: '1',
created_at: '2022-01-01',
addSoftCredit: true,
soft_credit_donor_id: 2,
soft_credit_type: 1,
soft_credit_amount: 5,
soft_credit_split_amounts: [3, 2]
})
};
fetch('https://api.gratona.com/v1/admin/donation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gratona.com/v1/admin/donation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'designation' => 'entity-1',
'donor_id' => '1',
'amount' => 10,
'split_amounts' => [
6,
4
],
'dont_notify' => 1,
'charge_donor' => 1,
'method' => '3',
'result' => 'result note',
'client_id' => '1',
'created_at' => '2022-01-01',
'addSoftCredit' => true,
'soft_credit_donor_id' => 2,
'soft_credit_type' => 1,
'soft_credit_amount' => 5,
'soft_credit_split_amounts' => [
3,
2
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-HYS-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/donation"
payload := strings.NewReader("{\n \"designation\": \"entity-1\",\n \"donor_id\": \"1\",\n \"amount\": 10,\n \"split_amounts\": [\n 6,\n 4\n ],\n \"dont_notify\": 1,\n \"charge_donor\": 1,\n \"method\": \"3\",\n \"result\": \"result note\",\n \"client_id\": \"1\",\n \"created_at\": \"2022-01-01\",\n \"addSoftCredit\": true,\n \"soft_credit_donor_id\": 2,\n \"soft_credit_type\": 1,\n \"soft_credit_amount\": 5,\n \"soft_credit_split_amounts\": [\n 3,\n 2\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-HYS-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gratona.com/v1/admin/donation")
.header("X-HYS-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"designation\": \"entity-1\",\n \"donor_id\": \"1\",\n \"amount\": 10,\n \"split_amounts\": [\n 6,\n 4\n ],\n \"dont_notify\": 1,\n \"charge_donor\": 1,\n \"method\": \"3\",\n \"result\": \"result note\",\n \"client_id\": \"1\",\n \"created_at\": \"2022-01-01\",\n \"addSoftCredit\": true,\n \"soft_credit_donor_id\": 2,\n \"soft_credit_type\": 1,\n \"soft_credit_amount\": 5,\n \"soft_credit_split_amounts\": [\n 3,\n 2\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/donation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-HYS-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"designation\": \"entity-1\",\n \"donor_id\": \"1\",\n \"amount\": 10,\n \"split_amounts\": [\n 6,\n 4\n ],\n \"dont_notify\": 1,\n \"charge_donor\": 1,\n \"method\": \"3\",\n \"result\": \"result note\",\n \"client_id\": \"1\",\n \"created_at\": \"2022-01-01\",\n \"addSoftCredit\": true,\n \"soft_credit_donor_id\": 2,\n \"soft_credit_type\": 1,\n \"soft_credit_amount\": 5,\n \"soft_credit_split_amounts\": [\n 3,\n 2\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Donation Successful"
}Authorizations
apiKeyAuthbearerAuth
Gratona API key sent with the compatibility header X-HYS-API-Key.
Body
application/json
Donation data
One designation reference, or an array aligned with split_amounts. Any array-shaped value is validated as a split request, including a one-item array.
Example:
"entity-1"
Example:
"1"
Example:
10
Positive allocation amounts that match designation cardinality and equal amount in integer cents. A valid one-item split is persisted as a normal single donation.
Example:
[6, 4]
Example:
1
Example:
1
Example:
"3"
Optional donation note. Null or omitted values are persisted as an empty string.
Example:
"result note"
Example:
"1"
Example:
"2022-01-01"
Example:
true
Example:
2
Example:
1
Example:
5
Example:
[3, 2]
Response
Successful operation
Example:
"Donation Successful"
⌘I
Add a new donation
curl --request POST \
--url https://api.gratona.com/v1/admin/donation \
--header 'Content-Type: application/json' \
--header 'X-HYS-API-Key: <api-key>' \
--data '
{
"designation": "entity-1",
"donor_id": "1",
"amount": 10,
"split_amounts": [
6,
4
],
"dont_notify": 1,
"charge_donor": 1,
"method": "3",
"result": "result note",
"client_id": "1",
"created_at": "2022-01-01",
"addSoftCredit": true,
"soft_credit_donor_id": 2,
"soft_credit_type": 1,
"soft_credit_amount": 5,
"soft_credit_split_amounts": [
3,
2
]
}
'import requests
url = "https://api.gratona.com/v1/admin/donation"
payload = {
"designation": "entity-1",
"donor_id": "1",
"amount": 10,
"split_amounts": [6, 4],
"dont_notify": 1,
"charge_donor": 1,
"method": "3",
"result": "result note",
"client_id": "1",
"created_at": "2022-01-01",
"addSoftCredit": True,
"soft_credit_donor_id": 2,
"soft_credit_type": 1,
"soft_credit_amount": 5,
"soft_credit_split_amounts": [3, 2]
}
headers = {
"X-HYS-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-HYS-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
designation: 'entity-1',
donor_id: '1',
amount: 10,
split_amounts: [6, 4],
dont_notify: 1,
charge_donor: 1,
method: '3',
result: 'result note',
client_id: '1',
created_at: '2022-01-01',
addSoftCredit: true,
soft_credit_donor_id: 2,
soft_credit_type: 1,
soft_credit_amount: 5,
soft_credit_split_amounts: [3, 2]
})
};
fetch('https://api.gratona.com/v1/admin/donation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gratona.com/v1/admin/donation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'designation' => 'entity-1',
'donor_id' => '1',
'amount' => 10,
'split_amounts' => [
6,
4
],
'dont_notify' => 1,
'charge_donor' => 1,
'method' => '3',
'result' => 'result note',
'client_id' => '1',
'created_at' => '2022-01-01',
'addSoftCredit' => true,
'soft_credit_donor_id' => 2,
'soft_credit_type' => 1,
'soft_credit_amount' => 5,
'soft_credit_split_amounts' => [
3,
2
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-HYS-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gratona.com/v1/admin/donation"
payload := strings.NewReader("{\n \"designation\": \"entity-1\",\n \"donor_id\": \"1\",\n \"amount\": 10,\n \"split_amounts\": [\n 6,\n 4\n ],\n \"dont_notify\": 1,\n \"charge_donor\": 1,\n \"method\": \"3\",\n \"result\": \"result note\",\n \"client_id\": \"1\",\n \"created_at\": \"2022-01-01\",\n \"addSoftCredit\": true,\n \"soft_credit_donor_id\": 2,\n \"soft_credit_type\": 1,\n \"soft_credit_amount\": 5,\n \"soft_credit_split_amounts\": [\n 3,\n 2\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-HYS-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gratona.com/v1/admin/donation")
.header("X-HYS-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"designation\": \"entity-1\",\n \"donor_id\": \"1\",\n \"amount\": 10,\n \"split_amounts\": [\n 6,\n 4\n ],\n \"dont_notify\": 1,\n \"charge_donor\": 1,\n \"method\": \"3\",\n \"result\": \"result note\",\n \"client_id\": \"1\",\n \"created_at\": \"2022-01-01\",\n \"addSoftCredit\": true,\n \"soft_credit_donor_id\": 2,\n \"soft_credit_type\": 1,\n \"soft_credit_amount\": 5,\n \"soft_credit_split_amounts\": [\n 3,\n 2\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/donation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-HYS-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"designation\": \"entity-1\",\n \"donor_id\": \"1\",\n \"amount\": 10,\n \"split_amounts\": [\n 6,\n 4\n ],\n \"dont_notify\": 1,\n \"charge_donor\": 1,\n \"method\": \"3\",\n \"result\": \"result note\",\n \"client_id\": \"1\",\n \"created_at\": \"2022-01-01\",\n \"addSoftCredit\": true,\n \"soft_credit_donor_id\": 2,\n \"soft_credit_type\": 1,\n \"soft_credit_amount\": 5,\n \"soft_credit_split_amounts\": [\n 3,\n 2\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Donation Successful"
}