query paymentPlanAuthenticated

Fetches a single payment plan by its id. Returns null when no plan matches.

Returns PaymentPlan

Arguments

ArgumentTypeDescription
idID!

Example request

curl -X POST 'https://graph.clientloop.com/' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{
    "query": "query PaymentPlan($id: ID!) { paymentPlan(id: $id) { id orgId contactId amount currency status frequency startDate occurrences remainingOccurrences nextRunAt paymentPlanSessionId } }",
    "variables": {
      "id": "abc123"
    }
  }'
const response = await fetch('https://graph.clientloop.com/', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer <api-key>',
  },
  body: JSON.stringify({
    query: `
      query PaymentPlan($id: ID!) {
        paymentPlan(id: $id) {
          id
          orgId
          contactId
          amount
          currency
          status
          frequency
          startDate
          occurrences
          remainingOccurrences
          nextRunAt
          paymentPlanSessionId
        }
      }
    `,
    variables: {
      "id": "abc123"
    },
  }),
});

const { data, errors } = await response.json();
<?php

$body = <<<'JSON'
{
  "query": "query PaymentPlan($id: ID!) { paymentPlan(id: $id) { id orgId contactId amount currency status frequency startDate occurrences remainingOccurrences nextRunAt paymentPlanSessionId } }",
  "variables": {
    "id": "abc123"
  }
}
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 PaymentPlan($id: ID!) { paymentPlan(id: $id) { id orgId contactId amount currency status frequency startDate occurrences remainingOccurrences nextRunAt paymentPlanSessionId } }",
  "variables": {
    "id": "abc123"
  }
}
""";

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 PaymentPlan($id: ID!) { paymentPlan(id: $id) { id orgId contactId amount currency status frequency startDate occurrences remainingOccurrences nextRunAt paymentPlanSessionId } }",
  "variables": {
    "id": "abc123"
  }
}
""";

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

type PaymentPlan

FieldTypeDescription
idID!

Unique id of the payment plan (a bare KSUID).

orgIdID!

ID of the organization that this payment plan belongs to

contactIdID!

ID of the platform contact associated with this payment plan

amountAmount!

Payment amount to be charged on the configured frequency.

currencyCurrency!

Currency of the payment

statusPaymentPlanStatus!

Status of the payment plan

frequencyPaymentPlanFrequency

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.

startDateDate!

Start date of the payment plan

occurrencesInt!

Number of payment occurrences to be run on the configured frequency from the start date

remainingOccurrencesInt!

Remaining payments on the plan

nextRunAtDateTime

Next scheduled payment run

paymentPlanSessionIdID

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 PaymentPlanStatus

  • Active
  • Canceled
  • Pending
  • Expired
  • Completed

enum PaymentPlanFrequency

  • Weekly
  • Monthly
  • Quarterly
  • Yearly

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