Batches API

The API for viewing & querying batch information for an organization


Get a Specific Batch

GET /v1/merchant/{merchantKey}/batch/{batchKey}

Retrieve a single in scope batch by its key

Path (URL) Parameters

Name Type Description
merchantKey string

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

batchKey string

The unique key of the batch - 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 batch by its key

Request

GET /v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE

Headers

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

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw path

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

batchKey MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE path

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

{ "id": "0", "key": "MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE", "name": "Batch #0", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 0, "totalAmount": { "amount": "0.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 0, "totalCheckAmount": { "amount": "0.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE/payments" } } }
<?php
/*
	Example 1
	Retrieve a single batch by its key
*/
$merchantKey = 'MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw';
$batchKey = 'MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/batch/$batchKey";
$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 batch by its key
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 batch by its key
set oAuthToken=%1
set merchantKey="MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw"
set batchKey="MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/batch/%batchKey%"

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 batch by its key
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
				var batchKey = "MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE";
				var requestUrl = string.Format("/v1/merchant/{0}/batch/{1}", merchantKey, batchKey);

				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 batch

Request

GET /v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE

Headers

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

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw path

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

batchKey MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE path

The unique key of the batch - 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": "Unknown batch" }
<?php
/*
	Example 2
	Retrieve a non-existent batch
*/
$merchantKey = 'MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw';
$batchKey = 'MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE';
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/batch/$batchKey";
$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 batch
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

		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 batch
set oAuthToken=%1
set merchantKey="MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw"
set batchKey="MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE"
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/batch/%batchKey%"

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 batch
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
				var batchKey = "MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE";
				var requestUrl = string.Format("/v1/merchant/{0}/batch/{1}", merchantKey, batchKey);

				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 Specific Batch's Payments

GET /v1/merchant/{merchantKey}/batch/{batchKey}/payments

Retrieve the set of in scope payments related to the specified batch

Path (URL) Parameters

Name Type Description
merchantKey string

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

batchKey string

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

Query string (URL) parameters

Name Type Description
page integer

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 the payments associated with a batch, only the page parameter is supported

Request

GET /v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE/payments?page=0

Headers

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

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw path

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

batchKey MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE path

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

page 0 query

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "page": 0, "pageSize": 25, "total": 10, "totalPages": 1, "items": [ { "status": "Success", "transactionId": "69", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "0.00", "currency": "USD", "details": { "base": "0.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } }, { "status": "Success", "transactionId": "70", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "10.00", "currency": "USD", "details": { "base": "10.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } }, { "status": "Success", "transactionId": "71", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "20.00", "currency": "USD", "details": { "base": "20.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } }, { "status": "Success", "transactionId": "72", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "30.00", "currency": "USD", "details": { "base": "30.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } }, { "status": "Success", "transactionId": "73", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "40.00", "currency": "USD", "details": { "base": "40.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } }, { "status": "Success", "transactionId": "74", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "50.00", "currency": "USD", "details": { "base": "50.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } }, { "status": "Success", "transactionId": "75", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "60.00", "currency": "USD", "details": { "base": "60.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } }, { "status": "Success", "transactionId": "76", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "70.00", "currency": "USD", "details": { "base": "70.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } }, { "status": "Success", "transactionId": "77", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "80.00", "currency": "USD", "details": { "base": "80.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } }, { "status": "Success", "transactionId": "78", "batch": { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "type": "CheckDeposit", "createdOn": "0001-01-01T00:00:00Z" }, "paymentToken": "78pRR7S74ke84A5pQdDizQ", "amount": { "amount": "90.00", "currency": "USD", "details": { "base": "90.00" } }, "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/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/community/MDoxWWpVN2dpTjNzeDdfMTdCcXk1bnZjOUJ5Qzg" } } }, "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "fields": [ { "key": "0", "value": "My Memo", "label": "Memo Field" } ], "createdOn": "0001-01-01T00:00:00Z", "updatedOn": "2014-08-21T10:46:00Z", "paymentMethodType": "DepositedCheck", "source": "CheckDeposit", "fund": { "key": "zzzzAA234zbZ8fgfLcM0uKc1y4a8RHUw", "name": "Tithes & Offerings", "code": "100", "taxDeductible": true }, "campus": { "name": "Your Merchant", "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payment/78pRR7S74ke84A5pQdDizQ" }, "merchant": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw" }, "batch": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "payments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/payments" }, "merchantviewpayment": { "href": "https://pushpay.com/pushpay/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/transaction/78pRR7S74ke84A5pQdDizQ" }, "donorviewpayment": { "href": "https://pushpay.com/pushpay/transaction/78pRR7S74ke84A5pQdDizQ" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant//batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE/payments" } } }
<?php
/*
	Example 1
	Retrieve the payments associated with a batch, only the page parameter is supported
*/
$merchantKey = 'MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw';
$batchKey = 'MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE';
$page = 0;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/batch/$batchKey/payments?page=$page";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
// If there is a next page, store the link to it in a variable
if (array_key_exists('next', $jsonResponse['_links'])) {
	$nextLink = $jsonResponse['_links']['next']['href'];
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 1
 * Retrieve the payments associated with a batch, only the page parameter is supported
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

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

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

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

	class Link {
		public URL href;
	}

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

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		return httpConnection;
	}
}
# Example 1
# Retrieve the payments associated with a batch, only the page parameter is supported
set oAuthToken=%1
set merchantKey="MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw"
set batchKey="MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE"
set page=0
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/batch/%batchKey%/payments?page=%page%"

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

namespace Examples
{
	public class Example1
	{

		/// <summary>
		///	Example 1
		/// </summary>
		/// <remarks>
		///	Retrieve the payments associated with a batch, only the page parameter is supported
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
				var batchKey = "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE";
				var page = 0;
				var requestUrl = string.Format("/v1/merchant/{0}/batch/{1}/payments?page={2}", merchantKey, batchKey, 
					page);

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

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

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

	public class Links
	{
		public Link Self { get; set; }
		public Link Next { get; set; }
		public Link Prev { get; set; }
		public Link First { get; set; }
		public Link Last { get; set; }
	}

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

Retrieve a non-existent batch

Request

GET /v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE/payments?page=0

Headers

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

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw path

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

batchKey MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE path

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

page 0 query

Response

Status 200 (OK)

Headers

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

Code Samples

Response

{ "message": "Unknown batch" }
<?php
/*
	Example 2
	Retrieve a non-existent batch
*/
$merchantKey = 'MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw';
$batchKey = 'MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE';
$page = 0;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/batch/$batchKey/payments?page=$page";
$oAuthToken = "OAuth TOKEN GOES HERE";

$curl = curl_init($url);
$curlHeaderData = [
	"Accept: application/hal+json",
	"Authorization: Bearer $oAuthToken"
];
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaderData);
$jsonResponse = json_decode(curl_exec($curl), true);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpCode >= 400) {
    $message = "$httpCode Error";
    if ($jsonResponse['message']) {
        $message = "$message: " . $jsonResponse['message'];
    }
    throw new Exception($message);
}
// If there is a next page, store the link to it in a variable
if (array_key_exists('next', $jsonResponse['_links'])) {
	$nextLink = $jsonResponse['_links']['next']['href'];
}
curl_close($curl);
import com.google.gson.Gson;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

/**
 * Example 2
 * Retrieve a non-existent batch
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

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

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

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

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

	class Link {
		public URL href;
	}

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

	private static HttpURLConnection setUpHttpConnection(URL url) throws IOException {
		String oAuthToken="TOKEN";
		HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
		httpConnection.setRequestProperty("Accept", "application/hal+json");
		httpConnection.setRequestProperty("Authorization", "Bearer " + oAuthToken);
		return httpConnection;
	}
}
# Example 2
# Retrieve a non-existent batch
set oAuthToken=%1
set merchantKey="MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw"
set batchKey="MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE"
set page=0
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/batch/%batchKey%/payments?page=%page%"

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

namespace Examples
{
	public class Example2
	{

		/// <summary>
		///	Example 2
		/// </summary>
		/// <remarks>
		///	Retrieve a non-existent batch
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
				var batchKey = "MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE";
				var page = 0;
				var requestUrl = string.Format("/v1/merchant/{0}/batch/{1}/payments?page={2}", merchantKey, batchKey, 
					page);

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

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

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

	public class Links
	{
		public Link Self { get; set; }
		public Link Next { get; set; }
		public Link Prev { get; set; }
		public Link First { get; set; }
		public Link Last { get; set; }
	}

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

Get a Merchant's Batches

GET /v1/merchant/{merchantKey}/batches

Retrieves all batches that belong to the in scope merchant & which pass the specified filters

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

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'. Valid columns are 'name', 'createdOn', 'transactions', and 'amount'

name string

Only include batches which contain the following substring, wildcharacters implicitly prepended and appended

type string

Only include batches which are of the specified type (BatchEntry or CheckDeposit)

status string

Only include batches which have the specified status (Open, Validating, ReadyToAllocate, Completed or Rejected)

from string

Only include batches which have been created after the specified date (UTC)

to string

Only include batches which have been created before the specified date (UTC)

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
read Read-only access to resources owned by the subject claim of the token

Retrieve a set of all batches for a merchant

Request

GET /v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batches?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 MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw path

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

orderBy query

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'. Valid columns are 'name', 'createdOn', 'transactions', and 'amount'

name query

Only include batches which contain the following substring, wildcharacters implicitly prepended and appended

type query

Only include batches which are of the specified type (BatchEntry or CheckDeposit)

status query

Only include batches which have the specified status (Open, Validating, ReadyToAllocate, Completed or Rejected)

from query

Only include batches which have been created after the specified date (UTC)

to query

Only include batches which have been created before the specified date (UTC)

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": 10, "totalPages": 1, "items": [ { "id": "0", "key": "MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE", "name": "Batch #0", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 0, "totalAmount": { "amount": "0.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 0, "totalCheckAmount": { "amount": "0.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE/payments" } } }, { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 10, "totalAmount": { "amount": "550.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 10, "totalCheckAmount": { "amount": "100.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE/payments" } } }, { "id": "2000", "key": "MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA", "name": "Batch #2", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 20, "totalAmount": { "amount": "1100.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 20, "totalCheckAmount": { "amount": "200.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA/payments" } } }, { "id": "3000", "key": "MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U", "name": "Batch #3", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 30, "totalAmount": { "amount": "1650.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 30, "totalCheckAmount": { "amount": "300.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U/payments" } } }, { "id": "4000", "key": "NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU", "name": "Batch #4", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 40, "totalAmount": { "amount": "2200.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 40, "totalCheckAmount": { "amount": "400.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU/payments" } } }, { "id": "5000", "key": "NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc", "name": "Batch #5", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 50, "totalAmount": { "amount": "2750.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 50, "totalCheckAmount": { "amount": "500.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc/payments" } } }, { "id": "6000", "key": "NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk", "name": "Batch #6", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 60, "totalAmount": { "amount": "3300.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 60, "totalCheckAmount": { "amount": "600.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk/payments" } } }, { "id": "7000", "key": "NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk", "name": "Batch #7", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 70, "totalAmount": { "amount": "3850.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 70, "totalCheckAmount": { "amount": "700.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk/payments" } } }, { "id": "8000", "key": "ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA", "name": "Batch #8", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 80, "totalAmount": { "amount": "4400.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 80, "totalCheckAmount": { "amount": "800.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA/payments" } } }, { "id": "9000", "key": "OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc", "name": "Batch #9", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 90, "totalAmount": { "amount": "4950.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 90, "totalCheckAmount": { "amount": "900.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc/payments" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batches" } } }
<?php
/*
	Example 1
	Retrieve a set of all batches for a merchant
*/
$merchantKey = 'MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/batches?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 a set of all batches 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 = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/batches?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 a set of all batches for a merchant
set oAuthToken=%1
set merchantKey="MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/batches?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 a set of all batches for a merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/batches?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 a set of all batches which match the specified filters and belong to the specified merchant

Request

GET /v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batches?name=batchName&orderBy=transactions ASC&page=0&pageSize=25&type=BatchEntry

Headers

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

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
merchantKey MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw path

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

orderBy transactions ASC query

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'. Valid columns are 'name', 'createdOn', 'transactions', and 'amount'

name batchName query

Only include batches which contain the following substring, wildcharacters implicitly prepended and appended

type BatchEntry query

Only include batches which are of the specified type (BatchEntry or CheckDeposit)

status query

Only include batches which have the specified status (Open, Validating, ReadyToAllocate, Completed or Rejected)

from query

Only include batches which have been created after the specified date (UTC)

to query

Only include batches which have been created before the specified date (UTC)

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": 10, "totalPages": 1, "items": [ { "id": "0", "key": "MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 0, "totalAmount": { "amount": "0.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 0, "totalCheckAmount": { "amount": "0.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE/payments" } } }, { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 10, "totalAmount": { "amount": "550.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 10, "totalCheckAmount": { "amount": "100.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE/payments" } } }, { "id": "2000", "key": "MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 20, "totalAmount": { "amount": "1100.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 20, "totalCheckAmount": { "amount": "200.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA/payments" } } }, { "id": "3000", "key": "MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 30, "totalAmount": { "amount": "1650.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 30, "totalCheckAmount": { "amount": "300.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U/payments" } } }, { "id": "4000", "key": "NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 40, "totalAmount": { "amount": "2200.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 40, "totalCheckAmount": { "amount": "400.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU/payments" } } }, { "id": "5000", "key": "NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 50, "totalAmount": { "amount": "2750.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 50, "totalCheckAmount": { "amount": "500.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc/payments" } } }, { "id": "6000", "key": "NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 60, "totalAmount": { "amount": "3300.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 60, "totalCheckAmount": { "amount": "600.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk/payments" } } }, { "id": "7000", "key": "NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 70, "totalAmount": { "amount": "3850.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 70, "totalCheckAmount": { "amount": "700.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk/payments" } } }, { "id": "8000", "key": "ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 80, "totalAmount": { "amount": "4400.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 80, "totalCheckAmount": { "amount": "800.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA/payments" } } }, { "id": "9000", "key": "OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 90, "totalAmount": { "amount": "4950.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 90, "totalCheckAmount": { "amount": "900.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc/payments" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batches" } } }
<?php
/*
	Example 2
	Retrieve a set of all batches which match the specified filters and belong to the specified merchant
*/
$merchantKey = 'MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw';
$orderBy = 'transactions ASC';
$name = 'batchName';
$type = 'BatchEntry';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/batches?orderBy=$orderBy&name=$name&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 2
 * Retrieve a set of all batches which match the specified filters and 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 = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
		String orderBy = "transactions ASC";
		String name = "batchName";
		String type = "BatchEntry";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/batches?orderBy=" + orderBy + "&name=" + name + "&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 2
# Retrieve a set of all batches which match the specified filters and belong to the specified merchant
set oAuthToken=%1
set merchantKey="MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw"
set orderBy="transactions ASC"
set name="batchName"
set type="BatchEntry"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/batches?orderBy=%orderBy%&name=%name%&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 Example2
	{

		/// <summary>
		///	Example 2
		/// </summary>
		/// <remarks>
		///	Retrieve a set of all batches which match the specified filters and belong to the specified merchant
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
				var orderBy = "transactions ASC";
				var name = "batchName";
				var type = "BatchEntry";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/batches?orderBy={1}&name={2}&type={3}&page={4}&pageSize={5}", merchantKey, 
					orderBy, name, 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; }
	}
}

