You are here:
Recurring Donations Installments API
Write Apex to query information about Recurring Donation Installments using the Installments API.
The Recurring Donations Installments API is intended to meet the needs of customers and partners who require visibility into planned installments beyond the Next Year and Current Year totals provided out of the box. The Installments API provides access to installments calculated by active and paused schedules. Paused installments are omitted from the returned list of installments.
In addition to the Installments API, we provide a Schedules API which returns all Schedules associated with a Recurring Donation, including current, past, and paused schedules.
The Installments API only queries installments calculated by NPSP, not actual Opportunity records, either Open or Closed.
Call Format
-
Global Class implementing the API: Callable_API
-
Global Method: call()
-
Parameters: Map<String, Object>
| Name | Datatype | Required | Description |
|---|---|---|---|
| StartDate | date | Yes | Default is Date.today() |
| EndDate | date | No | Default is one year of installment data. |
| RecordIds | string | Yes | Recurring Donation Ids. |
JSON Response Format
The JSON response format shows Installment information listed by Recurring Donation Id.
| Name | Datatype | Required | Description |
|---|---|---|---|
| scheduleId | string | Yes | The Schedule record this installment relates to. NOTE: The Schedule object is protected. Use the Schedules API to access Schedule object info. |
| recurringDonationId | string | Yes | The Recurring Donation record this installment relates to. |
| paymentMethod | string | No | Payment method for this installment. For example, Check, Credit Card, ACH, etc. |
| installmentAmount | integer | Yes | The amount for this installment, based on the Recurring Donation schedule. |
| currencyCode | string | Yes | The currency ISO code for this installment. For example, USD. |
| closeDate | date | Yes | The close date for this installment. |
| campaignId | string | No | The Campaign record this installment relates to. |
Code Sample and JSON Response
In this example, we want to find the next 90 days of installment information for all active Recurring Donations.
Code Sample
Map <String, Object> callMap = new Map<String, Object>();
Set<Id> Ids = new Map<Id, npe03__Recurring_Donation__c>([SELECT Id FROM npe03__Recurring_Donation__c WHERE npsp__Status__c='Active']).keySet();
callMap.put('StartDate', Date.today());
callMap.put('EndDate', Date.today().addDays(90));
callMap.put('RecordIds', Ids);
npsp.Callable_API apiTest = new npsp.Callable_API();
String jsonResponse = String.valueOf(apiTest.call('rd2.queryinstallments', callMap));
JSON Response
{
"a092D000003Vp8pQAC": [
{
"scheduleId": "a0n2D000001B1mFQAS",
"recurringDonationId": "a092D000003Vp8pQAC",
"paymentMethod": "Check",
"installmentAmount": 100,
"currencyCode": "USD",
"closeDate": "2020-12-04",
"campaignId": null
},
{
"scheduleId": "a0n2D000001B1mFQAS",
"recurringDonationId": "a092D000003Vp8pQAC",
"paymentMethod": "Check",
"installmentAmount": 100,
"currencyCode": "USD",
"closeDate": "2021-01-04",
"campaignId": null
},
{
"scheduleId": "a0n2D000001B1mFQAS",
"recurringDonationId": "a092D000003Vp8pQAC",
"paymentMethod": "Check",
"installmentAmount": 100,
"currencyCode": "USD",
"closeDate": "2021-02-04",
"campaignId": null
},
],
"a092D000003V4ngQAC": [
{
"scheduleId": "a0n2D000001B0AnQAK",
"recurringDonationId": "a092D000003V4ngQAC",
"paymentMethod": "Check",
"installmentAmount": 100,
"currencyCode": "USD",
"closeDate": "2020-12-01",
"campaignId": null
},
{
"scheduleId": "a0n2D000001B0AnQAK",
"recurringDonationId": "a092D000003V4ngQAC",
"paymentMethod": "Check",
"installmentAmount": 100,
"currencyCode": "USD",
"closeDate": "2021-01-01",
"campaignId": null
},
{
"scheduleId": "a0n2D000001B0AnQAK",
"recurringDonationId": "a092D000003V4ngQAC",
"paymentMethod": "Check",
"installmentAmount": 100,
"currencyCode": "USD",
"closeDate": "2021-02-01",
"campaignId": null
}
]
}
