Donations
Refund a donation
POST
/
admin
/
donation
/
{donation_id}
/
refund
Refund a donation
curl --request POST \
--url https://api.gratona.com/v1/admin/donation/{donation_id}/refund \
--header 'Content-Type: application/json' \
--header 'X-HYS-API-Key: <api-key>' \
--data '{
"amount": 25
}'import requests
url = "https://api.gratona.com/v1/admin/donation/{donation_id}/refund"
payload = { "amount": 25 }
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({amount: 25})
};
fetch('https://api.gratona.com/v1/admin/donation/{donation_id}/refund', 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/{donation_id}/refund",
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([
'amount' => 25
]),
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/{donation_id}/refund"
payload := strings.NewReader("{\n \"amount\": 25\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/{donation_id}/refund")
.header("X-HYS-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 25\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/donation/{donation_id}/refund")
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 \"amount\": 25\n}"
response = http.request(request)
puts response.read_body{
"message": "Donation successfully refunded."
}{
"message": "Error: Invalid input"
}{
"message": "Donation not found."
}Authorizations
apiKeyAuthbearerAuth
Gratona API key sent with the compatibility header X-HYS-API-Key.
Headers
Stable client-generated operation key. Reuse it when retrying the same refund request.
Maximum string length:
255Path Parameters
ID of the donation to be refunded
Body
application/json
Amount to refund. Defaults to the donation's full remaining amount when omitted.
Required range:
x >= 0.01Example:
25
Response
Donation successfully refunded.
Example:
"Donation successfully refunded."
⌘I
Refund a donation
curl --request POST \
--url https://api.gratona.com/v1/admin/donation/{donation_id}/refund \
--header 'Content-Type: application/json' \
--header 'X-HYS-API-Key: <api-key>' \
--data '{
"amount": 25
}'import requests
url = "https://api.gratona.com/v1/admin/donation/{donation_id}/refund"
payload = { "amount": 25 }
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({amount: 25})
};
fetch('https://api.gratona.com/v1/admin/donation/{donation_id}/refund', 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/{donation_id}/refund",
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([
'amount' => 25
]),
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/{donation_id}/refund"
payload := strings.NewReader("{\n \"amount\": 25\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/{donation_id}/refund")
.header("X-HYS-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 25\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gratona.com/v1/admin/donation/{donation_id}/refund")
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 \"amount\": 25\n}"
response = http.request(request)
puts response.read_body{
"message": "Donation successfully refunded."
}{
"message": "Error: Invalid input"
}{
"message": "Donation not found."
}