Attempting to retrieve batches with an invalid order by column will fail

Request

GET /v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batches?orderBy=batchDate 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 MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw path

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

orderBy batchDate DESC query

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'. Valid columns are 'name', 'createdOn', 'transactions', and 'amount'

name query

Only include batches which contain the following substring, wildcharacters implicitly prepended and appended

type query

Only include batches which are of the specified type (BatchEntry or CheckDeposit)

status query

Only include batches which have the specified status (Open, Validating, ReadyToAllocate, Completed or Rejected)

from query

Only include batches which have been created after the specified date (UTC)

to query

Only include batches which have been created before the specified date (UTC)

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

{ "message": "could not parse orderBy clause, the correct format is 'propertyName (ASC|DESC)'" }
<?php
/*
	Example 3
	Attempting to retrieve batches with an invalid order by column will fail
*/
$merchantKey = 'MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw';
$orderBy = 'batchDate DESC';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/merchant/$merchantKey/batches?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 3
 * Attempting to retrieve batches with an invalid order by column will fail
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
		String orderBy = "batchDate DESC";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/merchant/" + merchantKey + "/batches?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 3
# Attempting to retrieve batches with an invalid order by column will fail
set oAuthToken=%1
set merchantKey="MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw"
set orderBy="batchDate DESC"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/merchant/%merchantKey%/batches?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 Example3
	{

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	Attempting to retrieve batches with an invalid order by column will fail
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var merchantKey = "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw";
				var orderBy = "batchDate DESC";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/merchant/{0}/batches?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; }
	}
}

