Payments API

The API for managing payments in the Pushpay platform (including anticipated payments)


Delete Anticipated Payment

DELETE /v1/anticipatedpayment/{token}

Deleting an anticipated payment will only work if the payment exists and the Status is 'Unassociated'.

Path (URL) Parameters

Name Type Description
token string

The textual token that uniquely identifies the anticipated payment

Required Scopes

Scope Description
create_anticipated_payment Create anticipated payments for any merchant

Delete an anticipated payment

Request

DELETE /v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg

Headers

Name Value Description
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
token 8ue4_DeoeESE0HWKf98Lgg path

The textual token that uniquely identifies the anticipated payment

Response

Status 204 (No Content)

Code Samples

No JSON content

<?php
/*
	Example 1
	Delete an anticipated payment
*/
$token = '8ue4_DeoeESE0HWKf98Lgg';
$url = "https://api.pushpay.com/v1/anticipatedpayment/$token";
$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 an anticipated payment
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String token = "8ue4_DeoeESE0HWKf98Lgg";
		String urlString = "https://api.pushpay.com/v1/anticipatedpayment/" + token;

		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 an anticipated payment
set oAuthToken=%1
set token="8ue4_DeoeESE0HWKf98Lgg"
set url="https://api.pushpay.com/v1/anticipatedpayment/%token%"

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 an anticipated payment
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var token = "8ue4_DeoeESE0HWKf98Lgg";
				var requestUrl = string.Format("/v1/anticipatedpayment/{0}", token);

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

Delete an anticipated payment that's been paid

Request

DELETE /v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg

Headers

Name Value Description
Authorization Bearer XXXXXXXXX

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
token 8ue4_DeoeESE0HWKf98Lgg path

The textual token that uniquely identifies the anticipated payment

Response

Status 403 (Forbidden)

Code Samples

Response

{ "message": "Anticipated payment can not be deleted because it associated with a payment" }
<?php
/*
	Example 2
	Delete an anticipated payment that's been paid
*/
$token = '8ue4_DeoeESE0HWKf98Lgg';
$url = "https://api.pushpay.com/v1/anticipatedpayment/$token";
$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
 * Delete an anticipated payment that's been paid
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String token = "8ue4_DeoeESE0HWKf98Lgg";
		String urlString = "https://api.pushpay.com/v1/anticipatedpayment/" + token;

		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
# Delete an anticipated payment that's been paid
set oAuthToken=%1
set token="8ue4_DeoeESE0HWKf98Lgg"
set url="https://api.pushpay.com/v1/anticipatedpayment/%token%"

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>
		///	Delete an anticipated payment that's been paid
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var token = "8ue4_DeoeESE0HWKf98Lgg";
				var requestUrl = string.Format("/v1/anticipatedpayment/{0}", token);

				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 Anticipated Payment

GET /v1/anticipatedpayment/{token}

Path (URL) Parameters

Name Type Description
token string

The textual token that uniquely identifies the anticipated payment

Required Scopes

Scope Description
create_anticipated_payment Create anticipated payments for any merchant

Retrieve an anticipated payment

Request

GET /v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg

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
token 8ue4_DeoeESE0HWKf98Lgg path

The textual token that uniquely identifies the anticipated payment

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "merchantKey": "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ", "token": "8ue4_DeoeESE0HWKf98Lgg", "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 1
	Retrieve an anticipated payment
*/
$token = '8ue4_DeoeESE0HWKf98Lgg';
$url = "https://api.pushpay.com/v1/anticipatedpayment/$token";
$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 an anticipated payment
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String token = "8ue4_DeoeESE0HWKf98Lgg";
		String urlString = "https://api.pushpay.com/v1/anticipatedpayment/" + token;

		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 an anticipated payment
set oAuthToken=%1
set token="8ue4_DeoeESE0HWKf98Lgg"
set url="https://api.pushpay.com/v1/anticipatedpayment/%token%"

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 an anticipated payment
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var token = "8ue4_DeoeESE0HWKf98Lgg";
				var requestUrl = string.Format("/v1/anticipatedpayment/{0}", token);

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

Update Anticipated Payment

PUT /v1/anticipatedpayment/{token}

Path (URL) Parameters

Name Type Description
token string

The textual token that uniquely identifies the anticipated payment

Required Scopes

Scope Description
create_anticipated_payment Create anticipated payments for any merchant

Update an existing anticipated payment without specifying any details of the expected payer

Request

PUT /v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg

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
token 8ue4_DeoeESE0HWKf98Lgg path

The textual token that uniquely identifies the anticipated payment

Response

Status 200 (OK)

Headers

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

Code Samples

Body

{ "merchantKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "fields": [], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 1
	Update an existing anticipated payment without specifying any details of the expected payer
*/
$token = '8ue4_DeoeESE0HWKf98Lgg';
$requestBody = '{
  "merchantKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M",
  "fields": [],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayment/$token";
$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 an existing anticipated payment without specifying any details of the expected payer
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String token = "8ue4_DeoeESE0HWKf98Lgg";
		String urlString = "https://api.pushpay.com/v1/anticipatedpayment/" + token;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PUT");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"merchantKey\": \"MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M\"," + 
			"  \"fields\": []," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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 an existing anticipated payment without specifying any details of the expected payer
set oAuthToken=%1
set token="8ue4_DeoeESE0HWKf98Lgg"
set url="https://api.pushpay.com/v1/anticipatedpayment/%token%"
set requestBody="{\"merchantKey\": \"MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M\",\"fields\": [],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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 an existing anticipated payment without specifying any details of the expected payer
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var token = "8ue4_DeoeESE0HWKf98Lgg";
				var requestUrl = string.Format("/v1/anticipatedpayment/{0}", token);

				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 {
					  merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M",
					  fields = new string[0],
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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 an existing anticipated payment specifying details of the payer

Request

PUT /v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg

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
token 8ue4_DeoeESE0HWKf98Lgg path

The textual token that uniquely identifies the anticipated payment

Response

Status 200 (OK)

Headers

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

Code Samples

Body

{ "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0", "emailAddress": "joe.bloggs@test.com", "mobileNumber": "+64215555555", "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs" }, "merchantKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "fields": [], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0", "emailAddress": "joe.bloggs@test.com", "mobileNumber": "+64215555555", "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs" }, "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 2
	Update an existing anticipated payment specifying details of the payer
*/
$token = '8ue4_DeoeESE0HWKf98Lgg';
$requestBody = '{
  "payer": {
    "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0",
    "emailAddress": "joe.bloggs@test.com",
    "mobileNumber": "+64215555555",
    "fullName": "Joe Bloggs",
    "firstName": "Joe",
    "lastName": "Bloggs"
  },
  "merchantKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M",
  "fields": [],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayment/$token";
$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 an existing anticipated payment specifying details of the payer
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String token = "8ue4_DeoeESE0HWKf98Lgg";
		String urlString = "https://api.pushpay.com/v1/anticipatedpayment/" + token;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PUT");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"payer\": {" + 
			"    \"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\"," + 
			"    \"emailAddress\": \"joe.bloggs@test.com\"," + 
			"    \"mobileNumber\": \"+64215555555\"," + 
			"    \"fullName\": \"Joe Bloggs\"," + 
			"    \"firstName\": \"Joe\"," + 
			"    \"lastName\": \"Bloggs\"" + 
			"  }," + 
			"  \"merchantKey\": \"MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M\"," + 
			"  \"fields\": []," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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 an existing anticipated payment specifying details of the payer
set oAuthToken=%1
set token="8ue4_DeoeESE0HWKf98Lgg"
set url="https://api.pushpay.com/v1/anticipatedpayment/%token%"
set requestBody="{\"payer\": {\"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\",\"emailAddress\": \"joe.bloggs@test.com\",\"mobileNumber\": \"+64215555555\",\"fullName\": \"Joe Bloggs\",\"firstName\": \"Joe\",\"lastName\": \"Bloggs\"},\"merchantKey\": \"MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M\",\"fields\": [],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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 an existing anticipated payment specifying details of the payer
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var token = "8ue4_DeoeESE0HWKf98Lgg";
				var requestUrl = string.Format("/v1/anticipatedpayment/{0}", token);

				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 {
					  payer = new {
					    key = "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0",
					    emailAddress = "joe.bloggs@test.com",
					    mobileNumber = "+64215555555",
					    fullName = "Joe Bloggs",
					    firstName = "Joe",
					    lastName = "Bloggs"
					  },
					  merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M",
					  fields = new string[0],
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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 an existing anticipated payment, specifying a specific payer by ID

Request

PUT /v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg

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
token 8ue4_DeoeESE0HWKf98Lgg path

The textual token that uniquely identifies the anticipated payment

Response

Status 200 (OK)

Headers

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

Code Samples

Body

{ "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0" }, "merchantKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "fields": [], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0" }, "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 3
	Update an existing anticipated payment, specifying a specific payer by ID
*/
$token = '8ue4_DeoeESE0HWKf98Lgg';
$requestBody = '{
  "payer": {
    "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0"
  },
  "merchantKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M",
  "fields": [],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayment/$token";
$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 3
 * Update an existing anticipated payment, specifying a specific payer by ID
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String token = "8ue4_DeoeESE0HWKf98Lgg";
		String urlString = "https://api.pushpay.com/v1/anticipatedpayment/" + token;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PUT");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"payer\": {" + 
			"    \"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\"" + 
			"  }," + 
			"  \"merchantKey\": \"MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M\"," + 
			"  \"fields\": []," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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 3
# Update an existing anticipated payment, specifying a specific payer by ID
set oAuthToken=%1
set token="8ue4_DeoeESE0HWKf98Lgg"
set url="https://api.pushpay.com/v1/anticipatedpayment/%token%"
set requestBody="{\"payer\": {\"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\"},\"merchantKey\": \"MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M\",\"fields\": [],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	Update an existing anticipated payment, specifying a specific payer by ID
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var token = "8ue4_DeoeESE0HWKf98Lgg";
				var requestUrl = string.Format("/v1/anticipatedpayment/{0}", token);

				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 {
					  payer = new {
					    key = "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0"
					  },
					  merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M",
					  fields = new string[0],
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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 an existing anticipated payment, specific amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)

Request

PUT /v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg

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
token 8ue4_DeoeESE0HWKf98Lgg path

The textual token that uniquely identifies the anticipated payment

Response

Status 200 (OK)

Headers

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

Code Samples

Body

{ "merchantKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "fields": [ { "key": "amount", "value": { "amount": "60.50", "currency": "USD" }, "readOnly": true }, { "key": "4524", "value": "Pickup", "readOnly": true } ], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "fields": [ { "key": "amount", "value": { "amount": "60.50", "currency": "USD" }, "readOnly": true }, { "key": "4524", "value": "Pickup", "readOnly": true } ], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 4
	Update an existing anticipated payment, specific amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)
*/
$token = '8ue4_DeoeESE0HWKf98Lgg';
$requestBody = '{
  "merchantKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M",
  "fields": [
    {
      "key": "amount",
      "value": {
        "amount": "60.50",
        "currency": "USD"
      },
      "readOnly": true
    },
    {
      "key": "4524",
      "value": "Pickup",
      "readOnly": true
    }
  ],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayment/$token";
$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 4
 * Update an existing anticipated payment, specific amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String token = "8ue4_DeoeESE0HWKf98Lgg";
		String urlString = "https://api.pushpay.com/v1/anticipatedpayment/" + token;

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("PUT");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"merchantKey\": \"MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M\"," + 
			"  \"fields\": [" + 
			"    {" + 
			"      \"key\": \"amount\"," + 
			"      \"value\": {" + 
			"        \"amount\": \"60.50\"," + 
			"        \"currency\": \"USD\"" + 
			"      }," + 
			"      \"readOnly\": true" + 
			"    }," + 
			"    {" + 
			"      \"key\": \"4524\"," + 
			"      \"value\": \"Pickup\"," + 
			"      \"readOnly\": true" + 
			"    }" + 
			"  ]," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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 4
# Update an existing anticipated payment, specific amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)
set oAuthToken=%1
set token="8ue4_DeoeESE0HWKf98Lgg"
set url="https://api.pushpay.com/v1/anticipatedpayment/%token%"
set requestBody="{\"merchantKey\": \"MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M\",\"fields\": [{\"key\": \"amount\",\"value\": {\"amount\": \"60.50\",\"currency\": \"USD\"},\"readOnly\": true},{\"key\": \"4524\",\"value\": \"Pickup\",\"readOnly\": true}],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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

		/// <summary>
		///	Example 4
		/// </summary>
		/// <remarks>
		///	Update an existing anticipated payment, specific amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var token = "8ue4_DeoeESE0HWKf98Lgg";
				var requestUrl = string.Format("/v1/anticipatedpayment/{0}", token);

				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 {
					  merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M",
					  fields = new [] {
					    new {
					      key = "amount",
					      value = new {
					        amount = "60.50",
					        currency = "USD"
					      },
					      readOnly = true},
					    new {
					      key = "4524",
					      value = "Pickup",
					      readOnly = true}},
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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; }
	}
}

Get Anticipated Payment Payment Details

GET /v1/anticipatedpayment/{token}/payment

Get the payment details for the payment that was made for this anticipated payment (if payment has been completed).

Path (URL) Parameters

Name Type Description
token string

The textual token that uniquely identifies the anticipated payment

Required Scopes

Scope Description
create_anticipated_payment Create anticipated payments for any merchant

Retrieve details of the payment that was made to fulfill an anticipated payment

Request

GET /v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/payment

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
token 8ue4_DeoeESE0HWKf98Lgg path

