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
- One payment per due date. Installments due on the same date share it.
- Payments are grouped by card and organization. A later checkout with the same card joins the same payments.
- Each payment adds the organization's convenience fee.
- A payment that runs within about a day is pending. It no longer changes.
- Paying a charge early (Pay Now) makes its payment smaller. Paying all of it removes the payment.
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.
- The payment moves to that card's payments at this organization. It joins a payment already there on the same date,
so its
idcan change. - The answer is the updated list.
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).
- Its charges stay on the account, to be paid another way: Pay Now, or an enabled payment plan, which takes them into its months.
- A pending payment can't be cancelled.
| 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
- Checkout checks for a saved card before anything is charged. The current portal charged the card, then failed and released the payment when the card wasn't a saved one.
- Cancelling is refused where the organization doesn't allow it. The current portal only hid the button.
- Only the family's own payments and cards are accepted. The current portal showed any family's card details for an automatic payment id.
- Payments are grouped by card and organization. The current portal grouped them by card only, so a later checkout at another organization used the first organization's payment account and fee.