Batch
A Batch is a collection of Donations. When creating Donation's via the API, you're required to put them in a Batch.
When a Batch is first created, it's in the in_progress or "uncommitted" state. You can freely add/remove/modify Donations in this Batch and they won't show up in a donor's donation history online, they won't appear in any donor statements issued by the Giving admin, and changes to these donations are not flagged in the system log. Think of it as a staging area for donations.
When a Batch is committed (see more in the Actions section), all of the Donations within it are also marked as "committed". At that point, they're visible to donors in their online history, and any further edits made to those Donations are logged and visible to Giving admins.
With all of that in mind, you can use Batches in one of two ways:
- Create an uncommitted
Batch, add Donations to it, then commit the Batch.
- Create a
Batch with a least one donation, commit it, then add more Donations to it.
In both cases, the end result is the same. The main difference is that option #2 does not provide you/other admins the opportunity to fix any mistakes before changes are logged and Donations are made visible to donors. Any Donations added to a committed Batch will automatically be committed as well. Note, batches can't be committed until they have at least one donation.
Whichever route you decide to take, it's helpful to make use of the Batch's description to help differentiate these groupings from each other and from other Batches that the Giving admins might be creating on their own.
Example Object
{
"type": "Batch",
"id": "1",
"attributes": {
"committed_at": "2000-01-01T12:00:00Z",
"created_at": "2000-01-01T12:00:00Z",
"description": "string",
"donations_count": 1,
"status": "string",
"total_cents": 1,
"total_currency": "string",
"updated_at": "2000-01-01T12:00:00Z"
},
"relationships": {
"batch_group": {
"data": {
"type": "BatchGroup",
"id": "1"
}
}
}
}
Attributes
| Name |
Type |
Description |
committed_at |
date_time |
The date and time that a batch was committed at. If it's `null`, the batch is still in progress or updating. Example: `2000-01-01T12:00:00Z` |
created_at |
date_time |
The date and time at which a batch was created. Example: `2000-01-01T12:00:00Z` |
description |
string |
A brief description of what a batch is for. This is displayed in Giving to help differentiate different batches from one another. If no description is provided for a batch, it will be referred to as `Untitled batch` within Giving. |
donations_count |
integer |
Only available when requested with the `?fields` param |
id |
primary_key |
The unique identifier for a batch. For batches and batch groups, these identifiers are unique not across all of Planning Center, but only per organization. As such, it is possible to see the same batch `id` in multiple organizations. |
status |
string |
One of `in_progress`, `updating`, or `committed`. The `updating` state is temporary and describes a Batch that is currently being changed in some way (e.g. moving from `in_progress` to `committed`). Certain changes to Batches in this state (or their Donations) will be restricted until the Batch has finished updating. |
total_cents |
integer |
The gross total of cents donated within the batch. |
total_currency |
string |
The currency used to calculate `total_cents`. |
updated_at |
date_time |
The date and time at which a batch was last updated. Example: `2000-01-01T12:00:00Z` |
Relationships
| Name |
Type |
Association Type |
Note |
| batch_group |
BatchGroup |
to_one |
|
Can Include
| Parameter |
Value |
Description |
Assignable |
| include |
batch_group |
include associated batch_group |
create and update |
| include |
owner |
include associated owner |
|
Order By
| Parameter |
Value |
Type |
Description |
| order |
updated_at |
string |
prefix with a hyphen (-updated_at) to reverse the order |
Query By
| Name |
Parameter |
Type |
Description |
Example |
| updated_at |
where[updated_at] |
date_time |
Query on a specific updated_at |
?where[updated_at]=2000-01-01T12:00:00Z |
Pagination
| Name |
Parameter |
Type |
Description |
| per_page |
per_page |
integer |
how many records to return per page (min=1, max=100, default=25) |
| offset |
offset |
integer |
get results from given offset |
Endpoints
Listing
| HTTP Method |
Endpoint |
| GET |
/giving/v2/batches |
Reading
| HTTP Method |
Endpoint |
| GET |
/giving/v2/batches/{id} |
Creating
| HTTP Method |
Endpoint |
Assignable Attributes |
| POST |
/giving/v2/batches |
|
Updating
| HTTP Method |
Endpoint |
Assignable Attributes |
| PATCH |
/giving/v2/batches/{id} |
|
Deleting
| HTTP Method |
Endpoint |
| DELETE |
/giving/v2/batches/{id} |
Actions
| HTTP Method |
Endpoint |
Description |
| POST |
https://api.planningcenteronline.com/giving/v2/batches/{batch_id}/commit |
Used to commit an in progress batch. |
Associations
| HTTP Method |
Endpoint |
Returns |
Details |
Filter By |
| GET |
https://api.planningcenteronline.com/giving/v2/batches/{batch_id}/batch_group |
BatchGroup
|
|
|
| GET |
https://api.planningcenteronline.com/giving/v2/batches/{batch_id}/donations |
Donation
|
|
|
| GET |
https://api.planningcenteronline.com/giving/v2/batches/{batch_id}/owner |
Person
|
|
|
Belongs To
| HTTP Method |
Endpoint |
Association |
Details |
Filter By |
| GET |
https://api.planningcenteronline.com/giving/v2/batch_groups/{batch_group_id}/batches |
BatchGroup
|
|
|
| GET |
https://api.planningcenteronline.com/giving/v2/batches |
Organization
|
|
|
| GET |
https://api.planningcenteronline.com/giving/v2/people/{person_id}/batches |
Person
|
|
|