Funds API

The API for viewing and managing funds for an organization


List Funds Visible on a Merchant

GET /v1/merchant/{merchantKey}/funds

Returns an ordered list of funds visible on a merchant listing and the default fund (if one is set).

Path (URL) Parameters

Name Type Description
merchantKey string

The unique key of the merchant - a case-sensitive series of characters

Required Scopes

Scope Description
read Read-only access to resources owned by the subject claim of the token

List funds for a merchant listing that has a default fund

Request

GET /v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/funds

Headers

Name Value Description
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw path

The unique key of the merchant - a case-sensitive series of characters

Response

Status 200 (OK)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Response

{ "defaultFund": { "key": "EC7Aj04kaemLN8XnyuDTnQ", "name": "Tithes", "code": "1000", "taxDeductible": true, "notes": "General fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ" } } }, "funds": [ { "key": "EC7Aj04kaemLN8XnyuDTnQ", "name": "Tithes", "code": "1000", "taxDeductible": true, "notes": "General fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ" } } }, { "key": "W8AxOXxp9fK82aNXfLqGrQ", "name": "Building", "code": "1001", "taxDeductible": false, "notes": "New church building fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/W8AxOXxp9fK82aNXfLqGrQ" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/funds" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "organization": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA" } } }
<?php
/*
	Example 1
	List funds for a merchant listing that has a default fund
*/
$merchantKey = 'MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/funds";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 1
 * List funds for a merchant listing that has a default fund
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/funds";

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		return httpConnection;
	}
}
# Example 1
# List funds for a merchant listing that has a default fund
set oAuthToken=%1
set merchantKey="MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/funds"

curl -i -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example1
	{

		/// <summary>
		///	Example 1
		/// </summary>
		/// <remarks>
		///	List funds for a merchant listing that has a default fund
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
				var requestUrl = string.Format("/v1/merchant/{0}/funds", merchantKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var httpResponse = await client.GetAsync(requestUrl);
				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

List funds for a merchant listing that does not have a default fund

Request

GET /v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/funds

Headers

Name Value Description
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw path

The unique key of the merchant - a case-sensitive series of characters

Response

Status 200 (OK)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Response

{ "funds": [ { "key": "EC7Aj04kaemLN8XnyuDTnQ", "name": "Tithes", "code": "1000", "taxDeductible": true, "notes": "General fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ" } } }, { "key": "W8AxOXxp9fK82aNXfLqGrQ", "name": "Building", "code": "1001", "taxDeductible": false, "notes": "New church building fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/W8AxOXxp9fK82aNXfLqGrQ" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/funds" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "organization": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA" } } }
<?php
/*
	Example 2
	List funds for a merchant listing that does not have a default fund
*/
$merchantKey = 'MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/funds";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 2
 * List funds for a merchant listing that does not have a default fund
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/funds";

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		return httpConnection;
	}
}
# Example 2
# List funds for a merchant listing that does not have a default fund
set oAuthToken=%1
set merchantKey="MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/funds"

