Community API

The API for viewing & querying a merchant's community of payers


View Merchant's Community

GET /v1/merchant/{merchantKey}/community

Retrieves the details of all payers who have recently given to a merchant

Path (URL) Parameters

Name Type Description
merchantKey string

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

Query string (URL) parameters

Name Type Description
filterBy string

Filter community members shown to those whose email, full name, or mobile numbers contain this string

orderBy string

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'

page integer

The page parameter (Note: page numbering starts at 0)

Required Scopes

Scope Description
merchant:view_community_members List payers in a merchant's community

Get a merchant's community

Request

GET /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community?page=0

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 MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

filterBy query

Filter community members shown to those whose email, full name, or mobile numbers contain this string

orderBy query

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'

page 0 query

The page parameter (Note: page numbering starts at 0)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 3, "totalPages": 1, "items": [ { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "first@test.com", "emailAddressVerified": false, "mobileNumber": "+12025551234", "mobileNumberVerified": false, "fullName": "John Doe", "firstName": "John", "lastName": "Doe", "role": "individual", "payerType": "Guest", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "second@test.com", "emailAddressVerified": true, "mobileNumberVerified": false, "fullName": "Jane Doe", "firstName": "Jane", "lastName": "Doe", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Guest", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "verified@email.com", "emailAddressVerified": true, "mobileNumber": "+17023328102", "mobileNumberVerified": true, "fullName": "Regular Payer", "firstName": "Regular", "lastName": "Payer", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchants/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community" } } }
<?php
/*
	Example 1
	Get a merchant's community
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$page = 0;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community?page=$page";
$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);
}
// If there is a next page, store the link to it in a variable
if (array_key_exists('next', $jsonResponse['_links'])) {
	$nextLink = $jsonResponse['_links']['next']['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
 * Get a merchant's community
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
		int page = 0;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/community?page=" + page;

		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();
		// Store the link to the next page in a variable
		URL nextLink = response._links.next.href;
		httpConnection.disconnect();
	}

	class Response {
		public int page { get; set; }
		public int pageSize { get; set; }
 		public int total { get; set; }
 		public int totalPages { get; set; }
 		public Response[] items { get; set; }
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
		public Link next;
		public Link prev;
		public Link first;
		public Link last;
	}

	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 a merchant's community
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set page=0
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community?page=%page%"

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 a merchant's community
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var page = 0;
				var requestUrl = string.Format("/v1/merchant/{0}/community?page={1}", merchantKey, page);

				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()
					});
					var nextLink = response.Links.Next;
					Console.WriteLine(nextLink);
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		public int Page { get; set; }
		public int PageSize { get; set; }
 		public int Total { get; set; }
 		public int TotalPages { get; set; }
 		public Response[] Items { get; set; }
		[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 Link Next { get; set; }
		public Link Prev { get; set; }
		public Link First { get; set; }
		public Link Last { get; set; }
	}

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

Sort community members by their FullName

Request

GET /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community?orderBy=FullName asc&page=0

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 MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

filterBy query

Filter community members shown to those whose email, full name, or mobile numbers contain this string

orderBy FullName asc query

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'

page 0 query

The page parameter (Note: page numbering starts at 0)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 3, "totalPages": 1, "items": [ { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "second@test.com", "emailAddressVerified": true, "mobileNumberVerified": false, "fullName": "Jane Doe", "firstName": "Jane", "lastName": "Doe", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Guest", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "first@test.com", "emailAddressVerified": false, "mobileNumber": "+12025551234", "mobileNumberVerified": false, "fullName": "John Doe", "firstName": "John", "lastName": "Doe", "role": "individual", "payerType": "Guest", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "verified@email.com", "emailAddressVerified": true, "mobileNumber": "+17023328102", "mobileNumberVerified": true, "fullName": "Regular Payer", "firstName": "Regular", "lastName": "Payer", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchants/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community" } } }
<?php
/*
	Example 2
	Sort community members by their FullName
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$orderBy = 'FullName asc';
$page = 0;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community?orderBy=$orderBy&page=$page";
$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);
}
// If there is a next page, store the link to it in a variable
if (array_key_exists('next', $jsonResponse['_links'])) {
	$nextLink = $jsonResponse['_links']['next']['href'];
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 2
 * Sort community members by their FullName
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
		String orderBy = "FullName asc";
		int page = 0;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/community?orderBy=" + orderBy + "&page=" + page;

		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();
		// Store the link to the next page in a variable
		URL nextLink = response._links.next.href;
		httpConnection.disconnect();
	}

	class Response {
		public int page { get; set; }
		public int pageSize { get; set; }
 		public int total { get; set; }
 		public int totalPages { get; set; }
 		public Response[] items { get; set; }
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
		public Link next;
		public Link prev;
		public Link first;
		public Link last;
	}

	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
# Sort community members by their FullName
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set orderBy="FullName asc"
set page=0
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community?orderBy=%orderBy%&page=%page%"

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>
		///	Sort community members by their FullName
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var orderBy = "FullName asc";
				var page = 0;
				var requestUrl = string.Format("/v1/merchant/{0}/community?orderBy={1}&page={2}", merchantKey, 
					orderBy, page);

				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()
					});
					var nextLink = response.Links.Next;
					Console.WriteLine(nextLink);
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		public int Page { get; set; }
		public int PageSize { get; set; }
 		public int Total { get; set; }
 		public int TotalPages { get; set; }
 		public Response[] Items { get; set; }
		[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 Link Next { get; set; }
		public Link Prev { get; set; }
		public Link First { get; set; }
		public Link Last { get; set; }
	}

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

Sort community members by an unsupported property

Request

GET /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community?orderBy=Email asc&page=0

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 MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

filterBy query

Filter community members shown to those whose email, full name, or mobile numbers contain this string

orderBy Email asc query

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'

page 0 query

The page parameter (Note: page numbering starts at 0)

Response

Status 403 (Forbidden)

Headers

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

Code Samples

Response

{ "message": "Community members can only be sorted on the FullName or UpdatedOn properties" }
<?php
/*
	Example 3
	Sort community members by an unsupported property
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$orderBy = 'Email asc';
$page = 0;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community?orderBy=$orderBy&page=$page";
$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);
}
// If there is a next page, store the link to it in a variable
if (array_key_exists('next', $jsonResponse['_links'])) {
	$nextLink = $jsonResponse['_links']['next']['href'];
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 3
 * Sort community members by an unsupported property
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
		String orderBy = "Email asc";
		int page = 0;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/community?orderBy=" + orderBy + "&page=" + page;

		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();
		// Store the link to the next page in a variable
		URL nextLink = response._links.next.href;
		httpConnection.disconnect();
	}

	class Response {
		public int page { get; set; }
		public int pageSize { get; set; }
 		public int total { get; set; }
 		public int totalPages { get; set; }
 		public Response[] items { get; set; }
		// The JSON properties you require should be added here as fields
		public _links _links = new _links();
	}

	class _links {
		public Link self;
		public Link next;
		public Link prev;
		public Link first;
		public Link last;
	}

	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 3
# Sort community members by an unsupported property
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set orderBy="Email asc"
set page=0
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community?orderBy=%orderBy%&page=%page%"

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 Example3
	{

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	Sort community members by an unsupported property
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var orderBy = "Email asc";
				var page = 0;
				var requestUrl = string.Format("/v1/merchant/{0}/community?orderBy={1}&page={2}", merchantKey, 
					orderBy, page);

				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()
					});
					var nextLink = response.Links.Next;
					Console.WriteLine(nextLink);
					return response;
				} else {
					var message = httpResponse.StatusCode + " Error";
					throw new Exception(message);
				}
			}
		}
	}

	public class Response
	{
		public int Page { get; set; }
		public int PageSize { get; set; }
 		public int Total { get; set; }
 		public int TotalPages { get; set; }
 		public Response[] Items { get; set; }
		[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 Link Next { get; set; }
		public Link Prev { get; set; }
		public Link First { get; set; }
		public Link Last { get; set; }
	}

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

Manage Merchant's Community

PATCH /v1/merchant/{merchantKey}/community

When updating a merchant's community you must:

  • Provide between 1 to 25 operations

  • Not rely on the execution order. Operations might be executed non-sequentially.

  • Have from populated on each Update operation

  • Have key populated on each Set operation

Path (URL) Parameters

Name Type Description
merchantKey string

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

Required Scopes

Scope Description
merchant:manage_community_members Manage members in a merchant's community

An example of a valid request

Request

PATCH /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community

Headers

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

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

Response

Status 202 (Accepted)

Headers

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

Code Samples

Body

{ "operations": [ { "update": { "exportKey": { "from": "1234", "to": "4561" } } }, { "update": { "exportKey": { "from": "2312", "to": "4561" } } }, { "set": { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "exportKey": "1234" } } ] }
<?php
/*
	Example 1
	An example of a valid request
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$requestBody = '{
  "operations": [
    {
      "update": {
        "exportKey": {
          "from": "1234",
          "to": "4561"
        }
      }
    },
    {
      "update": {
        "exportKey": {
          "from": "2312",
          "to": "4561"
        }
      }
    },
    {
      "set": {
        "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg",
        "exportKey": "1234"
      }
    }
  ]
}';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Content-Type: application/json",
	"Accept: application/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
 * An example of a valid request
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"operations\": [" + 
			"    {" + 
			"      \"update\": {" + 
			"        \"exportKey\": {" + 
			"          \"from\": \"1234\"," + 
			"          \"to\": \"4561\"" + 
			"        }" + 
			"      }" + 
			"    }," + 
			"    {" + 
			"      \"update\": {" + 
			"        \"exportKey\": {" + 
			"          \"from\": \"2312\"," + 
			"          \"to\": \"4561\"" + 
			"        }" + 
			"      }" + 
			"    }," + 
			"    {" + 
			"      \"set\": {" + 
			"        \"key\": \"MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg\"," + 
			"        \"exportKey\": \"1234\"" + 
			"      }" + 
			"    }" + 
			"  ]" + 
			"}";
		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/json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 1
# An example of a valid request
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community"
set requestBody="{\"operations\": [{\"update\": {\"exportKey\": {\"from\": \"1234\",\"to\": \"4561\"}}},{\"update\": {\"exportKey\": {\"from\": \"2312\",\"to\": \"4561\"}}},{\"set\": {\"key\": \"MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg\",\"exportKey\": \"1234\"}}]}"

curl -i -H "Content-Type: application/json" -H "Accept: application/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>
		///	An example of a valid request
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var requestUrl = string.Format("/v1/merchant/{0}/community", 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 jsonString = JsonConvert.SerializeObject(new {
					  operations = new [] {
					    new {
					      update = new {
					        exportKey = new {
					          from = "1234",
					          to = "4561"
					        }}},
					    new {
					      update = new {
					        exportKey = new {
					          from = "2312",
					          to = "4561"
					        }}},
					    new {
					      set = new {
					        key = "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg",
					        exportKey = "1234"
					      }}}});
				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; }
	}
}

An example of a partially processed request. When a community member for a Set operation is not found, the operation is skipped and a validation failure added to the response.

Request

PATCH /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community

Headers

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

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

Response

Status 202 (Accepted)

Headers

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

Code Samples

Body

{ "operations": [ { "update": { "exportKey": { "from": "1234", "to": "4561" } } }, { "set": { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "exportKey": "2312" } } ] }

Response

{ "message": "There were problems with some of the operations", "validationFailures": { "operations[0].set.key": [ "Community member 'MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg' does not exist" ] } }
<?php
/*
	Example 2
	An example of a partially processed request.
	
	When a community member for a Set operation is not found, the operation is skipped and a validation failure added to the response.
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$requestBody = '{
  "operations": [
    {
      "update": {
        "exportKey": {
          "from": "1234",
          "to": "4561"
        }
      }
    },
    {
      "set": {
        "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg",
        "exportKey": "2312"
      }
    }
  ]
}';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Content-Type: application/json",
	"Accept: application/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
 * An example of a partially processed request.
 * 
 * When a community member for a Set operation is not found, the operation is skipped and a validation failure added to the response.
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"operations\": [" + 
			"    {" + 
			"      \"update\": {" + 
			"        \"exportKey\": {" + 
			"          \"from\": \"1234\"," + 
			"          \"to\": \"4561\"" + 
			"        }" + 
			"      }" + 
			"    }," + 
			"    {" + 
			"      \"set\": {" + 
			"        \"key\": \"MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg\"," + 
			"        \"exportKey\": \"2312\"" + 
			"      }" + 
			"    }" + 
			"  ]" + 
			"}";
		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/json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 2
# An example of a partially processed request.
# 
# When a community member for a Set operation is not found, the operation is skipped and a validation failure added to the response.
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community"
set requestBody="{\"operations\": [{\"update\": {\"exportKey\": {\"from\": \"1234\",\"to\": \"4561\"}}},{\"set\": {\"key\": \"MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg\",\"exportKey\": \"2312\"}}]}"

curl -i -H "Content-Type: application/json" -H "Accept: application/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>
		///	An example of a partially processed request.
		///  
		///  When a community member for a Set operation is not found, the operation is skipped and a validation failure added to the response.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var requestUrl = string.Format("/v1/merchant/{0}/community", 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 jsonString = JsonConvert.SerializeObject(new {
					  operations = new [] {
					    new {
					      update = new {
					        exportKey = new {
					          from = "1234",
					          to = "4561"
					        }}},
					    new {
					      set = new {
					        key = "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg",
					        exportKey = "2312"
					      }}}});
				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; }
	}
}

An example of an invalid request. No operation has been processed.

Request

PATCH /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community

Headers

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

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

Response

Status 422 (Unprocessable Entity)

Headers

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

Code Samples

Body

{ "operations": [ { "update": { "exportKey": { "from": "", "to": "4561" } } }, { "set": { "key": "", "exportKey": "1234" } } ] }

Response

{ "message": "Validation error", "validationFailures": { "operations[0].update.exportKey.key": [ "The From field is required." ], "operations[0].set.key": [ "The Key field is required." ] } }
<?php
/*
	Example 3
	An example of an invalid request. No operation has been processed.
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$requestBody = '{
  "operations": [
    {
      "update": {
        "exportKey": {
          "from": "",
          "to": "4561"
        }
      }
    },
    {
      "set": {
        "key": "",
        "exportKey": "1234"
      }
    }
  ]
}';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Content-Type: application/json",
	"Accept: application/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 3
 * An example of an invalid request. No operation has been processed.
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"operations\": [" + 
			"    {" + 
			"      \"update\": {" + 
			"        \"exportKey\": {" + 
			"          \"from\": \"\"," + 
			"          \"to\": \"4561\"" + 
			"        }" + 
			"      }" + 
			"    }," + 
			"    {" + 
			"      \"set\": {" + 
			"        \"key\": \"\"," + 
			"        \"exportKey\": \"1234\"" + 
			"      }" + 
			"    }" + 
			"  ]" + 
			"}";
		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/json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		return httpConnection;
	}
}
# Example 3
# An example of an invalid request. No operation has been processed.
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community"
set requestBody="{\"operations\": [{\"update\": {\"exportKey\": {\"from\": \"\",\"to\": \"4561\"}}},{\"set\": {\"key\": \"\",\"exportKey\": \"1234\"}}]}"

curl -i -H "Content-Type: application/json" -H "Accept: application/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 Example3
	{

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	An example of an invalid request. No operation has been processed.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var requestUrl = string.Format("/v1/merchant/{0}/community", 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 jsonString = JsonConvert.SerializeObject(new {
					  operations = new [] {
					    new {
					      update = new {
					        exportKey = new {
					          from = "",
					          to = "4561"
					        }}},
					    new {
					      set = new {
					        key = "",
					        exportKey = "1234"
					      }}}});
				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; }
	}
}

View a Community Member

GET /v1/merchant/{merchantKey}/community/{memberKey}

Retrieves the details of specific payer in a merchant's community

Path (URL) Parameters

Name Type Description
merchantKey string

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

memberKey string

The unique key of the community member - a case-sensitive series of characters

Required Scopes

Scope Description
merchant:view_community_members List payers in a merchant's community

Retrieve a specific community member by their key

Request

GET /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg

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 MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

memberKey MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg path

The unique key of the community member - 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": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "first@test.com", "emailAddressVerified": false, "mobileNumber": "+12025551234", "mobileNumberVerified": false, "fullName": "John Doe", "firstName": "John", "lastName": "Doe", "role": "individual", "payerType": "Guest", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }
<?php
/*
	Example 1
	Retrieve a specific community member by their key
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$memberKey = 'MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community/$memberKey";
$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
 * Retrieve a specific community member by their key
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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
# Retrieve a specific community member by their key
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set memberKey="MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community/%memberKey%"

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>
		///	Retrieve a specific community member by their key
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var memberKey = "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg";
				var requestUrl = string.Format("/v1/merchant/{0}/community/{1}", merchantKey, memberKey);

				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; }
	}
}

Attempting to retrieve a community member not in the specified merchant's community

Request

GET /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg

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 MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

memberKey MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg path

The unique key of the community member - a case-sensitive series of characters

Response

Status 404 (Not Found)

Headers

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

Code Samples

Response

{ "message": "No such community member exists, or they are not part of this merchant's community" }
<?php
/*
	Example 2
	Attempting to retrieve a community member not in the specified merchant's community
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$memberKey = 'MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community/$memberKey";
$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
 * Attempting to retrieve a community member not in the specified merchant's community
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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
# Attempting to retrieve a community member not in the specified merchant's community
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set memberKey="MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community/%memberKey%"

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>
		///	Attempting to retrieve a community member not in the specified merchant's community
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var memberKey = "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg";
				var requestUrl = string.Format("/v1/merchant/{0}/community/{1}", merchantKey, memberKey);

				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; }
	}
}

Manage a Community Member

PATCH /v1/merchant/{merchantKey}/community/{memberKey}

Updates the details of specific member in a merchant's community

Path (URL) Parameters

Name Type Description
merchantKey string

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

memberKey string

The unique key of the community member - a case-sensitive series of characters

Required Scopes

Scope Description
merchant:manage_community_members Manage members in a merchant's community

Update a specific community member by their key

Request

PATCH /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg

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
merchantKey MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

memberKey MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg path

The unique key of the community member - 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

{ "exportKey": "New export key" }

Response

{ "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "first@test.com", "emailAddressVerified": false, "mobileNumber": "+12025551234", "mobileNumberVerified": false, "fullName": "John Doe", "firstName": "John", "lastName": "Doe", "role": "individual", "payerType": "Guest", "exportKey": "New export key", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }
<?php
/*
	Example 1
	Update a specific community member by their key
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$memberKey = 'MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg';
$requestBody = '{
  "exportKey": "New export key"
}';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community/$memberKey";
$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
 * Update a specific community member by their key
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"exportKey\": \"New export key\"" + 
			"}";
		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
# Update a specific community member by their key
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set memberKey="MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community/%memberKey%"
set requestBody="{\"exportKey\": \"New export key\"}"

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>
		///	Update a specific community member by their key
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var memberKey = "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg";
				var requestUrl = string.Format("/v1/merchant/{0}/community/{1}", merchantKey, memberKey);

				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 {
					  exportKey = "New export key"
					});
				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; }
	}
}

No-op operation when the request body is empty

Request

PATCH /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg

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
merchantKey MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

memberKey MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg path

The unique key of the community member - 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

{}

Response

{ "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "first@test.com", "emailAddressVerified": false, "mobileNumber": "+12025551234", "mobileNumberVerified": false, "fullName": "John Doe", "firstName": "John", "lastName": "Doe", "role": "individual", "payerType": "Guest", "exportKey": "Old export key", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }
<?php
/*
	Example 2
	No-op operation when the request body is empty
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$memberKey = 'MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg';
$requestBody = '{}';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community/$memberKey";
$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
 * No-op operation when the request body is empty
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		String requestBody = "{}";
		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
# No-op operation when the request body is empty
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set memberKey="MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community/%memberKey%"
set requestBody="{}"

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>
		///	No-op operation when the request body is empty
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var memberKey = "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg";
				var requestUrl = string.Format("/v1/merchant/{0}/community/{1}", merchantKey, memberKey);

				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 {});
				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; }
	}
}

Attempting to update a community member not in the specified merchant's community

Request

PATCH /v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg

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
merchantKey MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ path

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

memberKey MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg path

The unique key of the community member - a case-sensitive series of characters

Response

Status 404 (Not Found)

Headers

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

Code Samples

Body

{ "exportKey": "New export key" }

Response

{ "message": "No such community member exists, or they are not part of this merchant's community" }
<?php
/*
	Example 3
	Attempting to update a community member not in the specified merchant's community
*/
$merchantKey = 'MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ';
$memberKey = 'MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg';
$requestBody = '{
  "exportKey": "New export key"
}';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/community/$memberKey";
$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 3
 * Attempting to update a community member not in the specified merchant's community
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PATCH");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"exportKey\": \"New export key\"" + 
			"}";
		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 3
# Attempting to update a community member not in the specified merchant's community
set oAuthToken=%1
set merchantKey="MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ"
set memberKey="MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/community/%memberKey%"
set requestBody="{\"exportKey\": \"New export key\"}"

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 Example3
	{

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	Attempting to update a community member not in the specified merchant's community
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ";
				var memberKey = "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg";
				var requestUrl = string.Format("/v1/merchant/{0}/community/{1}", merchantKey, memberKey);

				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 {
					  exportKey = "New export key"
					});
				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; }
	}
}