Get an Organization's Batches

GET /v1/organization/{organizationKey}/batches

Retrieves all batches that belong to the in scope organization & which pass the specified filters

Path (URL) Parameters

Name Type Description
organizationKey string

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

Query string (URL) parameters

Name Type Description
orderBy string

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'. Valid columns are 'name', 'createdOn', 'transactions', and 'amount'

name string

Only include batches which contain the following substring, wildcharacters implicitly prepended and appended

type string

Only include batches which are of the specified type (BatchEntry or CheckDeposit)

status string

Only include batches which have the specified status (Open, Validating, ReadyToAllocate, Completed or Rejected)

from string

Only include batches which have been created after the specified date (UTC)

to string

Only include batches which have been created before the specified date (UTC)

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
read Read-only access to resources owned by the subject claim of the token

Retrieve a set of all batches for an organization

Request

GET /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/batches?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 MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

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

orderBy query

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'. Valid columns are 'name', 'createdOn', 'transactions', and 'amount'

name query

Only include batches which contain the following substring, wildcharacters implicitly prepended and appended

type query

Only include batches which are of the specified type (BatchEntry or CheckDeposit)

status query

Only include batches which have the specified status (Open, Validating, ReadyToAllocate, Completed or Rejected)

from query

Only include batches which have been created after the specified date (UTC)