The textual token that uniquely identifies the anticipated payment

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "status": "New", "anticipatedPaymentToken": "8ue4_DeoeESE0HWKf98Lgg", "transactionId": "69", "paymentToken": "J7htOSXN1UWDyRIg0EtqAQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddress": "joe@bloggs.com", "emailAddressVerified": false, "mobileNumber": "+12025551234", "mobileNumberVerified": false, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "role": "individual", "payerType": "Guest", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ", "handle": "partychurch", "role": "merchant" }, "fields": [ { "key": "1234", "value": "Pickup", "label": "Delivery Option" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "Unknown", "source": "MobileApp", "campus": { "key": "MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/payment" }, "anticipatedpayment": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTIzOkRUclhHb1Jtc24tX3NKMGxjZzJ3cUJqb1ZlTQ" } } }
<?php
/*
	Example 1
	Retrieve details of the payment that was made to fulfill an anticipated payment
*/
$token = '8ue4_DeoeESE0HWKf98Lgg';
$url = "https://api.pushpay.com/v1/anticipatedpayment/$token/payment";
$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 details of the payment that was made to fulfill an anticipated payment
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String token = "8ue4_DeoeESE0HWKf98Lgg";
		String urlString = "https://api.pushpay.com/v1/anticipatedpayment/" + token + "/payment";

		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 details of the payment that was made to fulfill an anticipated payment
set oAuthToken=%1
set token="8ue4_DeoeESE0HWKf98Lgg"
set url="https://api.pushpay.com/v1/anticipatedpayment/%token%/payment"

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 details of the payment that was made to fulfill an anticipated payment
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var token = "8ue4_DeoeESE0HWKf98Lgg";
				var requestUrl = string.Format("/v1/anticipatedpayment/{0}/payment", token);

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

Get Anticipated Payment Status

GET /v1/anticipatedpayment/{token}/status

Get the status of the anticipated payment. Possible values are:

  • New: New anticipated payment that has yet to be viewed (Status code = 1)
  • Opened: Payment link has been clicked on, user is attempting payment (Status code = 2)
  • Completed: Payment has been completed successfully (Status code = 3)
  • Failed: Payment has failed - declined for insufficient funds or payment process was abandonded by the user (Status code = 4)
  • PayerCancelled: Payment was Cancelled by user before entering the Completed or Failed state (Status code = 5)
  • Expired: Payment expired before being processed (Status code = 6)
  • MerchantCancelled: Anticipated payment withdrawn by merchant who uploaded the bill for which this payment was created (Status code = 7)

Path (URL) Parameters

Name Type Description
token string

The textual token that uniquely identifies the anticipated payment

Required Scopes

Scope Description
create_anticipated_payment Create anticipated payments for any merchant

Get status of anticipated payment

Request

GET /v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status

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
token 8ue4_DeoeESE0HWKf98Lgg path

The textual token that uniquely identifies the anticipated payment

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "statusCode": 1, "completed": false, "status": "New", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" }, "anticipatedpayment": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" } } }
<?php
/*
	Example 1
	Get status of anticipated payment
*/
$token = '8ue4_DeoeESE0HWKf98Lgg';
$url = "https://api.pushpay.com/v1/anticipatedpayment/$token/status";
$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 status of anticipated payment
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String token = "8ue4_DeoeESE0HWKf98Lgg";
		String urlString = "https://api.pushpay.com/v1/anticipatedpayment/" + token + "/status";

		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 status of anticipated payment
set oAuthToken=%1
set token="8ue4_DeoeESE0HWKf98Lgg"
set url="https://api.pushpay.com/v1/anticipatedpayment/%token%/status"

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 status of anticipated payment
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var token = "8ue4_DeoeESE0HWKf98Lgg";
				var requestUrl = string.Format("/v1/anticipatedpayment/{0}/status", token);

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

Create Anticipated Payment

POST /v1/anticipatedpayments

When creating a new anticipated payment you must:

  • Specify a merchant (by setting the 'merchant' property to the ID or handle of the merchant).

All other fields are optional - but recommend setting the 'reference' field to a local identifier for the payment, and populating an fields that are required to be certain values for tracking the payment for the Merchant.

Fields are passed in as an array of objects, each object has 3 properties.

  • key
  • value
  • readOnly

The 'key' is a string and must be either the reference definition's ID, or the keyword 'amount' for setting the amount of this anticipated payment. The value is the value of the reference field (a string) or the amount (which must also be specified as a string, or using the format:

{ "value": "123.45", "currency": "USD"}

The value readOnly is a boolean field - where if 'true' then field will be made read-only, this works for both reference definitions and the amount field

Required Scopes

Scope Description
create_anticipated_payment Create anticipated payments for any merchant

Example 1

Create a new anticipated payment

Request

POST /v1/anticipatedpayments

Headers

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

The bearer token being used to authenticate this request

Response

Status 201 (Created)

Headers

Name Value Description
Location https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "fields": [], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 1
	Create a new anticipated payment
*/
$requestBody = '{
  "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
  "fields": [],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayments";
$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
 * Create a new anticipated payment
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("POST");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\"," + 
			"  \"fields\": []," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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
# Create a new anticipated payment
set oAuthToken=%1
set url="https://api.pushpay.com/v1/anticipatedpayments"
set requestBody="{\"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\",\"fields\": [],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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>
		///	Create a new anticipated payment
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var requestUrl = "/v1/anticipatedpayments";

				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 {
					  merchantKey = "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
					  fields = new string[0],
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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; }
	}
}
Example 2

Create a new anticipated payment, specifying details of the payment

Request

POST /v1/anticipatedpayments

Headers

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

The bearer token being used to authenticate this request

Response

Status 201 (Created)

Headers

Name Value Description
Location https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0", "emailAddress": "joe.bloggs@test.com", "mobileNumber": "+64215555555", "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs" }, "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "fields": [], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0", "emailAddress": "joe.bloggs@test.com", "mobileNumber": "+64215555555", "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs" }, "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 2
	Create a new anticipated payment, specifying details of the payment
*/
$requestBody = '{
  "payer": {
    "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0",
    "emailAddress": "joe.bloggs@test.com",
    "mobileNumber": "+64215555555",
    "fullName": "Joe Bloggs",
    "firstName": "Joe",
    "lastName": "Bloggs"
  },
  "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
  "fields": [],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayments";
$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 2
 * Create a new anticipated payment, specifying details of the payment
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("POST");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"payer\": {" + 
			"    \"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\"," + 
			"    \"emailAddress\": \"joe.bloggs@test.com\"," + 
			"    \"mobileNumber\": \"+64215555555\"," + 
			"    \"fullName\": \"Joe Bloggs\"," + 
			"    \"firstName\": \"Joe\"," + 
			"    \"lastName\": \"Bloggs\"" + 
			"  }," + 
			"  \"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\"," + 
			"  \"fields\": []," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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 2
# Create a new anticipated payment, specifying details of the payment
set oAuthToken=%1
set url="https://api.pushpay.com/v1/anticipatedpayments"
set requestBody="{\"payer\": {\"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\",\"emailAddress\": \"joe.bloggs@test.com\",\"mobileNumber\": \"+64215555555\",\"fullName\": \"Joe Bloggs\",\"firstName\": \"Joe\",\"lastName\": \"Bloggs\"},\"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\",\"fields\": [],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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

		/// <summary>
		///	Example 2
		/// </summary>
		/// <remarks>
		///	Create a new anticipated payment, specifying details of the payment
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var requestUrl = "/v1/anticipatedpayments";

				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 {
					  payer = new {
					    key = "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0",
					    emailAddress = "joe.bloggs@test.com",
					    mobileNumber = "+64215555555",
					    fullName = "Joe Bloggs",
					    firstName = "Joe",
					    lastName = "Bloggs"
					  },
					  merchantKey = "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
					  fields = new string[0],
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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; }
	}
}
Example 3

Create a new anticipated payment, specifying address for a payer

Request

POST /v1/anticipatedpayments

Headers

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

The bearer token being used to authenticate this request

Response

Status 201 (Created)

Headers

Name Value Description
Location https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "payer": { "emailAddress": "joe.bloggs@test.com", "mobileNumber": "+64215555555", "fullName": "Joe Bloggs", "address": { "country": "NZ", "line1": "1 Queen Street", "line2": "Newton", "city": "Auckland" }, "firstName": "Joe", "lastName": "Bloggs" }, "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "fields": [], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "payer": { "emailAddress": "joe.bloggs@test.com", "mobileNumber": "+64215555555", "fullName": "Joe Bloggs", "address": { "country": "NZ", "line1": "1 Queen Street", "line2": "Newton", "city": "Auckland" }, "firstName": "Joe", "lastName": "Bloggs" }, "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 3
	Create a new anticipated payment, specifying address for a payer
*/
$requestBody = '{
  "payer": {
    "emailAddress": "joe.bloggs@test.com",
    "mobileNumber": "+64215555555",
    "fullName": "Joe Bloggs",
    "address": {
      "country": "NZ",
      "line1": "1 Queen Street",
      "line2": "Newton",
      "city": "Auckland"
    },
    "firstName": "Joe",
    "lastName": "Bloggs"
  },
  "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
  "fields": [],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayments";
$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 3
 * Create a new anticipated payment, specifying address for a payer
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("POST");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"payer\": {" + 
			"    \"emailAddress\": \"joe.bloggs@test.com\"," + 
			"    \"mobileNumber\": \"+64215555555\"," + 
			"    \"fullName\": \"Joe Bloggs\"," + 
			"    \"address\": {" + 
			"      \"country\": \"NZ\"," + 
			"      \"line1\": \"1 Queen Street\"," + 
			"      \"line2\": \"Newton\"," + 
			"      \"city\": \"Auckland\"" + 
			"    }," + 
			"    \"firstName\": \"Joe\"," + 
			"    \"lastName\": \"Bloggs\"" + 
			"  }," + 
			"  \"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\"," + 
			"  \"fields\": []," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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 3
# Create a new anticipated payment, specifying address for a payer
set oAuthToken=%1
set url="https://api.pushpay.com/v1/anticipatedpayments"
set requestBody="{\"payer\": {\"emailAddress\": \"joe.bloggs@test.com\",\"mobileNumber\": \"+64215555555\",\"fullName\": \"Joe Bloggs\",\"address\": {\"country\": \"NZ\",\"line1\": \"1 Queen Street\",\"line2\": \"Newton\",\"city\": \"Auckland\"},\"firstName\": \"Joe\",\"lastName\": \"Bloggs\"},\"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\",\"fields\": [],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	Create a new anticipated payment, specifying address for a payer
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var requestUrl = "/v1/anticipatedpayments";

				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 {
					  payer = new {
					    emailAddress = "joe.bloggs@test.com",
					    mobileNumber = "+64215555555",
					    fullName = "Joe Bloggs",
					    address = new {
					      country = "NZ",
					      line1 = "1 Queen Street",
					      line2 = "Newton",
					      city = "Auckland"
					    },
					    firstName = "Joe",
					    lastName = "Bloggs"
					  },
					  merchantKey = "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
					  fields = new string[0],
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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; }
	}
}
Example 4

Create an new anticipated payment, specifying a payer by ID

Request

POST /v1/anticipatedpayments

Headers

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

The bearer token being used to authenticate this request

Response

Status 201 (Created)

Headers

Name Value Description
Location https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0" }, "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "fields": [], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0" }, "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 4
	Create an new anticipated payment, specifying a payer by ID
*/
$requestBody = '{
  "payer": {
    "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0"
  },
  "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
  "fields": [],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayments";
$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 4
 * Create an new anticipated payment, specifying a payer by ID
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("POST");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"payer\": {" + 
			"    \"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\"" + 
			"  }," + 
			"  \"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\"," + 
			"  \"fields\": []," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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 4
# Create an new anticipated payment, specifying a payer by ID
set oAuthToken=%1
set url="https://api.pushpay.com/v1/anticipatedpayments"
set requestBody="{\"payer\": {\"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\"},\"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\",\"fields\": [],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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

		/// <summary>
		///	Example 4
		/// </summary>
		/// <remarks>
		///	Create an new anticipated payment, specifying a payer by ID
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var requestUrl = "/v1/anticipatedpayments";

				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 {
					  payer = new {
					    key = "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0"
					  },
					  merchantKey = "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
					  fields = new string[0],
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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; }
	}
}
Example 5

Create a new anticipated payment, specifying amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)

Request

POST /v1/anticipatedpayments

Headers

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

The bearer token being used to authenticate this request

Response

Status 201 (Created)

Headers

Name Value Description
Location https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "fields": [ { "key": "amount", "value": { "amount": "60.50", "currency": "USD" }, "readOnly": true }, { "key": "4524", "value": "Pickup", "readOnly": true } ], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "fields": [ { "key": "amount", "value": { "amount": "60.50", "currency": "USD" }, "readOnly": true }, { "key": "4524", "value": "Pickup", "readOnly": true } ], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 5
	Create a new anticipated payment, specifying amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)
*/
$requestBody = '{
  "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
  "fields": [
    {
      "key": "amount",
      "value": {
        "amount": "60.50",
        "currency": "USD"
      },
      "readOnly": true
    },
    {
      "key": "4524",
      "value": "Pickup",
      "readOnly": true
    }
  ],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayments";
$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 5
 * Create a new anticipated payment, specifying amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("POST");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\"," + 
			"  \"fields\": [" + 
			"    {" + 
			"      \"key\": \"amount\"," + 
			"      \"value\": {" + 
			"        \"amount\": \"60.50\"," + 
			"        \"currency\": \"USD\"" + 
			"      }," + 
			"      \"readOnly\": true" + 
			"    }," + 
			"    {" + 
			"      \"key\": \"4524\"," + 
			"      \"value\": \"Pickup\"," + 
			"      \"readOnly\": true" + 
			"    }" + 
			"  ]," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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 5
