query paymentPlansAuthenticated
Lists payment plans as a Relay-style, cursor-paginated connection.
Page forward by starting with first: N, then passing the previous response's pageInfo.endCursor back as after (repeat while pageInfo.hasNextPage); page backward with last + before. Scope the results with one of orgId / contactId and/or a status filter via PaymentPlansInput. See PaymentPlanConnection for the response shape.
Returns PaymentPlanConnection!
Arguments
| Argument | Type | Description |
|---|---|---|
input | PaymentPlansInput |
Example request
curl -X POST 'https://graph.clientloop.com/' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{
"query": "query PaymentPlans($input: PaymentPlansInput) { paymentPlans(input: $input) { edges { node { id orgId contactId amount currency status frequency startDate occurrences remainingOccurrences nextRunAt paymentPlanSessionId } cursor } pageInfo { hasNextPage hasPreviousPage startCursor endCursor } } }",
"variables": {
"input": {
"first": 42,
"after": "example",
"last": 42,
"before": "example",
"orgId": "abc123",
"contactId": "abc123",
"status": "Active"
}
}
}'const response = await fetch('https://graph.clientloop.com/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api-key>',
},
body: JSON.stringify({
query: `
query PaymentPlans($input: PaymentPlansInput) {
paymentPlans(input: $input) {
edges {
node {
id
orgId
contactId
amount
currency
status
frequency
startDate
occurrences
remainingOccurrences
nextRunAt
paymentPlanSessionId
}
cursor
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
}
}
`,
variables: {
"input": {
"first": 42,
"after": "example",
"last": 42,
"before": "example",
"orgId": "abc123",
"contactId": "abc123",
"status": "Active"
}
},
}),
});
const { data, errors } = await response.json();<?php
$body = <<<'JSON'
{
"query": "query PaymentPlans($input: PaymentPlansInput) { paymentPlans(input: $input) { edges { node { id orgId contactId amount currency status frequency startDate occurrences remainingOccurrences nextRunAt paymentPlanSessionId } cursor } pageInfo { hasNextPage hasPreviousPage startCursor endCursor } } }",
"variables": {
"input": {
"first": 42,
"after": "example",
"last": 42,
"before": "example",
"orgId": "abc123",
"contactId": "abc123",
"status": "Active"
}
}
}
JSON;
$ch = curl_init('https://graph.clientloop.com/');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer <api-key>',
],
CURLOPT_POSTFIELDS => $body,
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
var body = """
{
"query": "query PaymentPlans($input: PaymentPlansInput) { paymentPlans(input: $input) { edges { node { id orgId contactId amount currency status frequency startDate occurrences remainingOccurrences nextRunAt paymentPlanSessionId } cursor } pageInfo { hasNextPage hasPreviousPage startCursor endCursor } } }",
"variables": {
"input": {
"first": 42,
"after": "example",
"last": 42,
"before": "example",
"orgId": "abc123",
"contactId": "abc123",
"status": "Active"
}
}
}
""";
var request = HttpRequest.newBuilder(URI.create("https://graph.clientloop.com/"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <api-key>")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());using System.Net.Http;
using System.Text;
var body = """
{
"query": "query PaymentPlans($input: PaymentPlansInput) { paymentPlans(input: $input) { edges { node { id orgId contactId amount currency status frequency startDate occurrences remainingOccurrences nextRunAt paymentPlanSessionId } cursor } pageInfo { hasNextPage hasPreviousPage startCursor endCursor } } }",
"variables": {
"input": {
"first": 42,
"after": "example",
"last": 42,
"before": "example",
"orgId": "abc123",
"contactId": "abc123",
"status": "Active"
}
}
}
""";
using var client = new HttpClient();
using var content = new StringContent(body, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Authorization", "Bearer <api-key>");
var response = await client.PostAsync("https://graph.clientloop.com/", content);
var result = await response.Content.ReadAsStringAsync();Types
input PaymentPlansInput
Filter and pagination for the paymentPlans connection.
Pagination is Relay cursor-based, not page/offset based — see the Relay Connections spec. Page forward with first + after, or backward with last + before; never mix the two directions in a single call. Cursors are opaque strings taken from a previous response's pageInfo (or edges[].cursor) — treat them as black boxes, don't build or parse them yourself.
Scope the list by supplying at most one of orgId or contactId (omit both to list every plan), and optionally narrow to a single status.
| Field | Type | Description |
|---|---|---|
first | Int | Forward pagination: return at most the first N payment plans from the start of the result window. Pair with after to walk forward. Do not combine with last/before. When omitted (and no last), a default page size is used. |
after | String | Forward pagination cursor: return the plans that come after this cursor. Use the pageInfo.endCursor from the previous page. Pair with first. |
last | Int | Backward pagination: return at most the last N payment plans nearest the end of the result window. Pair with before to walk backward. Do not combine with first/after. |
before | String | Backward pagination cursor: return the plans that come before this cursor. Use the pageInfo.startCursor from the previous page. Pair with last. |
orgId | ID | List payment plans for this org. Mutually exclusive with contactId. |
contactId | ID | List payment plans for this contact. Mutually exclusive with orgId. |
status | PaymentPlanStatus | Only return plans with this status. Omit to include every status. |
type PaymentPlanConnection
A page of payment plans following the Relay Connection spec. edges holds the plans in this page (each with its cursor) and pageInfo describes whether more pages exist in each direction plus the cursors that bound this page.
Typical "load more" loop: read edges[].node for the data, then if pageInfo.hasNextPage is true request the next page with paymentPlans(input: { first: N, after: pageInfo.endCursor, ...same filters }).
| Field | Type | Description |
|---|---|---|
edges | [PaymentPlanEdge!]! | The payment plans in this page. |
pageInfo | PageInfo! | Pagination metadata for this page: hasNextPage/hasPreviousPage and the startCursor/endCursor bounds. |
enum PaymentPlanStatus
ActiveCanceledPendingExpiredCompleted
type PaymentPlanEdge
A single element of a PaymentPlanConnection page: the payment plan itself (node) plus the opaque cursor that points at it. Pass a cursor back as after (forward) or before (backward) to page relative to this row.
| Field | Type | Description |
|---|---|---|
node | PaymentPlan! | The payment plan at this position in the page. |
cursor | String! | Opaque cursor identifying this plan's position, for use as after or before. |
type PageInfo
PageInfo type for cursor-based pagination following the Relay specification for cursor based pagination.
| Field | Type | Description |
|---|---|---|
hasNextPage | Boolean! | |
hasPreviousPage | Boolean! | |
startCursor | String | |
endCursor | String |
type PaymentPlan
| Field | Type | Description |
|---|---|---|
id | ID! | Unique id of the payment plan (a bare KSUID). |
orgId | ID! | ID of the organization that this payment plan belongs to |
contactId | ID! | ID of the platform contact associated with this payment plan |
amount | Amount! | Payment amount to be charged on the configured frequency. |
currency | Currency! | Currency of the payment |
status | PaymentPlanStatus! | Status of the payment plan |
frequency | PaymentPlanFrequency | Frequency of the payment plan. If this is null, the payment plan will not automatically execute and a call to runPaymentPlan is required to generate a payment against the plan. |
startDate | Date! | Start date of the payment plan |
occurrences | Int! | Number of payment occurrences to be run on the configured frequency from the start date |
remainingOccurrences | Int! | Remaining payments on the plan |
nextRunAt | DateTime | Next scheduled payment run |
paymentPlanSessionId | ID | ID of the payment plan session that generated this payment plan |
scalar Amount
A monetary amount with up to two decimal places. Ex. 111.11
scalar Currency
Three letter ISO 4217 currency code. Ex. USD
enum PaymentPlanFrequency
WeeklyMonthlyQuarterlyYearly
scalar Date
ISO 8601 formatted date in the format YYYY-MM-DD
scalar DateTime
ISO 8601 formatted date time. Ex. 2023-11-23T14:30:00Z