curl -i -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example2
	{

		/// <summary>
		///	Example 2
		/// </summary>
		/// <remarks>
		///	List funds for a merchant listing that does not have a default fund
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
				var requestUrl = string.Format("/v1/merchant/{0}/funds", merchantKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var httpResponse = await client.GetAsync(requestUrl);
				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

Delete an Existing Fund

DELETE /v1/organization/{organizationKey}/fund/{fundKey}

Path (URL) Parameters

Name Type Description
organizationKey string

The unique key of the organization - a case-sensitive series of characters

fundKey string

The unique key of the fund - a case-sensitive series of characters

Required Scopes

Scope Description
organization:manage_funds Open, Update, Close and Delete funds

Delete a fund

Request

DELETE /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ

Headers

Name Value Description
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

fundKey EC7Aj04kaemLN8XnyuDTnQ path

The unique key of the fund - a case-sensitive series of characters

Response

Status 204 (No Content)

Code Samples

No JSON content

<?php
/*
	Example 1
	Delete a fund
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$fundKey = 'EC7Aj04kaemLN8XnyuDTnQ';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/fund/$fundKey";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 1
 * Delete a fund
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/fund/" + fundKey;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("DELETE");
		httpConnection.setDoOutput(true);
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		httpConnection.disconnect();
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("DELETE");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 1
# Delete a fund
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set fundKey="EC7Aj04kaemLN8XnyuDTnQ"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/fund/%fundKey%"

curl -i -H "Authorization: Bearer %oAuthToken%" -X DELETE %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example1
	{

		/// <summary>
		///	Example 1
		/// </summary>
		/// <remarks>
		///	Delete a fund
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
				var requestUrl = string.Format("/v1/organization/{0}/fund/{1}", organizationKey, fundKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var httpResponse = await client.DeleteAsync(requestUrl);
				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

Attempting to delete a fund with existing payment schedules

Request

DELETE /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ

Headers

Name Value Description
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

fundKey EC7Aj04kaemLN8XnyuDTnQ path

The unique key of the fund - a case-sensitive series of characters

Response

Status 422 (Unprocessable Entity)

Code Samples

Response

{ "message": "Cannot delete fund due to active schedules and/or past payments made to this fund" }
<?php
/*
	Example 2
	Attempting to delete a fund with existing payment schedules
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$fundKey = 'EC7Aj04kaemLN8XnyuDTnQ';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/fund/$fundKey";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 2
 * Attempting to delete a fund with existing payment schedules
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/fund/" + fundKey;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("DELETE");
		httpConnection.setDoOutput(true);
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("DELETE");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 2
# Attempting to delete a fund with existing payment schedules
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set fundKey="EC7Aj04kaemLN8XnyuDTnQ"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/fund/%fundKey%"

curl -i -H "Authorization: Bearer %oAuthToken%" -X DELETE %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example2
	{

		/// <summary>
		///	Example 2
		/// </summary>
		/// <remarks>
		///	Attempting to delete a fund with existing payment schedules
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
				var requestUrl = string.Format("/v1/organization/{0}/fund/{1}", organizationKey, fundKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var httpResponse = await client.DeleteAsync(requestUrl);
				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

Get Fund for an Organization

GET /v1/organization/{organizationKey}/fund/{fundKey}

Returns a single organization fund identified by its fund key

Path (URL) Parameters

Name Type Description
organizationKey string

The unique key of the organization - a case-sensitive series of characters

fundKey string

The unique key of the fund - a case-sensitive series of characters

Required Scopes

Scope Description
read Read-only access to resources owned by the subject claim of the token

Get fund by its key

Request

GET /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ

Headers

Name Value Description
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

fundKey EC7Aj04kaemLN8XnyuDTnQ path

The unique key of the fund - a case-sensitive series of characters

Response

Status 200 (OK)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Response

{ "key": "EC7Aj04kaemLN8XnyuDTnQ", "name": "Tithes", "code": "1000", "taxDeductible": true, "notes": "General fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ" } } }
<?php
/*
	Example 1
	Get fund by its key
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$fundKey = 'EC7Aj04kaemLN8XnyuDTnQ';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/fund/$fundKey";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 1
 * Get fund by its key
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/fund/" + fundKey;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		return httpConnection;
	}
}
# Example 1
# Get fund by its key
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set fundKey="EC7Aj04kaemLN8XnyuDTnQ"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/fund/%fundKey%"

curl -i -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example1
	{

		/// <summary>
		///	Example 1
		/// </summary>
		/// <remarks>
		///	Get fund by its key
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
				var requestUrl = string.Format("/v1/organization/{0}/fund/{1}", organizationKey, fundKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var httpResponse = await client.GetAsync(requestUrl);
				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

Change Fund Status

PATCH /v1/organization/{organizationKey}/fund/{fundKey}

Changes the status of a fund belonging to an organization.

Path (URL) Parameters

Name Type Description
organizationKey string

The unique key of the organization - a case-sensitive series of characters

fundKey string

The unique key of the fund - a case-sensitive series of characters

Required Scopes

Scope Description
organization:manage_funds Open, Update, Close and Delete funds

Close existing fund

Request

PATCH /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ

Headers

Name Value Description
Content-Type application/json
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

fundKey EC7Aj04kaemLN8XnyuDTnQ path

The unique key of the fund - a case-sensitive series of characters

Response

Status 200 (OK)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "status": "Closed" }

Response

{ "key": "EC7Aj04kaemLN8XnyuDTnQ", "name": "General/Tithe", "code": "100", "taxDeductible": true, "notes": "General/Tithe fund", "status": "Closed", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ" } } }
<?php
/*
	Example 1
	Close existing fund
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$fundKey = 'EC7Aj04kaemLN8XnyuDTnQ';
$requestBody = '{
  "status": "Closed"
}';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/fund/$fundKey";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Content-Type: application/json",
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 1
 * Close existing fund
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/fund/" + fundKey;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"status\": \"Closed\"" + 
			"}";
		OutputStream outputStream = httpConnection.getOutputStream();
		outputStream.write(requestBody.getBytes("UTF-8"));
		outputStream.close();
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Content-Type", "application/json");
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 1
# Close existing fund
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set fundKey="EC7Aj04kaemLN8XnyuDTnQ"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/fund/%fundKey%"
set requestBody="{\"status\": \"Closed\"}"

curl -i -H "Content-Type: application/json" -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" -d %requestBody% -X PATCH %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example1
	{

		/// <summary>
		///	Example 1
		/// </summary>
		/// <remarks>
		///	Close existing fund
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
				var requestUrl = string.Format("/v1/organization/{0}/fund/{1}", organizationKey, fundKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var jsonString = JsonConvert.SerializeObject(new {
					  status = "Closed"
					});
				var body = new StringContent(jsonString, Encoding.UTF8, "application/json");
				var requestMessage = new HttpRequestMessage(new HttpMethod("PATCH"), requestUrl) { Content = body };

				var httpResponse = await client.SendAsync(requestMessage);

				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

Close fund with active payment schedules

Request

PATCH /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ

Headers

Name Value Description
Content-Type application/json
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

fundKey EC7Aj04kaemLN8XnyuDTnQ path

The unique key of the fund - a case-sensitive series of characters

Response

Status 422 (Unprocessable Entity)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "status": "Closed" }

Response

{ "message": "Cannot close fund with active schedules" }
<?php
/*
	Example 2
	Close fund with active payment schedules
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$fundKey = 'EC7Aj04kaemLN8XnyuDTnQ';
$requestBody = '{
  "status": "Closed"
}';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/fund/$fundKey";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Content-Type: application/json",
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 2
 * Close fund with active payment schedules
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/fund/" + fundKey;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"status\": \"Closed\"" + 
			"}";
		OutputStream outputStream = httpConnection.getOutputStream();
		outputStream.write(requestBody.getBytes("UTF-8"));
		outputStream.close();
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Content-Type", "application/json");
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 2
# Close fund with active payment schedules
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set fundKey="EC7Aj04kaemLN8XnyuDTnQ"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/fund/%fundKey%"
set requestBody="{\"status\": \"Closed\"}"

curl -i -H "Content-Type: application/json" -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" -d %requestBody% -X PATCH %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example2
	{

		/// <summary>
		///	Example 2
		/// </summary>
		/// <remarks>
		///	Close fund with active payment schedules
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
				var requestUrl = string.Format("/v1/organization/{0}/fund/{1}", organizationKey, fundKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var jsonString = JsonConvert.SerializeObject(new {
					  status = "Closed"
					});
				var body = new StringContent(jsonString, Encoding.UTF8, "application/json");
				var requestMessage = new HttpRequestMessage(new HttpMethod("PATCH"), requestUrl) { Content = body };

				var httpResponse = await client.SendAsync(requestMessage);

				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

Update Existing Fund for Organization

PUT /v1/organization/{organizationKey}/fund/{fundKey}

Updates the info for a fund belonging to an organization.

Path (URL) Parameters

Name Type Description
organizationKey string

The unique key of the organization - a case-sensitive series of characters

fundKey string

The unique key of the fund - a case-sensitive series of characters

Required Scopes

Scope Description
organization:manage_funds Open, Update, Close and Delete funds

Update existing fund

Request

PUT /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ

Headers

Name Value Description
Content-Type application/json
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

fundKey EC7Aj04kaemLN8XnyuDTnQ path

The unique key of the fund - a case-sensitive series of characters

Response

Status 200 (OK)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "name": "General/Tithe", "notes": "General/Tithe fund", "code": "100", "taxDeductible": true }

Response

{ "key": "EC7Aj04kaemLN8XnyuDTnQ", "name": "General/Tithe", "code": "100", "taxDeductible": true, "notes": "General/Tithe fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ" } } }
<?php
/*
	Example 1
	Update existing fund
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$fundKey = 'EC7Aj04kaemLN8XnyuDTnQ';
$requestBody = '{
  "name": "General/Tithe",
  "notes": "General/Tithe fund",
  "code": "100",
  "taxDeductible": true
}';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/fund/$fundKey";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Content-Type: application/json",
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 1
 * Update existing fund
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/fund/" + fundKey;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PUT");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"name\": \"General/Tithe\"," + 
			"  \"notes\": \"General/Tithe fund\"," + 
			"  \"code\": \"100\"," + 
			"  \"taxDeductible\": true" + 
			"}";
		OutputStream outputStream = httpConnection.getOutputStream();
		outputStream.write(requestBody.getBytes("UTF-8"));
		outputStream.close();
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Content-Type", "application/json");
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("PUT");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 1
# Update existing fund
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set fundKey="EC7Aj04kaemLN8XnyuDTnQ"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/fund/%fundKey%"
set requestBody="{\"name\": \"General/Tithe\",\"notes\": \"General/Tithe fund\",\"code\": \"100\",\"taxDeductible\": true}"

curl -i -H "Content-Type: application/json" -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" -d %requestBody% -X PUT %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example1
	{

		/// <summary>
		///	Example 1
		/// </summary>
		/// <remarks>
		///	Update existing fund
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
				var requestUrl = string.Format("/v1/organization/{0}/fund/{1}", organizationKey, fundKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var jsonString = JsonConvert.SerializeObject(new {
					  name = "General/Tithe",
					  notes = "General/Tithe fund",
					  code = "100",
					  taxDeductible = true});
				var body = new StringContent(jsonString, Encoding.UTF8, "application/json");
				var requestMessage = new HttpRequestMessage(HttpMethod.Put, requestUrl) { Content = body };

				var httpResponse = await client.SendAsync(requestMessage);

				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

Update fund with name and code of an existing fund

Request

PUT /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ

Headers

Name Value Description
Content-Type application/json
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

fundKey EC7Aj04kaemLN8XnyuDTnQ path

The unique key of the fund - a case-sensitive series of characters

Response

Status 422 (Unprocessable Entity)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "name": "General", "notes": "General/Tithe fund", "code": "100", "taxDeductible": true }

Response

{ "validationFailures": { "name": [ "A fund with the name 'General' and the code '100' already exists" ] } }
<?php
/*
	Example 2
	Update fund with name and code of an existing fund
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$fundKey = 'EC7Aj04kaemLN8XnyuDTnQ';
$requestBody = '{
  "name": "General",
  "notes": "General/Tithe fund",
  "code": "100",
  "taxDeductible": true
}';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/fund/$fundKey";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Content-Type: application/json",
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 2
 * Update fund with name and code of an existing fund
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/fund/" + fundKey;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PUT");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"name\": \"General\"," + 
			"  \"notes\": \"General/Tithe fund\"," + 
			"  \"code\": \"100\"," + 
			"  \"taxDeductible\": true" + 
			"}";
		OutputStream outputStream = httpConnection.getOutputStream();
		outputStream.write(requestBody.getBytes("UTF-8"));
		outputStream.close();
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Content-Type", "application/json");
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("PUT");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 2
# Update fund with name and code of an existing fund
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set fundKey="EC7Aj04kaemLN8XnyuDTnQ"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/fund/%fundKey%"
set requestBody="{\"name\": \"General\",\"notes\": \"General/Tithe fund\",\"code\": \"100\",\"taxDeductible\": true}"

curl -i -H "Content-Type: application/json" -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" -d %requestBody% -X PUT %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example2
	{

		/// <summary>
		///	Example 2
		/// </summary>
		/// <remarks>
		///	Update fund with name and code of an existing fund
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var fundKey = "EC7Aj04kaemLN8XnyuDTnQ";
				var requestUrl = string.Format("/v1/organization/{0}/fund/{1}", organizationKey, fundKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var jsonString = JsonConvert.SerializeObject(new {
					  name = "General",
					  notes = "General/Tithe fund",
					  code = "100",
					  taxDeductible = true});
				var body = new StringContent(jsonString, Encoding.UTF8, "application/json");
				var requestMessage = new HttpRequestMessage(HttpMethod.Put, requestUrl) { Content = body };

				var httpResponse = await client.SendAsync(requestMessage);

				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

List Funds for an Organization

GET /v1/organization/{organizationKey}/funds

Returns a list of organization funds filtered by status.

Note: Unfiltered requests will return organization funds of Status = Open.

Path (URL) Parameters

Name Type Description
organizationKey string

The unique key of the organization - a case-sensitive series of characters

Query string (URL) parameters

Name Type Description
fundStatus string

Only include funds with the specified status (All, Open or Closed). If status is not explicitly set then only funds with status 'Open' will be returned.

Required Scopes

Scope Description
read Read-only access to resources owned by the subject claim of the token

List open funds for organization

Request

GET /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/funds

Headers

Name Value Description
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

Response

Status 200 (OK)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Response

{ "items": [ { "key": "W8AxOXxp9fK82aNXfLqGrQ", "name": "Building", "code": "1001", "taxDeductible": false, "notes": "New church building fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/W8AxOXxp9fK82aNXfLqGrQ" } } }, { "key": "EC7Aj04kaemLN8XnyuDTnQ", "name": "Tithes", "code": "1000", "taxDeductible": true, "notes": "General fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/funds" } } }
<?php
/*
	Example 1
	List open funds for organization
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/funds";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 1
 * List open funds for organization
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/funds;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		return httpConnection;
	}
}
# Example 1
# List open funds for organization
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/funds"

curl -i -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example1
	{

		/// <summary>
		///	Example 1
		/// </summary>
		/// <remarks>
		///	List open funds for organization
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var requestUrl = string.Format("/v1/organization/{0}/funds", organizationKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var httpResponse = await client.GetAsync(requestUrl);
				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

List all funds for organization

Request

GET /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/funds?fundStatus=All

Headers

Name Value Description
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

fundStatus All query

Only include funds with the specified status (All, Open or Closed). If status is not explicitly set then only funds with status 'Open' will be returned.

Response

Status 200 (OK)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Response

{ "items": [ { "key": "W8AxOXxp9fK82aNXfLqGrQ", "name": "Building", "code": "1001", "taxDeductible": false, "notes": "New church building fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/W8AxOXxp9fK82aNXfLqGrQ" } } }, { "key": "EC7Aj04kaemLN8XnyuDTnQ", "name": "Tithes", "code": "1000", "taxDeductible": true, "notes": "General fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ" } } }, { "key": "D3v0F3plRhiFV9Lp3s9xa3", "name": "Terminal", "code": "1002", "taxDeductible": true, "notes": "General fund", "status": "Closed", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/D3v0F3plRhiFV9Lp3s9xa3" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/funds" } } }
<?php
/*
	Example 2
	List all funds for organization
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$fundStatus = 'All';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/funds?fundStatus=$fundStatus";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 2
 * List all funds for organization
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String fundStatus = "All";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/funds?fundStatus=" + fundStatus;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		return httpConnection;
	}
}
# Example 2
# List all funds for organization
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set fundStatus="All"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/funds?fundStatus=%fundStatus%"

curl -i -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example2
	{

		/// <summary>
		///	Example 2
		/// </summary>
		/// <remarks>
		///	List all funds for organization
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var fundStatus = "All";
				var requestUrl = string.Format("/v1/organization/{0}/funds?fundStatus={1}", organizationKey, 
					fundStatus);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var httpResponse = await client.GetAsync(requestUrl);
				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}

Open New Fund for Organization

POST /v1/organization/{organizationKey}/funds

Path (URL) Parameters

Name Type Description
organizationKey string

The unique key of the organization - a case-sensitive series of characters

Required Scopes

Scope Description
organization:manage_funds Open, Update, Close and Delete funds

Example 1

Open new fund

Request

POST /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/funds

Headers

Name Value Description
Content-Type application/json
Accept application/hal+json
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

The unique key of the organization - a case-sensitive series of characters

Response

Status 201 (Created)

Headers

Name Value Description
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "name": "General", "notes": "General/Tithe fund", "code": "100", "taxDeductible": true }

Response

{ "key": "EC7Aj04kaemLN8XnyuDTnQ", "name": "General", "code": "100", "taxDeductible": true, "notes": "General/Tithe fund", "status": "Open", "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/fund/EC7Aj04kaemLN8XnyuDTnQ" } } }
<?php
/*
	Example 1
	Open new fund
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$requestBody = '{
  "name": "General",
  "notes": "General/Tithe fund",
  "code": "100",
  "taxDeductible": true
}';
$url = "https://api.pushpay.com/v1/organization/$organizationKey/funds";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Content-Type: application/json",
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
// Store the link to the created item in a variable
$selfLink = $jsonResponse['_links']['self']['href'];
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 1
 * Open new fund
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/funds";

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("POST");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"name\": \"General\"," + 
			"  \"notes\": \"General/Tithe fund\"," + 
			"  \"code\": \"100\"," + 
			"  \"taxDeductible\": true" + 
			"}";
		OutputStream outputStream = httpConnection.getOutputStream();
		outputStream.write(requestBody.getBytes("UTF-8"));
		outputStream.close();
		if (httpConnection.getResponseCode() >= 400) {
			System.out.println(httpConnection.getResponseCode() +
				" Error: " + httpConnection.getResponseMessage());
		}
		InputStream inputStream = httpConnection.getInputStream();
		// Store the JSON response as a Java object
		Response response = getJsonResponse(inputStream);
		inputStream.close();
		// Store the link to the created item in a variable
		URL selfLink = response._links.self.href;
		httpConnection.disconnect();
	}

	class Response {
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
	}

	class Link {
		public URL href;
	}

	private static Response getJsonResponse(InputStream inputStream) throws IOException {
		BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream));
		String jsonString = "";
		while (streamReader.ready()) {
			jsonString += streamReader.readLine();
		}
		return (new Gson()).fromJson(jsonString, Response.class);
	}

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Content-Type", "application/json");
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("POST");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 1
# Open new fund
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set url="https://api.pushpay.com/v1/organization/%organizationKey%/funds"
set requestBody="{\"name\": \"General\",\"notes\": \"General/Tithe fund\",\"code\": \"100\",\"taxDeductible\": true}"

curl -i -H "Content-Type: application/json" -H "Accept: application/hal+json" -H "Authorization: Bearer %oAuthToken%" -d %requestBody% -X POST %url%
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Examples
{
	public class Example1
	{

		/// <summary>
		///	Example 1
		/// </summary>
		/// <remarks>
		///	Open new fund
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var requestUrl = string.Format("/v1/organization/{0}/funds", organizationKey);

				client.BaseAddress = new Uri("https://api.pushpay.com");
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
				client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", oAuthToken);

				var jsonString = JsonConvert.SerializeObject(new {
					  name = "General",
					  notes = "General/Tithe fund",
					  code = "100",
					  taxDeductible = true});
				var body = new StringContent(jsonString, Encoding.UTF8, "application/json");
				var requestMessage = new HttpRequestMessage(HttpMethod.Post, requestUrl) { Content = body };

				var httpResponse = await client.SendAsync(requestMessage);

				if (httpResponse.IsSuccessStatusCode) {
					var content = await httpResponse.Content.ReadAsStringAsync();
					var response = JsonConvert.DeserializeObject<Response>(
						content, new JsonSerializerSettings {
							ContractResolver = new CamelCasePropertyNamesContractResolver()
					});
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		[JsonProperty(PropertyName = "_links")]
		public Links Links { get; set; }
		// The JSON properties you require should be added here as properties
	}

	public class Links
	{
		public Link Self { get; set; }
	}

	public class Link {
		public Uri Href { get; set; }
	}
}