# Create a new anticipated payment, specifying amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)
set oAuthToken=%1
set url="https://api.pushpay.com/v1/anticipatedpayments"
set requestBody="{\"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\",\"fields\": [{\"key\": \"amount\",\"value\": {\"amount\": \"60.50\",\"currency\": \"USD\"},\"readOnly\": true},{\"key\": \"4524\",\"value\": \"Pickup\",\"readOnly\": true}],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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

		/// <summary>
		///	Example 5
		/// </summary>
		/// <remarks>
		///	Create a new anticipated payment, specifying amount and a value for the reference definition (in this case a combo-box where the option 'Pickup' has been selected)
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var requestUrl = "/v1/anticipatedpayments";

				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 {
					  merchantKey = "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
					  fields = new [] {
					    new {
					      key = "amount",
					      value = new {
					        amount = "60.50",
					        currency = "USD"
					      },
					      readOnly = true},
					    new {
					      key = "4524",
					      value = "Pickup",
					      readOnly = true}},
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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; }
	}
}
Example 6

Create an anticipated payment, specifying amount as a decimal value

Request

POST /v1/anticipatedpayments

Headers

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

The bearer token being used to authenticate this request

Response

Status 201 (Created)

Headers

Name Value Description
Location https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "fields": [ { "key": "amount", "value": "60.50", "readOnly": true } ], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "fields": [ { "key": "amount", "value": "60.50", "readOnly": true } ], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 6
	Create an anticipated payment, specifying amount as a decimal value
*/
$requestBody = '{
  "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
  "fields": [
    {
      "key": "amount",
      "value": "60.50",
      "readOnly": true
    }
  ],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayments";
$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 6
 * Create an anticipated payment, specifying amount as a decimal value
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("POST");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\"," + 
			"  \"fields\": [" + 
			"    {" + 
			"      \"key\": \"amount\"," + 
			"      \"value\": \"60.50\"," + 
			"      \"readOnly\": true" + 
			"    }" + 
			"  ]," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"" + 
			"}";
		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 6
# Create an anticipated payment, specifying amount as a decimal value
set oAuthToken=%1
set url="https://api.pushpay.com/v1/anticipatedpayments"
set requestBody="{\"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\",\"fields\": [{\"key\": \"amount\",\"value\": \"60.50\",\"readOnly\": true}],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\"}"

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

		/// <summary>
		///	Example 6
		/// </summary>
		/// <remarks>
		///	Create an anticipated payment, specifying amount as a decimal value
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var requestUrl = "/v1/anticipatedpayments";

				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 {
					  merchantKey = "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
					  fields = new [] {
					    new {
					      key = "amount",
					      value = "60.50",
					      readOnly = true}},
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org"
					});
				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; }
	}
}
Example 7

Create a new anticipated payment, specifying a fulfilmentMethod of 'Manual' which enforces payment by a registered Payer only, allows payments to be retried and allows you to specify an explicit Expiry date and time.

Request

POST /v1/anticipatedpayments

Headers

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

The bearer token being used to authenticate this request

Response

Status 201 (Created)

Headers

Name Value Description
Location https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg
Content-Type application/hal+json; charset=utf-8

Code Samples

Body

{ "fulfilmentMethod": "BillPayment", "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0", "emailAddress": "joe.bloggs@test.com", "mobileNumber": "+64215555555", "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs" }, "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "fields": [], "token": "8ue4_DeoeESE0HWKf98Lgg", "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://partychurch.org/festival2020/complete", "returnTitle": "Return to paychurch.org", "expiresOn": "2016-01-02T03:04:05Z" }

Response

{ "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "payer": { "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0", "emailAddress": "joe.bloggs@test.com", "mobileNumber": "+64215555555", "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs" }, "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "expiresOn": "2016-01-02T03:04:05Z", "fulfilmentMethod": "BillPayment", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }
<?php
/*
	Example 7
	Create a new anticipated payment, specifying a fulfilmentMethod of 'Manual' which enforces payment by a registered Payer only, allows payments to be retried and allows you to specify an explicit Expiry date and time.
*/
$requestBody = '{
  "fulfilmentMethod": "BillPayment",
  "payer": {
    "key": "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0",
    "emailAddress": "joe.bloggs@test.com",
    "mobileNumber": "+64215555555",
    "fullName": "Joe Bloggs",
    "firstName": "Joe",
    "lastName": "Bloggs"
  },
  "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
  "fields": [],
  "token": "8ue4_DeoeESE0HWKf98Lgg",
  "description": "2x Festival Tickets",
  "descriptionTitle": "Paying For",
  "returnUrl": "http://partychurch.org/festival2020/complete",
  "returnTitle": "Return to paychurch.org",
  "expiresOn": "2016-01-02T03:04:05Z"
}';
$url = "https://api.pushpay.com/v1/anticipatedpayments";
$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 7
 * Create a new anticipated payment, specifying a fulfilmentMethod of 'Manual' which enforces payment by a registered Payer only, allows payments to be retried and allows you to specify an explicit Expiry date and time.
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		HttpURLConnection httpConnection = setUpHttpConnection(new URL(urlString));
		httpConnection.setRequestMethod("POST");
		httpConnection.setDoOutput(true);
		String requestBody = "{" + 
			"  \"fulfilmentMethod\": \"BillPayment\"," + 
			"  \"payer\": {" + 
			"    \"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\"," + 
			"    \"emailAddress\": \"joe.bloggs@test.com\"," + 
			"    \"mobileNumber\": \"+64215555555\"," + 
			"    \"fullName\": \"Joe Bloggs\"," + 
			"    \"firstName\": \"Joe\"," + 
			"    \"lastName\": \"Bloggs\"" + 
			"  }," + 
			"  \"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\"," + 
			"  \"fields\": []," + 
			"  \"token\": \"8ue4_DeoeESE0HWKf98Lgg\"," + 
			"  \"description\": \"2x Festival Tickets\"," + 
			"  \"descriptionTitle\": \"Paying For\"," + 
			"  \"returnUrl\": \"http://partychurch.org/festival2020/complete\"," + 
			"  \"returnTitle\": \"Return to paychurch.org\"," + 
			"  \"expiresOn\": \"2016-01-02T03:04:05Z\"" + 
			"}";
		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 7
# Create a new anticipated payment, specifying a fulfilmentMethod of 'Manual' which enforces payment by a registered Payer only, allows payments to be retried and allows you to specify an explicit Expiry date and time.
set oAuthToken=%1
set url="https://api.pushpay.com/v1/anticipatedpayments"
set requestBody="{\"fulfilmentMethod\": \"BillPayment\",\"payer\": {\"key\": \"MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0\",\"emailAddress\": \"joe.bloggs@test.com\",\"mobileNumber\": \"+64215555555\",\"fullName\": \"Joe Bloggs\",\"firstName\": \"Joe\",\"lastName\": \"Bloggs\"},\"merchantKey\": \"MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg\",\"fields\": [],\"token\": \"8ue4_DeoeESE0HWKf98Lgg\",\"description\": \"2x Festival Tickets\",\"descriptionTitle\": \"Paying For\",\"returnUrl\": \"http://partychurch.org/festival2020/complete\",\"returnTitle\": \"Return to paychurch.org\",\"expiresOn\": \"2016-01-02T03:04:05Z\"}"

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

		/// <summary>
		///	Example 7
		/// </summary>
		/// <remarks>
		///	Create a new anticipated payment, specifying a fulfilmentMethod of 'Manual' which enforces payment by a registered Payer only, allows payments to be retried and allows you to specify an explicit Expiry date and time.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var requestUrl = "/v1/anticipatedpayments";

				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 {
					  fulfilmentMethod = "BillPayment",
					  payer = new {
					    key = "MTIzNDpkU1RYcjFndkJxSm16N2JMaF9MQUdyMG1zVk0",
					    emailAddress = "joe.bloggs@test.com",
					    mobileNumber = "+64215555555",
					    fullName = "Joe Bloggs",
					    firstName = "Joe",
					    lastName = "Bloggs"
					  },
					  merchantKey = "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg",
					  fields = new string[0],
					  token = "8ue4_DeoeESE0HWKf98Lgg",
					  description = "2x Festival Tickets",
					  descriptionTitle = "Paying For",
					  returnUrl = "http://partychurch.org/festival2020/complete",
					  returnTitle = "Return to paychurch.org",
					  expiresOn = "2016-01-02T03:04:05Z"
					});
				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; }
	}
}

List Anticipated Payments

GET /v1/merchant/{merchantKey}/anticipatedpayments

Anticipated payments are returned sorted into descending order by create date, and are paged (with 25 per page)

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
page integer

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

pageSize integer

The page size parameter (Note: default page size is 25)

Required Scopes

Scope Description
list_anticipated_payments List anticipated payment for a merchant

Return the first page of anticipated payments for a merchant

Request

GET /v1/merchant/partychurch/anticipatedpayments?page=0&pageSize=25

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

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

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 2, "totalPages": 1, "items": [ { "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "8ue4_DeoeESE0HWKf98Lgg", "fields": [], "description": "2x Festival Tickets", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/8ue4_DeoeESE0HWKf98Lgg/status" } } }, { "merchantKey": "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg", "token": "J7htOSXN1UWDyRIg0EtqAQ", "fields": [ { "key": "amount", "value": { "amount": "30.25", "currency": "USD" } } ], "description": "1x Festival Ticket", "descriptionTitle": "Paying For", "returnUrl": "http://example.com/complete", "returnTitle": "Return to site", "fulfilmentMethod": "Redirect", "_links": { "self": { "href": "https://api.pushpay.com/v1/anticipatedpayment/J7htOSXN1UWDyRIg0EtqAQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg" }, "status": { "href": "https://api.pushpay.com/v1/anticipatedpayment/J7htOSXN1UWDyRIg0EtqAQ/status" } } } ], "_links": { "self": null } }
<?php
/*
	Example 1
	Return the first page of anticipated payments for a merchant
*/
$merchantKey = 'partychurch';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/anticipatedpayments?page=$page&pageSize=$pageSize";
$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
 * Return the first page of anticipated payments for a merchant
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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
# Return the first page of anticipated payments for a merchant
set oAuthToken=%1
set merchantKey="partychurch"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/anticipatedpayments?page=%page%&pageSize=%pageSize%"

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>
		///	Return the first page of anticipated payments for a merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "partychurch";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/anticipatedpayments?page={1}&pageSize={2}", merchantKey, 
					page, pageSize);

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

Get Payment

GET /v1/merchant/{merchantKey}/payment/{token}

Path (URL) Parameters

Name Type Description
merchantKey string

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

token string

The token is a unique identifier for this resource - a case-sensitive series of characters

Required Scopes

Scope Description
merchant:view_payments View/search payments for in-scope merchants
read Read-only access to resources owned by the subject claim of the token

Get a single payment made to a merchant

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ

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

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

token HgHeIQ-Ui0yJPHtavtS2uQ path

The token is a unique identifier for this resource - 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