to query

Only include batches which have been created before the specified date (UTC)

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": 10, "totalPages": 1, "items": [ { "id": "0", "key": "MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE", "name": "Batch #0", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 0, "totalAmount": { "amount": "0.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 0, "totalCheckAmount": { "amount": "0.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE/payments" } } }, { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "Batch #1", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 10, "totalAmount": { "amount": "550.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 10, "totalCheckAmount": { "amount": "100.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE/payments" } } }, { "id": "2000", "key": "MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA", "name": "Batch #2", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 20, "totalAmount": { "amount": "1100.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 20, "totalCheckAmount": { "amount": "200.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA/payments" } } }, { "id": "3000", "key": "MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U", "name": "Batch #3", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 30, "totalAmount": { "amount": "1650.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 30, "totalCheckAmount": { "amount": "300.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U/payments" } } }, { "id": "4000", "key": "NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU", "name": "Batch #4", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 40, "totalAmount": { "amount": "2200.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 40, "totalCheckAmount": { "amount": "400.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU/payments" } } }, { "id": "5000", "key": "NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc", "name": "Batch #5", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 50, "totalAmount": { "amount": "2750.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 50, "totalCheckAmount": { "amount": "500.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc/payments" } } }, { "id": "6000", "key": "NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk", "name": "Batch #6", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 60, "totalAmount": { "amount": "3300.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 60, "totalCheckAmount": { "amount": "600.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk/payments" } } }, { "id": "7000", "key": "NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk", "name": "Batch #7", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 70, "totalAmount": { "amount": "3850.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 70, "totalCheckAmount": { "amount": "700.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk/payments" } } }, { "id": "8000", "key": "ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA", "name": "Batch #8", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 80, "totalAmount": { "amount": "4400.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 80, "totalCheckAmount": { "amount": "800.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA/payments" } } }, { "id": "9000", "key": "OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc", "name": "Batch #9", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "CheckDeposit", "status": "Completed", "totalPayments": 90, "totalAmount": { "amount": "4950.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 90, "totalCheckAmount": { "amount": "900.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc/payments" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/batches" } } }
<?php
/*
	Example 1
	Retrieve a set of all batches for an organization
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/batches?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 a set of all batches for an organization
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/batches?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 a set of all batches for an organization
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/batches?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 a set of all batches for an organization
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/batches?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 a set of all batches which match the specified filters and belong to the specified organization

Request

GET /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/batches?name=batchName&orderBy=amount ASC&page=0&pageSize=25&type=BatchEntry

Headers

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

The bearer token being used to authenticate this request

Parameters

Name Value Type Description
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

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

orderBy amount ASC query

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'. Valid columns are 'name', 'createdOn', 'transactions', and 'amount'

name batchName query

Only include batches which contain the following substring, wildcharacters implicitly prepended and appended

type BatchEntry query

Only include batches which are of the specified type (BatchEntry or CheckDeposit)

status query

Only include batches which have the specified status (Open, Validating, ReadyToAllocate, Completed or Rejected)

from query

Only include batches which have been created after the specified date (UTC)

to query

Only include batches which have been created before the specified date (UTC)

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": 10, "totalPages": 1, "items": [ { "id": "0", "key": "MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 0, "totalAmount": { "amount": "0.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 0, "totalCheckAmount": { "amount": "0.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MDp6cmEwMzVOUlV3YmcyUlJhY2RaT1J0VW5hUVE/payments" } } }, { "id": "1000", "key": "MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 10, "totalAmount": { "amount": "550.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 10, "totalCheckAmount": { "amount": "100.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MTAwMDpxckZuTWZZNWMwZWIxRlJWblkzRHh6RzlaWlE/payments" } } }, { "id": "2000", "key": "MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 20, "totalAmount": { "amount": "1100.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 20, "totalCheckAmount": { "amount": "200.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MjAwMDo0bkZnaHN3Yksxd2E3SDJUT1NDNWd4NlZKbTA/payments" } } }, { "id": "3000", "key": "MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 30, "totalAmount": { "amount": "1650.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 30, "totalCheckAmount": { "amount": "300.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/MzAwMDpuemp4aFZzZHNaeUJpQkM3TTFVZTJ6ZzNkV0U/payments" } } }, { "id": "4000", "key": "NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 40, "totalAmount": { "amount": "2200.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 40, "totalCheckAmount": { "amount": "400.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NDAwMDpLSWlmeURMTEFUQVZZcXpPamUzMWphdXpMLVU/payments" } } }, { "id": "5000", "key": "NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 50, "totalAmount": { "amount": "2750.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 50, "totalCheckAmount": { "amount": "500.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NTAwMDpqaHA5UFFIa0k4M2JQMDBJTlg5RkRDbk96OWc/payments" } } }, { "id": "6000", "key": "NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 60, "totalAmount": { "amount": "3300.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 60, "totalCheckAmount": { "amount": "600.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NjAwMDpDTlRhaTR3UzVkVW1UQmU2M0g1WmlJZF9rTVk/payments" } } }, { "id": "7000", "key": "NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 70, "totalAmount": { "amount": "3850.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 70, "totalCheckAmount": { "amount": "700.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/NzAwMDo2NlVVM0tOcE8ycGpGckdyLUdPaTFDejFNOUk/payments" } } }, { "id": "8000", "key": "ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 80, "totalAmount": { "amount": "4400.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 80, "totalCheckAmount": { "amount": "800.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/ODAwMDpaSEtkY1g4VVh5T21UMEl2VnJ0blZGN2xzTTA/payments" } } }, { "id": "9000", "key": "OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc", "name": "batchName", "createdOn": "0001-01-01T00:00:00Z", "createdBy": "Merchant admin", "recipient": { "key": "MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw", "name": "Your Merchant", "role": "merchant" }, "type": "BatchEntry", "status": "Completed", "totalPayments": 90, "totalAmount": { "amount": "4950.00", "currency": "NZD" }, "totalAchPayments": 0, "totalAchAmount": { "amount": "0.00", "currency": "NZD" }, "totalCardPayments": 0, "totalCardAmount": { "amount": "0.00", "currency": "NZD" }, "totalCashPayments": 0, "totalCashAmount": { "amount": "0.00", "currency": "NZD" }, "totalCheckPayments": 90, "totalCheckAmount": { "amount": "900.00", "currency": "NZD" }, "_links": { "self": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc" }, "batchPayments": { "href": "https://api.pushpay.com/v1/merchant/MTAxOklkUDVaV0tXNDI4UDRid2FOa0UwOV9ISzRjcw/batch/OTAwMDpfREJOVm9Hci1YbWdmVnBBLUptZ3hpVDM3QWc/payments" } } } ], "_links": { "self": { "href": "https://api.pushpay.com/v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/batches" } } }
<?php
/*
	Example 2
	Retrieve a set of all batches which match the specified filters and belong to the specified organization
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$orderBy = 'amount ASC';
$name = 'batchName';
$type = 'BatchEntry';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/batches?orderBy=$orderBy&name=$name&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 2
 * Retrieve a set of all batches which match the specified filters and belong to the specified organization
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String orderBy = "amount ASC";
		String name = "batchName";
		String type = "BatchEntry";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/batches?orderBy=" + orderBy + "&name=" + name + "&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 2
# Retrieve a set of all batches which match the specified filters and belong to the specified organization
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set orderBy="amount ASC"
set name="batchName"
set type="BatchEntry"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/batches?orderBy=%orderBy%&name=%name%&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 Example2
	{

		/// <summary>
		///	Example 2
		/// </summary>
		/// <remarks>
		///	Retrieve a set of all batches which match the specified filters and belong to the specified organization
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var orderBy = "amount ASC";
				var name = "batchName";
				var type = "BatchEntry";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/batches?orderBy={1}&name={2}&type={3}&page={4}&pageSize={5}", organizationKey, 
					orderBy, name, 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; }
	}
}

Attempting to retrieve batches with an invalid order by column will fail

Request

GET /v1/organization/MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA/batches?orderBy=batchDate 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
organizationKey MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA path

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

orderBy batchDate DESC query

Order data by a particular property in ascending or descending order. Uses format 'PropertyName ASC' or 'PropertyName DESC'. Valid columns are 'name', 'createdOn', 'transactions', and 'amount'

name query

Only include batches which contain the following substring, wildcharacters implicitly prepended and appended

type query

Only include batches which are of the specified type (BatchEntry or CheckDeposit)

status query

Only include batches which have the specified status (Open, Validating, ReadyToAllocate, Completed or Rejected)

from query

Only include batches which have been created after the specified date (UTC)

to query

Only include batches which have been created before the specified date (UTC)

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

{ "message": "could not parse orderBy clause, the correct format is 'propertyName (ASC|DESC)'" }
<?php
/*
	Example 3
	Attempting to retrieve batches with an invalid order by column will fail
*/
$organizationKey = 'MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA';
$orderBy = 'batchDate DESC';
$page = 0;
$pageSize = 25;
$url = "https://api.pushpay.com/v1/organization/$organizationKey/batches?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 3
 * Attempting to retrieve batches with an invalid order by column will fail
 *
 * This example uses the Gson library to parse JSON
 */

public class Example {

	public static void main(String[] args) throws IOException {
		String organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
		String orderBy = "batchDate DESC";
		int page = 0;
		int pageSize = 25;
		String urlString = "https://api.pushpay.com/v1/organization/" + organizationKey + "/batches?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 3
# Attempting to retrieve batches with an invalid order by column will fail
set oAuthToken=%1
set organizationKey="MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA"
set orderBy="batchDate DESC"
set page=0
set pageSize=25
set url="https://api.pushpay.com/v1/organization/%organizationKey%/batches?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 Example3
	{

		/// <summary>
		///	Example 3
		/// </summary>
		/// <remarks>
		///	Attempting to retrieve batches with an invalid order by column will fail
		/// </remarks>
		public async Task<Response> Example(string oAuthToken)
		{
			using (var client = new HttpClient()) {
				var organizationKey = "MTIzOi1Yb1ByLWxtakFoMVdEaUlrWFpIdnhfODd0NA";
				var orderBy = "batchDate DESC";
				var page = 0;
				var pageSize = 25;
				var requestUrl = string.Format("/v1/organization/{0}/batches?orderBy={1}&page={2}&pageSize={3}", organizationKey, 
					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; }
	}
}