Trax Platform APIv1

Automatic payments

Some organizations pay later installments automatically. Where they do, what a family leaves for later at checkout (the rest of an activity's fee, a membership charge due later) is charged to a saved card on each installment's due date. The cart says so (automaticPayments: true), and checkout then needs a saved card (Cart and checkout guide).

The server decides everything. The organization turns automatic payments on; an account can be set by staff to opt out. The API works out each payment's date, what it pays and its convenience fee.

How payments are made

The list

The account's automatic payments

GET https://api.nfocus.solutions/v1/portals/riverbend/north/automatic-payments → 200 OK, JSON

curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/automatic-payments' \
  -H 'Authorization: Bearer your_access_token'
JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/automatic-payments', {
  headers: {
    'Authorization': 'Bearer your_access_token',
  },
});
const data = await response.json();
C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.nfocus.solutions/v1/portals/riverbend/north/automatic-payments");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();

GET …/automatic-payments answers:

Field Meaning
offered Whether the organization pays later installments automatically
cancelAllowed Whether the organization lets families cancel an automatic payment online
payments The account's automatic payments, soonest first (fields below)
scheduledCents What the scheduled and pending payments will charge

Each payment has:

Field Meaning
id, date The payment and the day it runs
status scheduled, pending (runs within about a day), failed or cancelled
organization The organization it was made at; its payment account charges the card
amountCents, convenienceFeeCents, totalCents What it pays, the fee, and what the card is charged
card The saved card it uses (id as GET …/payment-methods lists it, name, lastFour, expired)
charges What it pays on each charge: chargeId, description, personName, amountCents
canCancel, canChangeCard What the family may still do with it

Changing the card

PUT …/automatic-payments/{id}/payment-method
Authorization: Bearer {access token}
{ "paymentMethodId": 4022 }

The card must be one of the signed-in person's saved cards and not expired.

Cancelling one

Cancelling where the organization doesn't allow it

DELETE https://api.nfocus.solutions/v1/portals/riverbend/north/automatic-payments/1 → 409, problem details

curl
curl -s -X DELETE 'https://api.nfocus.solutions/v1/portals/riverbend/north/automatic-payments/1' \
  -H 'Authorization: Bearer your_access_token'
JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/automatic-payments/1', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer your_access_token',
  },
});
const data = await response.json();
C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.nfocus.solutions/v1/portals/riverbend/north/automatic-payments/1");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();

DELETE …/automatic-payments/{id} cancels one payment (204), where the organization allows it (cancelAllowed).

Status code What to do
400 invalid-request Choose one of the family's saved cards (paymentMethodId), not expired
404 automatic-payment-not-found No automatic payment with this id is on the account
409 automatic-payment-cancel-off The organization doesn't allow cancelling online; the family contacts it
409 automatic-payment-not-scheduled It already ran, failed or was cancelled
409 automatic-payment-pending It runs within about a day and no longer changes
409 payments-unavailable, saved-cards-unavailable Cards can't be used here (Saved cards guide)
502 payment-unavailable The payment service didn't answer; try again shortly

How the payments are charged

As in the current Trax portal, each payment is charged by the payment service on its date. Staff in Trax see and change the same payments. When the service can't be reached, the change is still saved and the API keeps trying in the background. Nothing for the family to do.

Trax tells its staff when a family cancels an automatic payment; this API doesn't email anyone.

What changed from the current portal