{ "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } }
<?php
/*
	Example 1
	Get a single payment made to a merchant
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$token = 'HgHeIQ-Ui0yJPHtavtS2uQ';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payment/$token";
$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 a single payment made to a merchant
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String token = "HgHeIQ-Ui0yJPHtavtS2uQ";
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payment/" + token;

		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 a single payment made to a merchant
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set token="HgHeIQ-Ui0yJPHtavtS2uQ"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payment/%token%"

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 single payment made to a merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var token = "HgHeIQ-Ui0yJPHtavtS2uQ";
				var requestUrl = string.Format("/v1/merchant/{0}/payment/{1}", merchantKey, token);

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

Get a single payment made to a merchant, which has additional custom data stored against it (which was included in the POST request when the payment was made)

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ

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

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

token HgHeIQ-Ui0yJPHtavtS2uQ path

The token is a unique identifier for this resource - 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

{ "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "VirtualTerminal", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "data": { "tx_id": "123123", "funds": [ "bits", "bobs" ] }, "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } }
<?php
/*
	Example 2
	Get a single payment made to a merchant, which has additional custom data stored against it (which was included in the POST request when the payment was made)
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$token = 'HgHeIQ-Ui0yJPHtavtS2uQ';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payment/$token";
$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
 * Get a single payment made to a merchant, which has additional custom data stored against it (which was included in the POST request when the payment was made)
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String token = "HgHeIQ-Ui0yJPHtavtS2uQ";
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payment/" + token;

		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
# Get a single payment made to a merchant, which has additional custom data stored against it (which was included in the POST request when the payment was made)
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set token="HgHeIQ-Ui0yJPHtavtS2uQ"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payment/%token%"

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>
		///	Get a single payment made to a merchant, which has additional custom data stored against it (which was included in the POST request when the payment was made)
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var token = "HgHeIQ-Ui0yJPHtavtS2uQ";
				var requestUrl = string.Format("/v1/merchant/{0}/payment/{1}", merchantKey, token);

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

Get a single payment made to a merchant, which was made by cash at the virtual terminal

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ

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

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

token HgHeIQ-Ui0yJPHtavtS2uQ path

The token is a unique identifier for this resource - 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

{ "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg", "emailAddressVerified": false, "mobileNumberVerified": false, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "role": "individual", "payerType": "Guest", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "Cash", "source": "VirtualTerminal", "ipAddress": "69.30.43.180", "givenOn": "2016-08-02", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } }
<?php
/*
	Example 3
	Get a single payment made to a merchant, which was made by cash at the virtual terminal
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$token = 'HgHeIQ-Ui0yJPHtavtS2uQ';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payment/$token";
$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 3
 * Get a single payment made to a merchant, which was made by cash at the virtual terminal
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String token = "HgHeIQ-Ui0yJPHtavtS2uQ";
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payment/" + token;

		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 3
# Get a single payment made to a merchant, which was made by cash at the virtual terminal
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set token="HgHeIQ-Ui0yJPHtavtS2uQ"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payment/%token%"

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>
		///	Get a single payment made to a merchant, which was made by cash at the virtual terminal
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var token = "HgHeIQ-Ui0yJPHtavtS2uQ";
				var requestUrl = string.Format("/v1/merchant/{0}/payment/{1}", merchantKey, token);

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

Get a refunded payment made to a merchant

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ

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

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

token HgHeIQ-Ui0yJPHtavtS2uQ path

The token is a unique identifier for this resource - 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

{ "status": "Success", "transactionId": "69", "refundedBy": { "transactionId": "70", "paymentToken": "xgJHFPJUQUOlucVDjsJ5Ow" }, "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "refundedBy": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/xgJHFPJUQUOlucVDjsJ5Ow" } } }
<?php
/*
	Example 4
	Get a refunded payment made to a merchant
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$token = 'HgHeIQ-Ui0yJPHtavtS2uQ';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payment/$token";
$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 4
 * Get a refunded payment made to a merchant
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String token = "HgHeIQ-Ui0yJPHtavtS2uQ";
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payment/" + token;

		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 4
# Get a refunded payment made to a merchant
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set token="HgHeIQ-Ui0yJPHtavtS2uQ"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payment/%token%"

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

		/// <summary>
		///	Example 4
		/// </summary>
		/// <remarks>
		///	Get a refunded payment made to a merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var token = "HgHeIQ-Ui0yJPHtavtS2uQ";
				var requestUrl = string.Format("/v1/merchant/{0}/payment/{1}", merchantKey, token);

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

Get a refund payment made to a merchant

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/xgJHFPJUQUOlucVDjsJ5Ow

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

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

token xgJHFPJUQUOlucVDjsJ5Ow path

The token is a unique identifier for this resource - 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

{ "status": "Success", "transactionId": "70", "refundFor": { "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ" }, "paymentToken": "xgJHFPJUQUOlucVDjsJ5Ow", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/xgJHFPJUQUOlucVDjsJ5Ow" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "refundFor": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" } } }
<?php
/*
	Example 5
	Get a refund payment made to a merchant
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$token = 'xgJHFPJUQUOlucVDjsJ5Ow';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payment/$token";
$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 5
 * Get a refund payment made to a merchant
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 5
# Get a refund payment made to a merchant
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set token="xgJHFPJUQUOlucVDjsJ5Ow"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payment/%token%"

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

		/// <summary>
		///	Example 5
		/// </summary>
		/// <remarks>
		///	Get a refund payment made to a merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var token = "xgJHFPJUQUOlucVDjsJ5Ow";
				var requestUrl = string.Format("/v1/merchant/{0}/payment/{1}", merchantKey, token);

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

Get details of a failed payment (Bank Declined)

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ

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

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

token HgHeIQ-Ui0yJPHtavtS2uQ path

The token is a unique identifier for this resource - 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

{ "status": "Failed", "transactionId": "69", "error": { "message": "Sorry, your card was declined. Please contact your bank.", "resultCode": { "code": 11, "key": "BankDeclined", "description": "Declined" } }, "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } }
<?php
/*
	Example 6
	Get details of a failed payment (Bank Declined)
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$token = 'HgHeIQ-Ui0yJPHtavtS2uQ';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payment/$token";
$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 6
 * Get details of a failed payment (Bank Declined)
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String token = "HgHeIQ-Ui0yJPHtavtS2uQ";
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payment/" + token;

		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 6
# Get details of a failed payment (Bank Declined)
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set token="HgHeIQ-Ui0yJPHtavtS2uQ"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payment/%token%"

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

		/// <summary>
		///	Example 6
		/// </summary>
		/// <remarks>
		///	Get details of a failed payment (Bank Declined)
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var token = "HgHeIQ-Ui0yJPHtavtS2uQ";
				var requestUrl = string.Format("/v1/merchant/{0}/payment/{1}", merchantKey, token);

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

Get a single payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_payments scope

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/xgJHFPJUQUOlucVDjsJ5Ow

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

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

token xgJHFPJUQUOlucVDjsJ5Ow path

The token is a unique identifier for this resource - 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

{ "status": "Success", "transactionId": "70", "refundFor": { "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ" }, "paymentToken": "xgJHFPJUQUOlucVDjsJ5Ow", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "externalLinks": [ { "application": { "name": "ChurchCommunityBuilder", "type": "ChurchManagementSystem" }, "relationship": "fund_id", "value": "5675" } ], "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/xgJHFPJUQUOlucVDjsJ5Ow" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "refundFor": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" } } }
<?php
/*
	Example 7
	Get a single payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_payments scope
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$token = 'xgJHFPJUQUOlucVDjsJ5Ow';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payment/$token";
$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 7
 * Get a single payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_payments scope
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 7
# Get a single payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_payments scope
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set token="xgJHFPJUQUOlucVDjsJ5Ow"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payment/%token%"

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

		/// <summary>
		///	Example 7
		/// </summary>
		/// <remarks>
		///	Get a single payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_payments scope
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var token = "xgJHFPJUQUOlucVDjsJ5Ow";
				var requestUrl = string.Format("/v1/merchant/{0}/payment/{1}", merchantKey, token);

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

Get Payments for Merchant

GET /v1/merchant/{merchantKey}/payments

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
from string

Only include payments after a date/time (UTC)

to string

Only include payments before a date/time (UTC)

createdFrom string

Only include payments after a date/time (UTC)

createdTo string

Only include payments before a date/time (UTC)

updatedFrom string

Only include payments changed after a date/time (UTC)

updatedTo string

Only include payments changed before a date/time (UTC)

orderby string

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

type string

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status string

Only include payments with the specified status (Success, Failed, or Processing)

fields array

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source string

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page integer

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

pageSize integer

The page size parameter (Note: default page size is 25)

Required Scopes

Scope Description
merchant:view_payments View/search payments for in-scope merchants

Get a list of payments belonging to the merchant

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=25

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

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

from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 1
	Get a list of payments belonging to the merchant
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payments?page=$page&pageSize=$pageSize";
$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 list of payments belonging to the merchant
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 list of payments belonging to the merchant
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payments?page=%page%&pageSize=%pageSize%"

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 list of payments belonging to the merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/payments?page={1}&pageSize={2}", merchantKey, 
					page, pageSize);

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

Get third page of a list of payments belonging to the merchant

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=2&pageSize=25

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

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

from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 2 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 2, "pageSize": 25, "total": 51, "totalPages": 3, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=2" }, "prev": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=1" }, "first": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0" } } }
<?php
/*
	Example 2
	Get third page of a list of payments belonging to the merchant
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$page = 2;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payments?page=$page&pageSize=$pageSize";
$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
 * Get third page of a list of payments belonging to the merchant
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		int page = 2;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payments?page=" + page + "&pageSize=" + pageSize;

		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
# Get third page of a list of payments belonging to the merchant
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set page=2
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payments?page=%page%&pageSize=%pageSize%"

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>
		///	Get third page of a list of payments belonging to the merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var page = 2;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/payments?page={1}&pageSize={2}", merchantKey, 
					page, pageSize);

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

Get a list of payments within a date range, using obsolete from & to

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?createdFrom=2014-08-20T00:00:00Z&createdTo=2014-08-22T00:00:00Z&from=2014-08-20T00:00:00Z&page=0&pageSize=25&to=2014-08-22T00:00:00Z

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

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

from 2014-08-20T00:00:00Z query

Only include payments after a date/time (UTC)

to 2014-08-22T00:00:00Z query

Only include payments before a date/time (UTC)

createdFrom 2014-08-20T00:00:00Z query

Only include payments after a date/time (UTC)

createdTo 2014-08-22T00:00:00Z query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 3
	Get a list of payments within a date range, using obsolete from & to
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$from = date_format(new DateTime('2014-08-20T00:00:00Z'), DATE_ISO8601);
$to = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$createdFrom = date_format(new DateTime('2014-08-20T00:00:00Z'), DATE_ISO8601);
$createdTo = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payments?from=$from&to=$to&createdFrom=$createdFrom&createdTo=$createdTo&page=$page&pageSize=$pageSize";
$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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Example 3
 * Get a list of payments within a date range, using obsolete from & to
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException, ParseException {
		// Dates must be in ISO 8601 format
		SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
		dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String from = dateFormatter.format(dateFormatter.parse("2014-08-20T00:00:00Z"));
		String to = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		String createdFrom = dateFormatter.format(dateFormatter.parse("2014-08-20T00:00:00Z"));
		String createdTo = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payments?from=" + from + "&to=" + to + "&createdFrom=" + createdFrom + "&createdTo=" + createdTo + "&page=" + page + "&pageSize=" + pageSize;

		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
# Get a list of payments within a date range, using obsolete from & to
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set from="2014-08-20T00:00:00Z"
set to="2014-08-22T00:00:00Z"
set createdFrom="2014-08-20T00:00:00Z"
set createdTo="2014-08-22T00:00:00Z"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payments?from=%from%&to=%to%&createdFrom=%createdFrom%&createdTo=%createdTo%&page=%page%&pageSize=%pageSize%"

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;
using NodaTime.Text;

namespace Examples
{
	public class Example3
	{

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	Get a list of payments within a date range, using obsolete from & to
		///	Uses the Noda Time package to parse ISO8601 dates.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var from = InstantPattern.ExtendedIso.Parse("2014-08-20T00:00:00Z").Value.ToString();
				var to = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var createdFrom = InstantPattern.ExtendedIso.Parse("2014-08-20T00:00:00Z").Value.ToString();
				var createdTo = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/payments?from={1}&to={2}&createdFrom={3}&createdTo={4}&page={5}&pageSize={6}", merchantKey, 
					from, to, createdFrom, createdTo, page, pageSize);

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

Get a list of payments modified within a date range

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?createdFrom=2014-08-20T00:00:00Z&createdTo=2014-08-22T00:00:00Z&from=2014-08-20T00:00:00Z&page=0&pageSize=25&to=2014-08-22T00:00:00Z

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

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

from 2014-08-20T00:00:00Z query

Only include payments after a date/time (UTC)

to 2014-08-22T00:00:00Z query

Only include payments before a date/time (UTC)

createdFrom 2014-08-20T00:00:00Z query

Only include payments after a date/time (UTC)

createdTo 2014-08-22T00:00:00Z query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 4
	Get a list of payments modified within a date range
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$from = date_format(new DateTime('2014-08-20T00:00:00Z'), DATE_ISO8601);
$to = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$createdFrom = date_format(new DateTime('2014-08-20T00:00:00Z'), DATE_ISO8601);
$createdTo = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payments?from=$from&to=$to&createdFrom=$createdFrom&createdTo=$createdTo&page=$page&pageSize=$pageSize";
$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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Example 4
 * Get a list of payments modified within a date range
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException, ParseException {
		// Dates must be in ISO 8601 format
		SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
		dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String from = dateFormatter.format(dateFormatter.parse("2014-08-20T00:00:00Z"));
		String to = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		String createdFrom = dateFormatter.format(dateFormatter.parse("2014-08-20T00:00:00Z"));
		String createdTo = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payments?from=" + from + "&to=" + to + "&createdFrom=" + createdFrom + "&createdTo=" + createdTo + "&page=" + page + "&pageSize=" + pageSize;

		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 4
# Get a list of payments modified within a date range
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set from="2014-08-20T00:00:00Z"
set to="2014-08-22T00:00:00Z"
set createdFrom="2014-08-20T00:00:00Z"
set createdTo="2014-08-22T00:00:00Z"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payments?from=%from%&to=%to%&createdFrom=%createdFrom%&createdTo=%createdTo%&page=%page%&pageSize=%pageSize%"

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;
using NodaTime.Text;

namespace Examples
{
	public class Example4
	{

		/// <summary>
		///	Example 4
		/// </summary>
		/// <remarks>
		///	Get a list of payments modified within a date range
		///	Uses the Noda Time package to parse ISO8601 dates.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var from = InstantPattern.ExtendedIso.Parse("2014-08-20T00:00:00Z").Value.ToString();
				var to = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var createdFrom = InstantPattern.ExtendedIso.Parse("2014-08-20T00:00:00Z").Value.ToString();
				var createdTo = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/payments?from={1}&to={2}&createdFrom={3}&createdTo={4}&page={5}&pageSize={6}", merchantKey, 
					from, to, createdFrom, createdTo, page, pageSize);

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

Get a list of payments within a date range, using the preferred syntax

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=25&updatedFrom=2014-08-19T00:00:00Z&updatedTo=2014-08-22T00:00:00Z

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

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

from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom 2014-08-19T00:00:00Z query

Only include payments changed after a date/time (UTC)

updatedTo 2014-08-22T00:00:00Z query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 5
	Get a list of payments within a date range, using the preferred syntax
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$updatedFrom = date_format(new DateTime('2014-08-19T00:00:00Z'), DATE_ISO8601);
$updatedTo = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payments?updatedFrom=$updatedFrom&updatedTo=$updatedTo&page=$page&pageSize=$pageSize";
$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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Example 5
 * Get a list of payments within a date range, using the preferred syntax
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException, ParseException {
		// Dates must be in ISO 8601 format
		SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
		dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String updatedFrom = dateFormatter.format(dateFormatter.parse("2014-08-19T00:00:00Z"));
		String updatedTo = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payments?updatedFrom=" + updatedFrom + "&updatedTo=" + updatedTo + "&page=" + page + "&pageSize=" + pageSize;

		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 5
# Get a list of payments within a date range, using the preferred syntax
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set updatedFrom="2014-08-19T00:00:00Z"
set updatedTo="2014-08-22T00:00:00Z"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payments?updatedFrom=%updatedFrom%&updatedTo=%updatedTo%&page=%page%&pageSize=%pageSize%"

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;
using NodaTime.Text;

namespace Examples
{
	public class Example5
	{

		/// <summary>
		///	Example 5
		/// </summary>
		/// <remarks>
		///	Get a list of payments within a date range, using the preferred syntax
		///	Uses the Noda Time package to parse ISO8601 dates.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var updatedFrom = InstantPattern.ExtendedIso.Parse("2014-08-19T00:00:00Z").Value.ToString();
				var updatedTo = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/payments?updatedFrom={1}&updatedTo={2}&page={3}&pageSize={4}", merchantKey, 
					updatedFrom, updatedTo, page, pageSize);

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

Get a list of payments with a specified pagesize (max 100)

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=100

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

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

from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 100 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 6
	Get a list of payments with a specified pagesize (max 100)
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$page = 0;
$pageSize = 100;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payments?page=$page&pageSize=$pageSize";
$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 6
 * Get a list of payments with a specified pagesize (max 100)
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 6
# Get a list of payments with a specified pagesize (max 100)
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set page=0
set pageSize=100
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payments?page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 6
		/// </summary>
		/// <remarks>
		///	Get a list of payments with a specified pagesize (max 100)
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var page = 0;
				var pageSize = 100;
				var requestUrl = string.Format("/v1/merchant/{0}/payments?page={1}&pageSize={2}", merchantKey, 
					page, pageSize);

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

Get all payments that have succeeded

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=25&status=Success

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

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

from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status Success query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 7
	Get all payments that have succeeded
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$status = 'Success';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payments?status=$status&page=$page&pageSize=$pageSize";
$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 7
 * Get all payments that have succeeded
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String status = "Success";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payments?status=" + status + "&page=" + page + "&pageSize=" + pageSize;

		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 7
# Get all payments that have succeeded
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set status="Success"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payments?status=%status%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 7
		/// </summary>
		/// <remarks>
		///	Get all payments that have succeeded
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var status = "Success";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/payments?status={1}&page={2}&pageSize={3}", merchantKey, 
					status, page, pageSize);

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

Get all payments of a particular type

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=25&type=ACH

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

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

from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type ACH query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 8
	Get all payments of a particular type
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$type = 'ACH';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payments?type=$type&page=$page&pageSize=$pageSize";
$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 8
 * Get all payments of a particular type
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String type = "ACH";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payments?type=" + type + "&page=" + page + "&pageSize=" + pageSize;

		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 8
# Get all payments of a particular type
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set type="ACH"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payments?type=%type%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 8
		/// </summary>
		/// <remarks>
		///	Get all payments of a particular type
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var type = "ACH";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/payments?type={1}&page={2}&pageSize={3}", merchantKey, 
					type, page, pageSize);

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

Get all payments with certain values by reference field

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?fields[1]=For last week&page=0&pageSize=25

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

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

from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields[1] For last week query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 9
	Get all payments with certain values by reference field
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$fields1 = $page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/payments?fields[1]=$fields1&page=$page&pageSize=$pageSize";
$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 9
 * Get all payments with certain values by reference field
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/payments?fields[1]=" + fields1 + "&page=" + page + "&pageSize=" + pageSize;

		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 9
# Get all payments with certain values by reference field
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set fields1=For last week
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/payments?fields[1]=%fields1%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 9
		/// </summary>
		/// <remarks>
		///	Get all payments with certain values by reference field
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var fields1 = "For last week";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/payments?fields1={1}&page={2}&pageSize={3}", merchantKey, 
					fields1, page, pageSize);

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

Get Payments for a Recurring Payment

GET /v1/merchant/{merchantKey}/recurringpayment/{paymentToken}/payments

Path (URL) Parameters

Name Type Description
merchantKey string

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

paymentToken string

Query string (URL) parameters

Name Type Description
from string

Only include payments after a date/time (UTC)

to string

Only include payments before a date/time (UTC)

createdFrom string

Only include payments after a date/time (UTC)

createdTo string

Only include payments before a date/time (UTC)

updatedFrom string

Only include payments changed after a date/time (UTC)

updatedTo string

Only include payments changed before a date/time (UTC)

orderby string

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

type string

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status string

Only include payments with the specified status (Success, Failed, or Processing)

fields array

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source string

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page integer

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

pageSize integer

The page size parameter (Note: default page size is 25)

Required Scopes

Scope Description
merchant:view_recurring_payments View/search recurring payments for in-scope merchants
read Read-only access to resources owned by the subject claim of the token

Get a list of payments belonging to a recurring payment

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/VMZqPmcWY0qfsxoE38ja3w/payments?page=0&pageSize=25

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

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

paymentToken VMZqPmcWY0qfsxoE38ja3w path

The unique token of the payment - a case-sensitive series of characters

from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "recurringPaymentToken": "VMZqPmcWY0qfsxoE38ja3w", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "ScheduledPayment", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "recurringpayment": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/VMZqPmcWY0qfsxoE38ja3w" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/VMZqPmcWY0qfsxoE38ja3w" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/VMZqPmcWY0qfsxoE38ja3w" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 1
	Get a list of payments belonging to a recurring payment
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$paymentToken = 'VMZqPmcWY0qfsxoE38ja3w';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayment/$paymentToken/payments?page=$page&pageSize=$pageSize";
$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 list of payments belonging to a recurring payment
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String paymentToken = "VMZqPmcWY0qfsxoE38ja3w";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/recurringpayment/" + paymentToken + "/payments?page=" + page + "&pageSize=" + pageSize;

		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 list of payments belonging to a recurring payment
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set paymentToken="VMZqPmcWY0qfsxoE38ja3w"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayment/%paymentToken%/payments?page=%page%&pageSize=%pageSize%"

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 list of payments belonging to a recurring payment
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var paymentToken = "VMZqPmcWY0qfsxoE38ja3w";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayment/{1}/payments?page={2}&pageSize={3}", merchantKey, paymentToken, 
					page, pageSize);

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

Get Recurring Payment

GET /v1/merchant/{merchantKey}/recurringpayment/{token}

Retrieves a single recurring payment record, given the keys for the merchant and the payment

Path (URL) Parameters

Name Type Description
merchantKey string

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

token string

The token is a unique identifier for this resource - a case-sensitive series of characters

Required Scopes

Scope Description
merchant:view_recurring_payments View/search recurring payments for in-scope merchants
read Read-only access to resources owned by the subject claim of the token

Retrieve a single recurring payment schedule

Request

GET /v1/merchant/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw

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

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

token BQM1lWLcM0uKc1y4a8RHUw path

The token is a unique identifier for this resource - 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

{ "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } }
<?php
/*
	Example 1
	Retrieve a single recurring payment schedule
*/
$merchantKey = 'MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0';
$token = 'BQM1lWLcM0uKc1y4a8RHUw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayment/$token";
$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 single recurring payment schedule
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 single recurring payment schedule
set oAuthToken=%1
set merchantKey="MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0"
set token="BQM1lWLcM0uKc1y4a8RHUw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayment/%token%"

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 single recurring payment schedule
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0";
				var token = "BQM1lWLcM0uKc1y4a8RHUw";
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayment/{1}", merchantKey, token);

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

Retrieve a non-existant recurring payment schedule

Request

GET /v1/merchant/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0/recurringpayment/AAAAAAAAAAAAAAAAAAAAAA

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

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

token AAAAAAAAAAAAAAAAAAAAAA path

The token is a unique identifier for this resource - 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

{ "message": "The specified recurring payment key is unknown" }
<?php
/*
	Example 2
	Retrieve a non-existant recurring payment schedule
*/
$merchantKey = 'MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0';
$token = 'AAAAAAAAAAAAAAAAAAAAAA';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayment/$token";
$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
 * Retrieve a non-existant recurring payment schedule
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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
# Retrieve a non-existant recurring payment schedule
set oAuthToken=%1
set merchantKey="MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0"
set token="AAAAAAAAAAAAAAAAAAAAAA"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayment/%token%"

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>
		///	Retrieve a non-existant recurring payment schedule
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0";
				var token = "AAAAAAAAAAAAAAAAAAAAAA";
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayment/{1}", merchantKey, token);

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

Retrieve a recurring payment schedule against a non-existant payer

Request

GET /v1/merchant/NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw

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

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

token BQM1lWLcM0uKc1y4a8RHUw path

The token is a unique identifier for this resource - 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

{ "message": "The specified payer key is unknown" }
<?php
/*
	Example 3
	Retrieve a recurring payment schedule against a non-existant payer
*/
$merchantKey = 'NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk';
$token = 'BQM1lWLcM0uKc1y4a8RHUw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayment/$token";
$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 3
 * Retrieve a recurring payment schedule against a non-existant payer
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 3
# Retrieve a recurring payment schedule against a non-existant payer
set oAuthToken=%1
set merchantKey="NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk"
set token="BQM1lWLcM0uKc1y4a8RHUw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayment/%token%"

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>
		///	Retrieve a recurring payment schedule against a non-existant payer
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk";
				var token = "BQM1lWLcM0uKc1y4a8RHUw";
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayment/{1}", merchantKey, token);

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

Retrieve a recurring payment schedule that doesn't belong to the specified payer

Request

GET /v1/merchant/NDpOUlJfakxTWWx3VktnWVpvM3VaWDR3NDBMcDQ/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw

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

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

token BQM1lWLcM0uKc1y4a8RHUw path

The token is a unique identifier for this resource - 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

{ "message": "That recurring payment does not belong to the specified payer" }
<?php
/*
	Example 4
	Retrieve a recurring payment schedule that doesn't belong to the specified payer
*/
$merchantKey = 'NDpOUlJfakxTWWx3VktnWVpvM3VaWDR3NDBMcDQ';
$token = 'BQM1lWLcM0uKc1y4a8RHUw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayment/$token";
$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 4
 * Retrieve a recurring payment schedule that doesn't belong to the specified payer
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 4
# Retrieve a recurring payment schedule that doesn't belong to the specified payer
set oAuthToken=%1
set merchantKey="NDpOUlJfakxTWWx3VktnWVpvM3VaWDR3NDBMcDQ"
set token="BQM1lWLcM0uKc1y4a8RHUw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayment/%token%"

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

		/// <summary>
		///	Example 4
		/// </summary>
		/// <remarks>
		///	Retrieve a recurring payment schedule that doesn't belong to the specified payer
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "NDpOUlJfakxTWWx3VktnWVpvM3VaWDR3NDBMcDQ";
				var token = "BQM1lWLcM0uKc1y4a8RHUw";
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayment/{1}", merchantKey, token);

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

Retrieve a recurring payment schedule, which has additional custom data stored against it (which was included in the POST/PUT request when the recurring payment was made or updated)

Request

GET /v1/merchant/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw

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

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

token BQM1lWLcM0uKc1y4a8RHUw path

The token is a unique identifier for this resource - 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

{ "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "data": { "tx_id": "123123", "funds": [ "bits", "bobs" ] }, "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } }
<?php
/*
	Example 5
	Retrieve a recurring payment schedule, which has additional custom data stored against it (which was included in the POST/PUT request when the recurring payment was made or updated)
*/
$merchantKey = 'MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0';
$token = 'BQM1lWLcM0uKc1y4a8RHUw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayment/$token";
$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 5
 * Retrieve a recurring payment schedule, which has additional custom data stored against it (which was included in the POST/PUT request when the recurring payment was made or updated)
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 5
# Retrieve a recurring payment schedule, which has additional custom data stored against it (which was included in the POST/PUT request when the recurring payment was made or updated)
set oAuthToken=%1
set merchantKey="MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0"
set token="BQM1lWLcM0uKc1y4a8RHUw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayment/%token%"

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

		/// <summary>
		///	Example 5
		/// </summary>
		/// <remarks>
		///	Retrieve a recurring payment schedule, which has additional custom data stored against it (which was included in the POST/PUT request when the recurring payment was made or updated)
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0";
				var token = "BQM1lWLcM0uKc1y4a8RHUw";
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayment/{1}", merchantKey, token);

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

Get a single recurring payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_recurring_payments scope

Request

GET /v1/merchant/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw

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

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

token BQM1lWLcM0uKc1y4a8RHUw path

The token is a unique identifier for this resource - 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

{ "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "data": { "tx_id": "123123", "funds": [ "bits", "bobs" ] }, "externalLinks": [ { "application": { "name": "ChurchCommunityBuilder", "type": "ChurchManagementSystem" }, "relationship": "fund_id", "value": "5675" } ], "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } }
<?php
/*
	Example 6
	Get a single recurring payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_recurring_payments scope
*/
$merchantKey = 'MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0';
$token = 'BQM1lWLcM0uKc1y4a8RHUw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayment/$token";
$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 6
 * Get a single recurring payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_recurring_payments scope
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 6
# Get a single recurring payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_recurring_payments scope
set oAuthToken=%1
set merchantKey="MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0"
set token="BQM1lWLcM0uKc1y4a8RHUw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayment/%token%"

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

		/// <summary>
		///	Example 6
		/// </summary>
		/// <remarks>
		///	Get a single recurring payment which has an integration's fund_id included in the set of externalLinks. The external link is only included when the client has the merchant:view_recurring_payments scope
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0";
				var token = "BQM1lWLcM0uKc1y4a8RHUw";
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayment/{1}", merchantKey, token);

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

Get Recurring Payments for a Merchant

GET /v1/merchant/{merchantKey}/recurringpayments

Retrieves all recurring payment records associated with 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
updatedFrom string

Only include payments changed after a date/time (UTC)

updatedTo string

Only include payments changed before a date/time (UTC)

createdFrom string

Only include payments after a date/time (UTC)

createdTo string

Only include payments before a date/time (UTC)

status array

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

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)

pageSize integer

The page size parameter (Note: default page size is 25)

Required Scopes

Scope Description
merchant:view_recurring_payments View/search recurring payments for in-scope merchants

Retrieve all recurring payments associated with a recipient, with a default status of active

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?page=0&pageSize=25

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 1
	Retrieve all recurring payments associated with a recipient, with a default status of active
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?page=$page&pageSize=$pageSize";
$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
 * Retrieve all recurring payments associated with a recipient, with a default status of active
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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
# Retrieve all recurring payments associated with a recipient, with a default status of active
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?page=%page%&pageSize=%pageSize%"

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 all recurring payments associated with a recipient, with a default status of active
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?page={1}&pageSize={2}", merchantKey, 
					page, pageSize);

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

Retrieve all recurring payments associated with a recipient, with the specified status

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?page=0&pageSize=25&status=Paused

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status Paused query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 2
	Retrieve all recurring payments associated with a recipient, with the specified status
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$status = $page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?status=$status&page=$page&pageSize=$pageSize";
$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
 * Retrieve all recurring payments associated with a recipient, with the specified status
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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
# Retrieve all recurring payments associated with a recipient, with the specified status
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set status=Paused
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?status=%status%&page=%page%&pageSize=%pageSize%"

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>
		///	Retrieve all recurring payments associated with a recipient, with the specified status
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var status = "Paused";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?status={1}&page={2}&pageSize={3}", merchantKey, 
					status, page, pageSize);

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

Retrieve all recurring payments associated with a recipient, with any of the specified statues

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?page=0&pageSize=25&status=Paused&status=Cancelled

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status Paused query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

status Cancelled query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 3
	Retrieve all recurring payments associated with a recipient, with any of the specified statues
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$status = $status = $page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?status=$status&status=$status&page=$page&pageSize=$pageSize";
$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
 * Retrieve all recurring payments associated with a recipient, with any of the specified statues
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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
# Retrieve all recurring payments associated with a recipient, with any of the specified statues
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set status=Paused
set status=Cancelled
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?status=%status%&status=%status%&page=%page%&pageSize=%pageSize%"

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>
		///	Retrieve all recurring payments associated with a recipient, with any of the specified statues
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var status = "Paused";
				var status = "Cancelled";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?status={1}&status={2}&page={3}&pageSize={4}", merchantKey, 
					status, status, page, pageSize);

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

Retrieve all recurring payments associated with a recipient, ordered by creation date

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?orderBy=createdOn ASC&page=0&pageSize=25

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

orderBy createdOn 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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 4
	Retrieve all recurring payments associated with a recipient, ordered by creation date
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$orderBy = 'createdOn ASC';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?orderBy=$orderBy&page=$page&pageSize=$pageSize";
$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 4
 * Retrieve all recurring payments associated with a recipient, ordered by creation date
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String orderBy = "createdOn ASC";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/recurringpayments?orderBy=" + orderBy + "&page=" + page + "&pageSize=" + pageSize;

		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 4
# Retrieve all recurring payments associated with a recipient, ordered by creation date
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set orderBy="createdOn ASC"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?orderBy=%orderBy%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 4
		/// </summary>
		/// <remarks>
		///	Retrieve all recurring payments associated with a recipient, ordered by creation date
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var orderBy = "createdOn ASC";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?orderBy={1}&page={2}&pageSize={3}", merchantKey, 
					orderBy, page, pageSize);

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

Retrieve all recurring payments associated with a recipient, ordered by update date

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?orderBy=updatedOn DESC&page=0&pageSize=25

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

orderBy updatedOn DESC 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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 5
	Retrieve all recurring payments associated with a recipient, ordered by update date
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$orderBy = 'updatedOn DESC';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?orderBy=$orderBy&page=$page&pageSize=$pageSize";
$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 5
 * Retrieve all recurring payments associated with a recipient, ordered by update date
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String orderBy = "updatedOn DESC";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/recurringpayments?orderBy=" + orderBy + "&page=" + page + "&pageSize=" + pageSize;

		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 5
# Retrieve all recurring payments associated with a recipient, ordered by update date
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set orderBy="updatedOn DESC"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?orderBy=%orderBy%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 5
		/// </summary>
		/// <remarks>
		///	Retrieve all recurring payments associated with a recipient, ordered by update date
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var orderBy = "updatedOn DESC";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?orderBy={1}&page={2}&pageSize={3}", merchantKey, 
					orderBy, page, pageSize);

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

Retrieve all recurring payments associated with a recipient, ordered by start date

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?orderBy=startDate ASC&page=0&pageSize=25

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

orderBy startDate 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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 6
	Retrieve all recurring payments associated with a recipient, ordered by start date
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$orderBy = 'startDate ASC';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?orderBy=$orderBy&page=$page&pageSize=$pageSize";
$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 6
 * Retrieve all recurring payments associated with a recipient, ordered by start date
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String orderBy = "startDate ASC";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/recurringpayments?orderBy=" + orderBy + "&page=" + page + "&pageSize=" + pageSize;

		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 6
# Retrieve all recurring payments associated with a recipient, ordered by start date
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set orderBy="startDate ASC"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?orderBy=%orderBy%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 6
		/// </summary>
		/// <remarks>
		///	Retrieve all recurring payments associated with a recipient, ordered by start date
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var orderBy = "startDate ASC";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?orderBy={1}&page={2}&pageSize={3}", merchantKey, 
					orderBy, page, pageSize);

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

Retrieve all recurring payments associated with a recipient, ordered by next payment date

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?orderBy=nextPaymentDate ASC&page=0&pageSize=25

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

orderBy nextPaymentDate 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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 7
	Retrieve all recurring payments associated with a recipient, ordered by next payment date
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$orderBy = 'nextPaymentDate ASC';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?orderBy=$orderBy&page=$page&pageSize=$pageSize";
$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 7
 * Retrieve all recurring payments associated with a recipient, ordered by next payment date
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String orderBy = "nextPaymentDate ASC";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/recurringpayments?orderBy=" + orderBy + "&page=" + page + "&pageSize=" + pageSize;

		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 7
# Retrieve all recurring payments associated with a recipient, ordered by next payment date
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set orderBy="nextPaymentDate ASC"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?orderBy=%orderBy%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 7
		/// </summary>
		/// <remarks>
		///	Retrieve all recurring payments associated with a recipient, ordered by next payment date
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var orderBy = "nextPaymentDate ASC";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?orderBy={1}&page={2}&pageSize={3}", merchantKey, 
					orderBy, page, pageSize);

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

Retrieve all recurring payments associated with a recipient, ordered by when they were last updated

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?orderBy=updatedOn DESC&page=0&pageSize=25

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

orderBy updatedOn DESC 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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 8
	Retrieve all recurring payments associated with a recipient, ordered by when they were last updated
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$orderBy = 'updatedOn DESC';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?orderBy=$orderBy&page=$page&pageSize=$pageSize";
$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 8
 * Retrieve all recurring payments associated with a recipient, ordered by when they were last updated
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String orderBy = "updatedOn DESC";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/recurringpayments?orderBy=" + orderBy + "&page=" + page + "&pageSize=" + pageSize;

		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 8
# Retrieve all recurring payments associated with a recipient, ordered by when they were last updated
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set orderBy="updatedOn DESC"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?orderBy=%orderBy%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 8
		/// </summary>
		/// <remarks>
		///	Retrieve all recurring payments associated with a recipient, ordered by when they were last updated
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var orderBy = "updatedOn DESC";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?orderBy={1}&page={2}&pageSize={3}", merchantKey, 
					orderBy, page, pageSize);

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

Retrieve all recurring payments created within a date range

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?createdFrom=2015-01-01T00:00:00Z&createdTo=2015-02-01T00:00:00Z&orderBy=createdOn DESC&page=0&pageSize=25

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom 2015-01-01T00:00:00Z query

Only include payments after a date/time (UTC)

createdTo 2015-02-01T00:00:00Z query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

orderBy createdOn DESC 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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 9
	Retrieve all recurring payments created within a date range
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$createdFrom = date_format(new DateTime('2015-01-01T00:00:00Z'), DATE_ISO8601);
$createdTo = date_format(new DateTime('2015-02-01T00:00:00Z'), DATE_ISO8601);
$orderBy = 'createdOn DESC';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?createdFrom=$createdFrom&createdTo=$createdTo&orderBy=$orderBy&page=$page&pageSize=$pageSize";
$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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Example 9
 * Retrieve all recurring payments created within a date range
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException, ParseException {
		// Dates must be in ISO 8601 format
		SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
		dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String createdFrom = dateFormatter.format(dateFormatter.parse("2015-01-01T00:00:00Z"));
		String createdTo = dateFormatter.format(dateFormatter.parse("2015-02-01T00:00:00Z"));
		String orderBy = "createdOn DESC";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/recurringpayments?createdFrom=" + createdFrom + "&createdTo=" + createdTo + "&orderBy=" + orderBy + "&page=" + page + "&pageSize=" + pageSize;

		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 9
# Retrieve all recurring payments created within a date range
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set createdFrom="2015-01-01T00:00:00Z"
set createdTo="2015-02-01T00:00:00Z"
set orderBy="createdOn DESC"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?createdFrom=%createdFrom%&createdTo=%createdTo%&orderBy=%orderBy%&page=%page%&pageSize=%pageSize%"

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;
using NodaTime.Text;

namespace Examples
{
	public class Example9
	{

		/// <summary>
		///	Example 9
		/// </summary>
		/// <remarks>
		///	Retrieve all recurring payments created within a date range
		///	Uses the Noda Time package to parse ISO8601 dates.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var createdFrom = InstantPattern.ExtendedIso.Parse("2015-01-01T00:00:00Z").Value.ToString();
				var createdTo = InstantPattern.ExtendedIso.Parse("2015-02-01T00:00:00Z").Value.ToString();
				var orderBy = "createdOn DESC";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?createdFrom={1}&createdTo={2}&orderBy={3}&page={4}&pageSize={5}", merchantKey, 
					createdFrom, createdTo, orderBy, page, pageSize);

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

Retrieve all recurring payments updated within a date range

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?orderBy=updatedOn DESC&page=0&pageSize=25&updatedFrom=2015-06-01T00:00:00Z&updatedTo=2015-06-15T00:00:00Z

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

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

updatedFrom 2015-06-01T00:00:00Z query

Only include payments changed after a date/time (UTC)

updatedTo 2015-06-15T00:00:00Z query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

orderBy updatedOn DESC 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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 10
	Retrieve all recurring payments updated within a date range
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$updatedFrom = date_format(new DateTime('2015-06-01T00:00:00Z'), DATE_ISO8601);
$updatedTo = date_format(new DateTime('2015-06-15T00:00:00Z'), DATE_ISO8601);
$orderBy = 'updatedOn DESC';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?updatedFrom=$updatedFrom&updatedTo=$updatedTo&orderBy=$orderBy&page=$page&pageSize=$pageSize";
$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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Example 10
 * Retrieve all recurring payments updated within a date range
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException, ParseException {
		// Dates must be in ISO 8601 format
		SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
		dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
		String merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String updatedFrom = dateFormatter.format(dateFormatter.parse("2015-06-01T00:00:00Z"));
		String updatedTo = dateFormatter.format(dateFormatter.parse("2015-06-15T00:00:00Z"));
		String orderBy = "updatedOn DESC";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/recurringpayments?updatedFrom=" + updatedFrom + "&updatedTo=" + updatedTo + "&orderBy=" + orderBy + "&page=" + page + "&pageSize=" + pageSize;

		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 10
# Retrieve all recurring payments updated within a date range
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set updatedFrom="2015-06-01T00:00:00Z"
set updatedTo="2015-06-15T00:00:00Z"
set orderBy="updatedOn DESC"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?updatedFrom=%updatedFrom%&updatedTo=%updatedTo%&orderBy=%orderBy%&page=%page%&pageSize=%pageSize%"

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;
using NodaTime.Text;

namespace Examples
{
	public class Example10
	{

		/// <summary>
		///	Example 10
		/// </summary>
		/// <remarks>
		///	Retrieve all recurring payments updated within a date range
		///	Uses the Noda Time package to parse ISO8601 dates.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var updatedFrom = InstantPattern.ExtendedIso.Parse("2015-06-01T00:00:00Z").Value.ToString();
				var updatedTo = InstantPattern.ExtendedIso.Parse("2015-06-15T00:00:00Z").Value.ToString();
				var orderBy = "updatedOn DESC";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?updatedFrom={1}&updatedTo={2}&orderBy={3}&page={4}&pageSize={5}", merchantKey, 
					updatedFrom, updatedTo, orderBy, page, pageSize);

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

Retrieve all recurring payments with a specified pagesize (max 100)

Request

GET /v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?page=0&pageSize=100

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

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

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

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)

pageSize 100 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 11
	Retrieve all recurring payments with a specified pagesize (max 100)
*/
$merchantKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$page = 0;
$pageSize = 100;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/recurringpayments?page=$page&pageSize=$pageSize";
$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 11
 * Retrieve all recurring payments with a specified pagesize (max 100)
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 11
# Retrieve all recurring payments with a specified pagesize (max 100)
set oAuthToken=%1
set merchantKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set page=0
set pageSize=100
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/recurringpayments?page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 11
		/// </summary>
		/// <remarks>
		///	Retrieve all recurring payments with a specified pagesize (max 100)
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var page = 0;
				var pageSize = 100;
				var requestUrl = string.Format("/v1/merchant/{0}/recurringpayments?page={1}&pageSize={2}", merchantKey, 
					page, pageSize);

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

Get Split Payment

GET /v1/merchant/{merchantKey}/splitpayment/{splitPaymentKey}

Path (URL) Parameters

Name Type Description
merchantKey string

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

splitPaymentKey string

The unique key of the split payment - a case-sensitive series of characters

Required Scopes

Scope Description
merchant:view_payments View/search payments for in-scope merchants
read Read-only access to resources owned by the subject claim of the token

Retrieve a single split payment

Request

GET /v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA/splitpayment/MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw

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

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

splitPaymentKey MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw path

The unique key of the split payment - 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": "MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw", "totalAmount": { "amount": "150.00", "currency": "USD" }, "items": [ { "status": "Success", "transactionId": "1", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA/community/NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk" } } }, "recipient": { "key": "NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "23456", "value": "For last week", "label": "Message" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "depositedCheck": { "routingNumber": "123456789", "reference": "123456789 ●●●●12", "bankName": "Unknown", "checkNumber": "111111111" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA" } } }, { "status": "Success", "transactionId": "2", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA/community/NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk" } } }, "recipient": { "key": "NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "23456", "value": "For last week", "label": "Message" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "depositedCheck": { "routingNumber": "123456789", "reference": "123456789 ●●●●12", "bankName": "Unknown", "checkNumber": "111111111" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA" } } }, { "status": "Success", "transactionId": "3", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA/community/NToyWlFWbUhKNF9qa2JzZDFDckxQUVRaSlZkNlk" } } }, "recipient": { "key": "NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "23456", "value": "For last week", "label": "Message" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "depositedCheck": { "routingNumber": "123456789", "reference": "123456789 ●●●●12", "bankName": "Unknown", "checkNumber": "111111111" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MDpMYWd4QzRrNHhlZXl4Zmg5bjA2UkswTS0wblU/splitpayment/MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw" } } }
<?php
/*
	Example 1
	Retrieve a single split payment
*/
$merchantKey = 'NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA';
$splitPaymentKey = 'MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/splitpayment/$splitPaymentKey";
$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 single split payment
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 single split payment
set oAuthToken=%1
set merchantKey="NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA"
set splitPaymentKey="MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/splitpayment/%splitPaymentKey%"

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 single split payment
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA";
				var splitPaymentKey = "MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw";
				var requestUrl = string.Format("/v1/merchant/{0}/splitpayment/{1}", merchantKey, splitPaymentKey);

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

Retrieve a non-existent split payment

Request

GET /v1/merchant/NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA/splitpayment/MDpHVVduREJhUU5XeFJzdGdpYWRaOHgyUzJxaFE

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

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

splitPaymentKey MDpHVVduREJhUU5XeFJzdGdpYWRaOHgyUzJxaFE path

The unique key of the split payment - 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

{ "message": "The specified split payment key is unknown" }
<?php
/*
	Example 2
	Retrieve a non-existent split payment
*/
$merchantKey = 'NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA';
$splitPaymentKey = 'MDpHVVduREJhUU5XeFJzdGdpYWRaOHgyUzJxaFE';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/splitpayment/$splitPaymentKey";
$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
 * Retrieve a non-existent split payment
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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
# Retrieve a non-existent split payment
set oAuthToken=%1
set merchantKey="NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA"
set splitPaymentKey="MDpHVVduREJhUU5XeFJzdGdpYWRaOHgyUzJxaFE"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/splitpayment/%splitPaymentKey%"

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>
		///	Retrieve a non-existent split payment
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "NDpkdDUydTFYUXBER3ctLUVfbHVlb2p1QnFvNjA";
				var splitPaymentKey = "MDpHVVduREJhUU5XeFJzdGdpYWRaOHgyUzJxaFE";
				var requestUrl = string.Format("/v1/merchant/{0}/splitpayment/{1}", merchantKey, splitPaymentKey);

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

Retrieve a split payment against a non-existent merchant

Request

GET /v1/merchant/MDpMYWd4QzRrNHhlZXl4Zmg5bjA2UkswTS0wblU/splitpayment/MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw

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

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

splitPaymentKey MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw path

The unique key of the split payment - 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

{ "message": "The specified merchant key is unknown" }
<?php
/*
	Example 3
	Retrieve a split payment against a non-existent merchant
*/
$merchantKey = 'MDpMYWd4QzRrNHhlZXl4Zmg5bjA2UkswTS0wblU';
$splitPaymentKey = 'MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/splitpayment/$splitPaymentKey";
$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 3
 * Retrieve a split payment against a non-existent merchant
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 3
# Retrieve a split payment against a non-existent merchant
set oAuthToken=%1
set merchantKey="MDpMYWd4QzRrNHhlZXl4Zmg5bjA2UkswTS0wblU"
set splitPaymentKey="MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/splitpayment/%splitPaymentKey%"

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>
		///	Retrieve a split payment against a non-existent merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MDpMYWd4QzRrNHhlZXl4Zmg5bjA2UkswTS0wblU";
				var splitPaymentKey = "MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw";
				var requestUrl = string.Format("/v1/merchant/{0}/splitpayment/{1}", merchantKey, splitPaymentKey);

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

Retrieve a split payment that doesn't belong to the specified merchant

Request

GET /v1/merchant/MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg/splitpayment/MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw

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

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

splitPaymentKey MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw path

The unique key of the split payment - 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

{ "message": "That split payment does not belong to the specified merchant" }
<?php
/*
	Example 4
	Retrieve a split payment that doesn't belong to the specified merchant
*/
$merchantKey = 'MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg';
$splitPaymentKey = 'MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/splitpayment/$splitPaymentKey";
$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 4
 * Retrieve a split payment that doesn't belong to the specified merchant
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 4
# Retrieve a split payment that doesn't belong to the specified merchant
set oAuthToken=%1
set merchantKey="MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg"
set splitPaymentKey="MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/splitpayment/%splitPaymentKey%"

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

		/// <summary>
		///	Example 4
		/// </summary>
		/// <remarks>
		///	Retrieve a split payment that doesn't belong to the specified merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MjpIbFlXZFRwRzRSWG5aSlhIbFZLTkdGalBsSDg";
				var splitPaymentKey = "MTIzOjlrd1o0Sjl4a2FzQVdkQXRZS0VoWjJwSFI4bw";
				var requestUrl = string.Format("/v1/merchant/{0}/splitpayment/{1}", merchantKey, splitPaymentKey);

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

Get My Payments

GET /v1/my/payments

This operation requires that the OAuth2 bearer token include a 'sub' (subject) claim.

Query string (URL) parameters

Name Type Description
from string

Only include payments after a date/time (UTC)

to string

Only include payments before a date/time (UTC)

createdFrom string

Only include payments after a date/time (UTC)

createdTo string

Only include payments before a date/time (UTC)

updatedFrom string

Only include payments changed after a date/time (UTC)

updatedTo string

Only include payments changed before a date/time (UTC)

orderby string

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

type string

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status string

Only include payments with the specified status (Success, Failed, or Processing)

fields array

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source string

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page integer

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

pageSize integer

The page size parameter (Note: default page size is 25)

Required Scopes

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

Get a list of my payments

Request

GET /v1/my/payments?page=0&pageSize=25

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
from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 1
	Get a list of my payments
*/
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/my/payments?page=$page&pageSize=$pageSize";
$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 list of my payments
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/my/payments?page=" + page + "&pageSize=" + pageSize;

		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 list of my payments
set oAuthToken=%1
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/my/payments?page=%page%&pageSize=%pageSize%"

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 list of my payments
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/my/payments?page={0}&pageSize={1}", page, pageSize);

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

Get third page of a list of my payments

Request

GET /v1/my/payments?page=2&pageSize=25

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
from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 2 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 50, "pageSize": 25, "total": 51, "totalPages": 3, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=2" }, "prev": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=49" }, "first": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0" } } }
<?php
/*
	Example 2
	Get third page of a list of my payments
*/
$page = 2;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/my/payments?page=$page&pageSize=$pageSize";
$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
 * Get third page of a list of my payments
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		int page = 2;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/my/payments?page=" + page + "&pageSize=" + pageSize;

		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
# Get third page of a list of my payments
set oAuthToken=%1
set page=2
set pageSize=25
set url="https://api.pushpay.com/v1/my/payments?page=%page%&pageSize=%pageSize%"

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>
		///	Get third page of a list of my payments
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var page = 2;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/my/payments?page={0}&pageSize={1}", page, pageSize);

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

Get a list of my payments within a date range

Request

GET /v1/my/payments?createdFrom=2014-08-20T00:00:00Z&createdTo=2014-08-22T00:00:00Z&from=2014-08-20T00:00:00Z&page=0&pageSize=25&to=2014-08-22T00:00:00Z

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
from 2014-08-20T00:00:00Z query

Only include payments after a date/time (UTC)

to 2014-08-22T00:00:00Z query

Only include payments before a date/time (UTC)

createdFrom 2014-08-20T00:00:00Z query

Only include payments after a date/time (UTC)

createdTo 2014-08-22T00:00:00Z query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 3
	Get a list of my payments within a date range
*/
$from = date_format(new DateTime('2014-08-20T00:00:00Z'), DATE_ISO8601);
$to = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$createdFrom = date_format(new DateTime('2014-08-20T00:00:00Z'), DATE_ISO8601);
$createdTo = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/my/payments?from=$from&to=$to&createdFrom=$createdFrom&createdTo=$createdTo&page=$page&pageSize=$pageSize";
$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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Example 3
 * Get a list of my payments within a date range
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException, ParseException {
		// Dates must be in ISO 8601 format
		SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
		dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
		String from = dateFormatter.format(dateFormatter.parse("2014-08-20T00:00:00Z"));
		String to = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		String createdFrom = dateFormatter.format(dateFormatter.parse("2014-08-20T00:00:00Z"));
		String createdTo = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/my/payments?from=" + from + "&to=" + to + "&createdFrom=" + createdFrom + "&createdTo=" + createdTo + "&page=" + page + "&pageSize=" + pageSize;

		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
# Get a list of my payments within a date range
set oAuthToken=%1
set from="2014-08-20T00:00:00Z"
set to="2014-08-22T00:00:00Z"
set createdFrom="2014-08-20T00:00:00Z"
set createdTo="2014-08-22T00:00:00Z"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/my/payments?from=%from%&to=%to%&createdFrom=%createdFrom%&createdTo=%createdTo%&page=%page%&pageSize=%pageSize%"

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;
using NodaTime.Text;

namespace Examples
{
	public class Example3
	{

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	Get a list of my payments within a date range
		///	Uses the Noda Time package to parse ISO8601 dates.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var from = InstantPattern.ExtendedIso.Parse("2014-08-20T00:00:00Z").Value.ToString();
				var to = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var createdFrom = InstantPattern.ExtendedIso.Parse("2014-08-20T00:00:00Z").Value.ToString();
				var createdTo = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/my/payments?from={0}&to={1}&createdFrom={2}&createdTo={3}&page={4}&pageSize={5}", 
					from, to, createdFrom, createdTo, page, pageSize);

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

Get Payments for Organization

GET /v1/organization/{organizationKey}/payments

Path (URL) Parameters

Name Type Description
organizationKey string

Query string (URL) parameters

Name Type Description
from string

Only include payments after a date/time (UTC)

to string

Only include payments before a date/time (UTC)

createdFrom string

Only include payments after a date/time (UTC)

createdTo string

Only include payments before a date/time (UTC)

updatedFrom string

Only include payments changed after a date/time (UTC)

updatedTo string

Only include payments changed before a date/time (UTC)

orderby string

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

type string

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status string

Only include payments with the specified status (Success, Failed, or Processing)

fields array

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source string

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page integer

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

pageSize integer

The page size parameter (Note: default page size is 25)

Required Scopes

Scope Description
merchant:view_payments View/search payments for in-scope merchants

Get a list of payments belonging to the organization

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=25

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 1
	Get a list of payments belonging to the organization
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/payments?page=$page&pageSize=$pageSize";
$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 list of payments belonging to the organization
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/payments?page=" + page + "&pageSize=" + pageSize;

		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 list of payments belonging to the organization
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/payments?page=%page%&pageSize=%pageSize%"

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 list of payments belonging to the organization
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/payments?page={1}&pageSize={2}", organizationKey, 
					page, pageSize);

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

Get third page of a list of payments belonging to the organization

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=2&pageSize=25

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 2 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "page": 2, "pageSize": 25, "total": 51, "totalPages": 3, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=2" }, "prev": { "href": "https://api.pushpay.com/v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=1" }, "first": { "href": "https://api.pushpay.com/v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0" } } }
<?php
/*
	Example 2
	Get third page of a list of payments belonging to the organization
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$page = 2;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/payments?page=$page&pageSize=$pageSize";
$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
 * Get third page of a list of payments belonging to the organization
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		int page = 2;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/payments?page=" + page + "&pageSize=" + pageSize;

		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
# Get third page of a list of payments belonging to the organization
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set page=2
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/payments?page=%page%&pageSize=%pageSize%"

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>
		///	Get third page of a list of payments belonging to the organization
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var page = 2;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/payments?page={1}&pageSize={2}", organizationKey, 
					page, pageSize);

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

Get a list of payments modified within a date range

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?createdFrom=2014-08-20T00:00:00Z&createdTo=2014-08-22T00:00:00Z&from=2014-08-20T00:00:00Z&page=0&pageSize=25&to=2014-08-22T00:00:00Z

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
from 2014-08-20T00:00:00Z query

Only include payments after a date/time (UTC)

to 2014-08-22T00:00:00Z query

Only include payments before a date/time (UTC)

createdFrom 2014-08-20T00:00:00Z query

Only include payments after a date/time (UTC)

createdTo 2014-08-22T00:00:00Z query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 3
	Get a list of payments modified within a date range
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$from = date_format(new DateTime('2014-08-20T00:00:00Z'), DATE_ISO8601);
$to = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$createdFrom = date_format(new DateTime('2014-08-20T00:00:00Z'), DATE_ISO8601);
$createdTo = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/payments?from=$from&to=$to&createdFrom=$createdFrom&createdTo=$createdTo&page=$page&pageSize=$pageSize";
$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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Example 3
 * Get a list of payments modified within a date range
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException, ParseException {
		// Dates must be in ISO 8601 format
		SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
		dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String from = dateFormatter.format(dateFormatter.parse("2014-08-20T00:00:00Z"));
		String to = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		String createdFrom = dateFormatter.format(dateFormatter.parse("2014-08-20T00:00:00Z"));
		String createdTo = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/payments?from=" + from + "&to=" + to + "&createdFrom=" + createdFrom + "&createdTo=" + createdTo + "&page=" + page + "&pageSize=" + pageSize;

		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
# Get a list of payments modified within a date range
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set from="2014-08-20T00:00:00Z"
set to="2014-08-22T00:00:00Z"
set createdFrom="2014-08-20T00:00:00Z"
set createdTo="2014-08-22T00:00:00Z"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/payments?from=%from%&to=%to%&createdFrom=%createdFrom%&createdTo=%createdTo%&page=%page%&pageSize=%pageSize%"

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;
using NodaTime.Text;

namespace Examples
{
	public class Example3
	{

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	Get a list of payments modified within a date range
		///	Uses the Noda Time package to parse ISO8601 dates.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var from = InstantPattern.ExtendedIso.Parse("2014-08-20T00:00:00Z").Value.ToString();
				var to = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var createdFrom = InstantPattern.ExtendedIso.Parse("2014-08-20T00:00:00Z").Value.ToString();
				var createdTo = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/payments?from={1}&to={2}&createdFrom={3}&createdTo={4}&page={5}&pageSize={6}", organizationKey, 
					from, to, createdFrom, createdTo, page, pageSize);

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

Get a list of payments within a date range, using the preferred syntax

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=25&updatedFrom=2014-08-19T00:00:00Z&updatedTo=2014-08-22T00:00:00Z

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom 2014-08-19T00:00:00Z query

Only include payments changed after a date/time (UTC)

updatedTo 2014-08-22T00:00:00Z query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 4
	Get a list of payments within a date range, using the preferred syntax
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$updatedFrom = date_format(new DateTime('2014-08-19T00:00:00Z'), DATE_ISO8601);
$updatedTo = date_format(new DateTime('2014-08-22T00:00:00Z'), DATE_ISO8601);
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/payments?updatedFrom=$updatedFrom&updatedTo=$updatedTo&page=$page&pageSize=$pageSize";
$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.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Example 4
 * Get a list of payments within a date range, using the preferred syntax
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException, ParseException {
		// Dates must be in ISO 8601 format
		SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
		dateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String updatedFrom = dateFormatter.format(dateFormatter.parse("2014-08-19T00:00:00Z"));
		String updatedTo = dateFormatter.format(dateFormatter.parse("2014-08-22T00:00:00Z"));
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/payments?updatedFrom=" + updatedFrom + "&updatedTo=" + updatedTo + "&page=" + page + "&pageSize=" + pageSize;

		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 4
# Get a list of payments within a date range, using the preferred syntax
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set updatedFrom="2014-08-19T00:00:00Z"
set updatedTo="2014-08-22T00:00:00Z"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/payments?updatedFrom=%updatedFrom%&updatedTo=%updatedTo%&page=%page%&pageSize=%pageSize%"

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;
using NodaTime.Text;

namespace Examples
{
	public class Example4
	{

		/// <summary>
		///	Example 4
		/// </summary>
		/// <remarks>
		///	Get a list of payments within a date range, using the preferred syntax
		///	Uses the Noda Time package to parse ISO8601 dates.
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var updatedFrom = InstantPattern.ExtendedIso.Parse("2014-08-19T00:00:00Z").Value.ToString();
				var updatedTo = InstantPattern.ExtendedIso.Parse("2014-08-22T00:00:00Z").Value.ToString();
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/payments?updatedFrom={1}&updatedTo={2}&page={3}&pageSize={4}", organizationKey, 
					updatedFrom, updatedTo, page, pageSize);

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

Get a list of payments with a specified pagesize (max 100)

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=100

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 100 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 5
	Get a list of payments with a specified pagesize (max 100)
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$page = 0;
$pageSize = 100;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/payments?page=$page&pageSize=$pageSize";
$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 5
 * Get a list of payments with a specified pagesize (max 100)
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		int page = 0;
		int pageSize = 100;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/payments?page=" + page + "&pageSize=" + pageSize;

		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 5
# Get a list of payments with a specified pagesize (max 100)
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set page=0
set pageSize=100
set url="https://api.pushpay.com/v1/organization/%organizationKey%/payments?page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 5
		/// </summary>
		/// <remarks>
		///	Get a list of payments with a specified pagesize (max 100)
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var page = 0;
				var pageSize = 100;
				var requestUrl = string.Format("/v1/organization/{0}/payments?page={1}&pageSize={2}", organizationKey, 
					page, pageSize);

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

Get all payments that have succeeded

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=25&status=Success

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status Success query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 6
	Get all payments that have succeeded
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$status = 'Success';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/payments?status=$status&page=$page&pageSize=$pageSize";
$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 6
 * Get all payments that have succeeded
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String status = "Success";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/payments?status=" + status + "&page=" + page + "&pageSize=" + pageSize;

		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 6
# Get all payments that have succeeded
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set status="Success"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/payments?status=%status%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 6
		/// </summary>
		/// <remarks>
		///	Get all payments that have succeeded
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var status = "Success";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/payments?status={1}&page={2}&pageSize={3}", organizationKey, 
					status, page, pageSize);

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

Get all payments of a particular type

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments?page=0&pageSize=25&type=ACH

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
from query

Only include payments after a date/time (UTC)

to query

Only include payments before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

orderby query

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

type ACH query

Only include payments made with the specified type of payment method (ACH, CreditCard, DepositedCheck, or NzBankAccount)

status query

Only include payments with the specified status (Success, Failed, or Processing)

fields query

Only include payments that contain a specified value within a custom field. Uses format 'fields[FieldNumber]'

source query

Only include payment sources of (Mobile, Web, Recurring, Kiosk, VirtualTerminal, TextGiving, CheckDeposit, TransactionImport or BatchEntry). If payment source is not explicity set then all payments except for TransactionImport payments will be returned.

page 0 query

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

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "paymentToken": "HgHeIQ-Ui0yJPHtavtS2uQ", "amount": { "amount": "50.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+15555555555", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1", "value": "For last week", "label": "Message" }, { "key": "2", "value": "123", "label": "Campus" } ], "createdOn": "2014-08-21T10:45:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "CreditCard", "source": "MobileApp", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Eastbrook Campus", "key": "MTY0NTgwOlk4ZnY4ZDUzWE1mOGt2RGxXTEM4MzdaTUUxTQ" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payment/HgHeIQ-Ui0yJPHtavtS2uQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/payments" } } }
<?php
/*
	Example 7
	Get all payments of a particular type
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$type = 'ACH';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/payments?type=$type&page=$page&pageSize=$pageSize";
$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 7
 * Get all payments of a particular type
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		String type = "ACH";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/payments?type=" + type + "&page=" + page + "&pageSize=" + pageSize;

		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 7
# Get all payments of a particular type
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set type="ACH"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/payments?type=%type%&page=%page%&pageSize=%pageSize%"

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

		/// <summary>
		///	Example 7
		/// </summary>
		/// <remarks>
		///	Get all payments of a particular type
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var type = "ACH";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/payments?type={1}&page={2}&pageSize={3}", organizationKey, 
					type, page, pageSize);

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

Get Recurring Payments for an Organization

GET /v1/organization/{organizationKey}/recurringpayments

Retrieves all recurring payment records associated with an organization

Path (URL) Parameters

Name Type Description
organizationKey string

Query string (URL) parameters

Name Type Description
updatedFrom string

Only include payments changed after a date/time (UTC)

updatedTo string

Only include payments changed before a date/time (UTC)

createdFrom string

Only include payments after a date/time (UTC)

createdTo string

Only include payments before a date/time (UTC)

status array

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

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)

pageSize integer

The page size parameter (Note: default page size is 25)

Required Scopes

Scope Description
merchant:view_recurring_payments View/search recurring payments for in-scope merchants

Retrieve all recurring payments associated with a recipient, with a default status of active

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?page=0&pageSize=25

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "organizationKey", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 1
	Retrieve all recurring payments associated with a recipient, with a default status of active
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/recurringpayments?page=$page&pageSize=$pageSize";
$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
 * Retrieve all recurring payments associated with a recipient, with a default status of active
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/recurringpayments?page=" + page + "&pageSize=" + pageSize;

		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
# Retrieve all recurring payments associated with a recipient, with a default status of active
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/recurringpayments?page=%page%&pageSize=%pageSize%"

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 all recurring payments associated with a recipient, with a default status of active
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/recurringpayments?page={1}&pageSize={2}", organizationKey, 
					page, pageSize);

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

Retrieve all recurring payments associated with a recipient, with the specified status

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?page=0&pageSize=25&status=Paused

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status Paused query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "organizationKey", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 2
	Retrieve all recurring payments associated with a recipient, with the specified status
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$status = $page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/recurringpayments?status=$status&page=$page&pageSize=$pageSize";
$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
 * Retrieve all recurring payments associated with a recipient, with the specified status
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/recurringpayments?status=" + status + "&page=" + page + "&pageSize=" + pageSize;

		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
# Retrieve all recurring payments associated with a recipient, with the specified status
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set status=Paused
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/recurringpayments?status=%status%&page=%page%&pageSize=%pageSize%"

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>
		///	Retrieve all recurring payments associated with a recipient, with the specified status
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var status = "Paused";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/recurringpayments?status={1}&page={2}&pageSize={3}", organizationKey, 
					status, page, pageSize);

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

Retrieve all recurring payments associated with a recipient, with any of the specified statues

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?page=0&pageSize=25&status=Paused&status=Cancelled

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status Paused query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

status Cancelled query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "organizationKey", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/visa.png" }, "ipAddress": "69.30.43.180", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Widgets inc.", "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayment/BQM1lWLcM0uKc1y4a8RHUw/payments" }, "merchantviewrecurringpayment": { "href": "https://pushpay.com/pushpay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringtransaction/BQM1lWLcM0uKc1y4a8RHUw" }, "donorviewrecurringpayment": { "href": "https://pushpay.com/pushpay/pay/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurring/view/BQM1lWLcM0uKc1y4a8RHUw" } } } ], "_links": { "self": null } }
<?php
/*
	Example 3
	Retrieve all recurring payments associated with a recipient, with any of the specified statues
*/
$organizationKey = 'MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M';
$status = $status = $page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/recurringpayments?status=$status&status=$status&page=$page&pageSize=$pageSize";
$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
 * Retrieve all recurring payments associated with a recipient, with any of the specified statues
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/recurringpayments?status=" + status + "&status=" + status + "&page=" + page + "&pageSize=" + pageSize;

		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
# Retrieve all recurring payments associated with a recipient, with any of the specified statues
set oAuthToken=%1
set organizationKey="MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M"
set status=Paused
set status=Cancelled
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/recurringpayments?status=%status%&status=%status%&page=%page%&pageSize=%pageSize%"

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>
		///	Retrieve all recurring payments associated with a recipient, with any of the specified statues
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M";
				var status = "Paused";
				var status = "Cancelled";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/recurringpayments?status={1}&status={2}&page={3}&pageSize={4}", organizationKey, 
					status, status, page, pageSize);

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

Retrieve all recurring payments associated with a recipient, ordered by creation date

Request

GET /v1/organization/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/recurringpayments?orderBy=createdOn ASC&page=0&pageSize=25

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 MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M path
updatedFrom query

Only include payments changed after a date/time (UTC)

updatedTo query

Only include payments changed before a date/time (UTC)

createdFrom query

Only include payments after a date/time (UTC)

createdTo query

Only include payments before a date/time (UTC)

status query

Filter recurring payments by status, acceptable values are any combination of (Active, Cancelled, Paused)

orderBy createdOn 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)

pageSize 25 query

The page size parameter (Note: default page size is 25)

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "organizationKey": "organizationKey", "page": 0, "pageSize": 25, "total": 1, "totalPages": 1, "items": [ { "schedule": { "frequency": "Monthly", "startDate": "2015-06-22T00:00:00-08:00", "endType": "Never", "nextPaymentDate": "2015-07-22T00:00:00Z" }, "status": "Active", "paymentToken": "BQM1lWLcM0uKc1y4a8RHUw", "amount": { "amount": "10.00", "currency": "USD" }, "payer": { "key": "MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0", "emailAddress": "joe.bloggs@test.com", "emailAddressVerified": true, "mobileNumber": "+6421555666", "mobileNumberVerified": true, "fullName": "Joe Bloggs", "firstName": "Joe", "lastName": "Bloggs", "address": { "country": "NZ" }, "updatedOn": "0001-01-01T00:00:00Z", "role": "individual", "payerType": "Registered", "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M/community/MzpMNU9YSTIwSmt4REN5ZWluUlhSbGNvLV9lUk0" } } }, "recipient": { "key": "MTpZc2M4M3hOM05KMmdxOHpDQklvYkxqQWpfY2M", "name": "Widgets inc.", "role": "merchant" }, "fields": [ { "key": "1235", "value": "Smooth processes", "label": "Smoothly Labeled" }, { "key": "1234", "value": "Interesting things", "label": "Interesting Label" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "0001-01-01T00:00:00Z", "paymentMethodType": "CreditCard", "source": "LoggedInWeb", "card": { "reference": "4111-11....1111", "brand": "VISA", "logo": "https://pushpay.com/Content/PushpayWeb/Images/Interface/@2x/PaymentMethods/vis