Cart and checkout
A signed-in family builds a cart on the server, then checks out once: registrations, charges and today's card payment happen together, or not at all. Most calls here need the family's access token. The cart belongs to the sign-in at one portal, so a family that opens the site on another device sees the same cart. A visitor who hasn't signed in yet can start a guest cart, which joins the family's cart at sign-in (below).
The server prices everything. A cart stores what the family chose (who, which activity, which charge, how much to pay today) and nothing else. Every read prices it again from the organization's data: fees, installments, program discounts, minimums, seats, eligibility and the convenience fee. Never send a price, a fee or a discount; the API ignores them.
A cart read can show the catalog (fees, seats left, activity waivers) as it was up to 30 seconds ago. Checkout always
uses current data and counts the seats again, so nobody is charged an old price: if anything changed, checkout answers
409 with the cart as it is now (see "Checkout").
Before signing in: the guest cart
A visitor can pick programs before they have an account or have signed in. Start a guest cart once, keep its token, and send the token back with each guest cart call:
Start a guest cart before signing in
POST https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart → 201, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart', {
method: 'POST',
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();The answer (201) holds token, expiresUtc and the empty cart. The token is shown only once.
- Where to keep it: in the browser's storage, as you keep your other tokens.
- How to send it: in the
X-Trax-Guest-Cartheader. Never put it in a URL. - Where it works: only at the portal that created it, until the cart expires.
A guest cart lasts 30 days after its last change unless the organization sets another length (cart.guestCartDays
in GET …/config).
Add a program to the guest cart (no attendee yet)
POST https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart/items → 200 OK, JSON
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart/items' \
-H 'X-Trax-Guest-Cart: gc_your_guest_cart_token' \
-H 'Content-Type: application/json' \
-d '{"kind": "activity", "activityId": 3 }'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart/items', {
method: 'POST',
headers: {
'X-Trax-Guest-Cart': 'gc_your_guest_cart_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"kind": "activity", "activityId": 3 }),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart/items");
request.Headers.Add("X-Trax-Guest-Cart", "gc_your_guest_cart_token");
request.Content = new StringContent("""
{"kind": "activity", "activityId": 3 }
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();POST …/guest-cart/items takes three kinds of line, none with a personId:
activity: a standalone activity, a group session or a hierarchy level (parent first);membership: bought on its own, so noactivityId;donation: withamountCents.
Paying toward an account's charges needs an account, so a charge line is a 400. DELETE …/guest-cart/items/{id}
removes a line.
The guest cart, priced now
GET https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart → 200 OK, JSON
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart' \
-H 'X-Trax-Guest-Cart: gc_your_guest_cart_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart', {
headers: {
'X-Trax-Guest-Cart': 'gc_your_guest_cart_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/guest-cart");
request.Headers.Add("X-Trax-Guest-Cart", "gc_your_guest_cart_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();Removing a guest cart line that isn't there
DELETE https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart/items/00000000-0000-0000-0000-000000000000 → 404, problem details
curl
curl -s -X DELETE 'https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart/items/00000000-0000-0000-0000-000000000000' \
-H 'X-Trax-Guest-Cart: gc_your_guest_cart_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/guest-cart/items/00000000-0000-0000-0000-000000000000', {
method: 'DELETE',
headers: {
'X-Trax-Guest-Cart': 'gc_your_guest_cart_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/guest-cart/items/00000000-0000-0000-0000-000000000000");
request.Headers.Add("X-Trax-Guest-Cart", "gc_your_guest_cart_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();What a guest cart shows.
- Lines: shaped like a family's cart lines, with
person: null. - Prices: the catalog's fees, with no program discount (that needs an account).
- Totals:
subtotalCents,convenienceFeeCents,totalCentsandlaterCents. There is nocanCheckOut: a guest signs in to check out.
What is checked now, and what waits for an attendee.
- Checked now: the rules that don't need a family. Is the activity published here, is registration open, are
seats left (the waitlist where there is one), and is a hierarchy option's parent in the cart. A line that fails
them is refused (
422 not-eligible, withproblems). - Checked after sign-in: age, grade, gender, memberships and earlier registrations, once the family chooses who attends.
| Status | code |
When |
|---|---|---|
400 |
invalid-request |
A field is missing, or the line has a personId or is a charge |
404 |
guest-cart-not-found |
No token, or a token that is unknown, expired, already merged or from another portal (the answer is the same for each) |
404 |
activity-not-found, membership-not-found |
Not offered at this portal |
409 |
already-in-cart, cart-full, donations-off |
The same activity or membership is already a line; the cart has 50 lines; the portal takes no donations |
422 |
not-eligible |
The line can't be registered now (problems says why) |
429 |
rate-limited |
Too many guest carts or changes from one address in an hour |
Signing in: merging the guest cart
Right after the family signs in, call POST …/cart/merge with their access token and the guest token. The guest
cart's lines join the family's cart.
Merging a guest cart that has expired or doesn't exist
POST https://api.nfocus.solutions/v1/portals/riverbend/north/cart/merge → 404, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/merge' \
-H 'Authorization: Bearer your_access_token' \
-H 'X-Trax-Guest-Cart: gc_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/merge', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_access_token',
'X-Trax-Guest-Cart': 'gc_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
},
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/merge");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Headers.Add("X-Trax-Guest-Cart", "gc_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();The answer holds four fields:
merged: each line added, with its newitemId.dropped: each line left out, with acodeand amessage. A line is dropped when it can't be registered now (registration-closed,fulland the rest), when the cart already has the same activity or membership with no attendee, or a donation (already-in-cart), or when the cart is full (cart-full).message: a sentence to show, for example "We added 1 program you picked before signing in." It isnullwhen nothing merged.cart: the family's cart.
After a merge the guest token stops working. A retry with the same token, by the same family, returns the same answer and adds nothing twice. Delete the token from storage once the merge answers.
Choosing who attends
Merged activity and membership lines have no attendee (person: null). Each shows the problem attendee-needed,
and canCheckOut stays false until every line has one. Ask the family who attends, and send it:
PATCH …/cart/items/{itemId}
{ "personId": 1052 }
GET …/activities/{id}/eligibility lists each household member with the reasons they can or can't attend, so
offer only the members who can.
The attendee is checked as an add is:
404 member-not-foundwhen the person isn't in the household;409 already-in-cartwhen the same member is already on the same activity;422 not-eligiblewithproblemswhen they can't register. The line then stays without an attendee.
Once a line has an attendee, it keeps them (409 attendee-already-set): to change who attends, remove the line and
add it again. The same PATCH can also carry payCents.
Choosing who attends a line that isn't in the cart
PATCH https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000 → 404, problem details
curl
curl -s -X PATCH 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"personId": 1234}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"personId": 1234}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Patch, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"personId": 1234}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();Reading the cart
The signed-in family's cart, priced now
GET https://api.nfocus.solutions/v1/portals/riverbend/north/cart → 200 OK, JSON
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart', {
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/cart");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();Amounts are integer cents.
| Field | Meaning |
|---|---|
lines[].totalCents |
What the line will charge (a registration) or what is still owed (a payment toward a charge) |
lines[].minimumCents |
The least the family may pay today on the line |
lines[].payCents |
What the family pays today on the line |
lines[].laterCents |
What stays on the account, due at each installment's due date |
lines[].installments |
Each installment: its price, its price after a discount, its minimum, its due date and what today's payment puts on it |
lines[].registration |
enroll or waitlist (see below); null when the line can't be registered |
lines[].problems |
Why the line can't be checked out, with the same codes as eligibility (Household and eligibility guide), plus attendee-needed for a line merged from a guest cart, and already-in-cart for a line that repeats an earlier one (two requests sent at once can both add it: remove the extra line) |
lines[].hold |
The seat the line holds while the family checks out (see "Seat holds"), or null |
lines[].notices |
What changed on the line since the family last saw it, in plain words (see "Change notices") |
subtotalCents |
What the lines pay today |
convenienceFeeCents |
The portal's convenience fee on today's payment |
totalCents |
What checkout charges the card: subtotal plus convenience fee |
creditCents |
Credit on the account. It's shown for information; checkout doesn't spend it |
canCheckOut |
true when the cart has lines and none has a problem |
automaticPayments |
true where the organization pays later installments automatically: laterCents then goes on automatic payments, and checkout needs a saved card (below) |
laterSchedule |
What checkout would leave for later, one entry per date: date, amountCents, paidBy and processingFee (see "Later payments") |
savedForLater |
Lines saved for later, priced now for information (see "Save for later"); not in the totals |
reminders |
offered (the organization sends reminder emails) and optedIn (this sign-in asked for them); see "Reminder emails" |
Show totalCents as the amount to pay, and send it back at checkout (below).
Adding a registration
POST …/cart/items with a member of the household and an activity:
{ "kind": "activity", "activityId": 41, "personId": 1052 }
The answer is the whole cart, priced again. A line is refused when it can't be registered as things stand:
| Status | code |
When |
|---|---|---|
400 |
invalid-request |
A field is missing |
404 |
member-not-found, activity-not-found |
The person isn't in the household, or the activity isn't published at this portal |
409 |
already-in-cart |
The same member and activity are already a line |
422 |
not-eligible |
The member can't register; problems lists why (age, grade, membership, window, …) |
A registration line without a member
POST https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items → 400, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"kind": "activity", "activityId": 3 }'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"kind": "activity", "activityId": 3 }),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"kind": "activity", "activityId": 3 }
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();A past-due balance doesn't stop a line from being added, because the family can pay it in the same cart (below). The
line shows a balance-due problem until the cart covers the balance. A missing membership that can be bought online
doesn't stop it either: add the membership for the line (Memberships guide).
Memberships are lines too (kind: "membership"), on their own or for an activity line; see the Memberships guide.
Group sessions and hierarchy levels are ordinary lines: add one line per session (the session ids are in the
catalog listing's sessions). Each session has its own fee and seats. For a hierarchy, add the parent activity
before its options: an option needs its parent registered already or in the same cart. The parent can't be removed
while one of its options for the same member is in the cart (409 has-dependents).
Seats count across the cart. When the cart holds more people than an activity has seats left, the extra lines
go to the waitlist (registration: "waitlist", $0) if the activity has one, or show the full problem. An option
whose parent would go to the waitlist can't be registered (parent-full).
Later payments
laterSchedule says what checkout would leave for later and how it gets paid, one entry per date, so the page can
show "$133.80 today, then $120.00 on February 1 and March 1". Each entry has date, amountCents, paidBy and
processingFee. paidBy is one of:
automatic: where the organization uses automatic payments (automaticPayments), each installment is charged to the saved card on its due date;plan: where the account has an enabled payment plan, the installments join the plan's months, worked out the way checkout will;invoice: otherwise each installment is due on its date, and the family pays it when they choose.
processingFee is true where that payment adds the organization's processing fee when it runs. The fee isn't in
amountCents.
Paying less today is the choice of payCents on each line (from its minimum). Setting up a payment plan stays on the
Payment plans guide's endpoints.
Seat holds
Once the family chooses who attends a registration that would enroll, the line holds its seat for a few minutes while they finish checking out. A seat is held when the line is added with a member, or when a member is chosen for a line that had none. Other families, the catalog and checkout all count a held seat as taken.
lines[].hold |
Meaning |
|---|---|
expiresUtc |
When the hold ends |
secondsLeft |
The seconds left as the server counts them: base a countdown on this, not on the device's clock |
extensionsLeft |
How many more times the hold can be extended |
extensionMinutes |
How many minutes one extension adds |
GET …/config gives the portal's settings in cart:
holdMinutes: 15 by default;0means this organization doesn't hold seats;holdExtensions: 1 by default;holdExtensionMinutes: 10 by default.
Extending a hold. POST …/cart/items/{itemId}/hold/extend adds extensionMinutes to the hold and answers with
the cart. It is refused with 409 hold-extension-limit when no extensions are left, and with 409 hold-not-active
when the line holds no seat now (the hold ended, or none was taken).
Extending the hold of a line that isn't in the cart
POST https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/hold/extend → 404, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/hold/extend' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/hold/extend', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_access_token',
},
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/hold/extend");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();When a hold ends. A seat is let go:
- when the order is placed;
- when the line is removed;
- when the hold expires.
After it expires, the line stays in the cart without a seat and is priced again on every read: a registration while
seats are left, otherwise the waitlist or full. Nothing takes a new hold for it; check out soon.
When every seat left is held. The activity is full for now:
- the catalog shows
availabilityfullorfullWaitlist, withavailabilityLabel"All spots held, check back soon" andspotsHeld; - a new line goes to the waitlist where there is one, or is refused with
fulland the message "All spots are held by families checking out. Check back soon."; - if a hold ends before that family checks out, the cart prices the line as a registration again.
Not waitlist lines, memberships or unlimited activities. Holds are only for seats that run out.
Holds are the online portal's. Staff enrolling people in Trax don't see them. Checkout still counts the real
seats at the last moment. Holds rank by when they were taken, so when a staff enrollment takes a seat that was held,
only the latest hold loses its seat: that family's line shows the waitlist (or full), and a checkout already under
way answers 409 cart-changed, with the waitlist offered where there is one.
One seat per member. A member holds at most one seat in an activity, however many requests arrive at once.
Save for later
A family can move a registration or a membership out of this order without losing it.
POST …/cart/items/{itemId}/save-for-later answers with the cart:
Saving a line for later that isn't in the cart
POST https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/save-for-later → 404, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/save-for-later' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/save-for-later', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_access_token',
},
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/save-for-later");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();What saving does.
- Out of the order: the line leaves the totals,
canCheckOutand the forms step (a member with nothing else in the order leaves the forms step). - No seat: its seat is no longer held.
- Where it shows: in
savedForLater, priced now, with any problems for information and no hold. - Lines that move with it: an activity takes the memberships added for it along. A hierarchy parent stays while
one of its options is in the order (
409 has-dependents). - What can't be saved: only registrations and memberships can, so a payment or donation line is
409 cannot-save-for-later. So is a membership added for an activity: save the activity instead. - Limits: up to 50 lines can be saved. Saved lines don't expire, and checkout leaves them in the cart.
POST …/cart/items/{itemId}/move-to-cart brings a line back. It is checked as an add, and so are the memberships
that come back with an activity:
422 not-eligible, withproblems, when it can't be registered now; the line stays saved;409 already-in-cartwhen the same member and activity are already in the order;409 cart-fullwhen the order has 50 lines.
When it comes back, it goes to the end of the cart and holds a seat again with fresh extensions. If its price
changed while it was saved, it shows a price-changed notice. A line merged from a guest cart and saved before its
attendee was chosen comes back still needing one (attendee-needed): choose who attends as for any merged line.
Moving back a saved line that isn't in the cart
POST https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/move-to-cart → 404, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/move-to-cart' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/move-to-cart', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_access_token',
},
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000/move-to-cart");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();Change notices
Every cart read compares each line with how the family last saw it: when it was added, when its attendee was chosen,
when it was saved for later, or when the family last acknowledged its notices. Each change becomes a notice in
lines[].notices, with a code and a plain-language message.
code |
When | message |
|---|---|---|
price-changed |
The line's price changed (oldCents, newCents) |
"Price changed from $35.00 to $40.00 since you added it." |
now-waitlisted |
It was a registration, and now goes to the waitlist | "Now on the waitlist. The class filled after you added it. You pay nothing unless a spot opens." |
now-full |
It was a registration, and the activity is now full with no waitlist | "This class filled after you added it." |
registration-closed |
Registration closed since it was added | "Registration closed after you added this." |
spot-opened |
It was waitlisted, and now it can register | "A spot opened. This is now a registration, not the waitlist." |
hold-expired |
Its seat hold ran out | "Hold ended. Check out soon; the spot is not saved." |
merged-from-guest |
It came from the guest cart | "Added before you signed in." |
Registrations get every kind. Memberships get only price-changed, and payments and donations get none, since the
family chose those amounts. A code the front end doesn't know: show its message.
Notices stay until the family has seen them. POST …/cart/notices/ack with { "itemIds": [ … ] } clears those
lines' notices; {} clears every line's. It answers with the cart, and another cart's line ids answer
404 cart-item-not-found.
Clearing the notices the family has seen, on every line
POST https://api.nfocus.solutions/v1/portals/riverbend/north/cart/notices/ack → 200 OK, JSON
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/notices/ack' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/notices/ack', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/notices/ack");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();Reminder emails
Where the organization offers them (cart.remindersOffered in GET …/config), a family can ask to be emailed if
they leave without checking out. They are off until the family asks:
PUT …/cart/reminders
{ "optIn": true }
The answer is the cart, with reminders: { "offered": true, "optedIn": true }. { "optIn": false } turns them off;
asking where they aren't offered is 409 reminders-off.
Turning reminder emails off for this cart
PUT https://api.nfocus.solutions/v1/portals/riverbend/north/cart/reminders → 200 OK, JSON
curl
curl -s -X PUT 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/reminders' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"optIn": false}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/reminders', {
method: 'PUT',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"optIn": false}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Put, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/reminders");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"optIn": false}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();When a reminder goes:
- the cart holds a registration or a membership;
- a day (the organization's setting) has passed since the cart last changed (adding, removing, saving, moving back, choosing an attendee or what to pay today) or since the last reminder;
- it is between 8 a.m. and 8 p.m. at the organization;
- no checkout is under way.
At most two go out each time the cart fills up again. Nothing goes to a guest cart, an empty cart or one that was checked out.
What it says. The email goes to the address the family signs in with, from the organization:
- the first names of the members in the cart and the program and membership names;
- "Spots aren't saved until you check out.", with any program that has five spots or fewer left;
- a "Return to my cart" button linking to the organization's site;
- a "Stop cart reminders" link.
It holds no prices, form answers or other personal details.
Stopping them. Every reminder carries a one-click unsubscribe (RFC 8058 List-Unsubscribe with
List-Unsubscribe-Post), which mail apps show as an "Unsubscribe" button. Its footer link opens a page on the API
with one "Stop cart reminders" button; opening the page alone changes nothing. Both turn reminders off for that sign-in
at this portal. A link works for 90 days and only for its own cart (400 unsubscribe-token-invalid otherwise).
A one-click unsubscribe with a link that isn't valid
POST https://api.nfocus.solutions/v1/portals/riverbend/north/cart-reminders/unsubscribe?token=not-a-valid-token → 400, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart-reminders/unsubscribe?token=not-a-valid-token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart-reminders/unsubscribe?token=not-a-valid-token', {
method: 'POST',
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart-reminders/unsubscribe?token=not-a-valid-token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();Today's payment
A registration's fee can have installments. By default the family pays the whole price today, or the minimum when the organization prefers that. The family can choose any amount from the minimum to the total:
PATCH …/cart/items/{itemId}
{ "payCents": 6000 }
An amount outside that range is 422 pay-amount with minimumCents and totalCents. Today's payment covers each
installment's minimum first, then the rest in order; whatever isn't paid today is charged now and due later.
Changing a line that isn't in the cart
PATCH https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000 → 404, problem details
curl
curl -s -X PATCH 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"payCents": 2500}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"payCents": 2500}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Patch, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items/00000000-0000-0000-0000-000000000000");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"payCents": 2500}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();A program discount the family's account holds appears as discount on the line, with each installment's price
after it. It comes from the organization's settings. It is applied the same way at checkout, so the price shown is
the price charged.
A waitlisted line costs nothing: nothing is charged now, and the organization charges the fee if a seat opens.
Paying the account balance ("Pay Now")
Unpaid charges the family can pay
GET https://api.nfocus.solutions/v1/portals/riverbend/north/account/charges → 200 OK, JSON
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/account/charges' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/account/charges', {
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/account/charges");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();GET …/account/charges lists the account's unpaid charges, oldest due first, with pastDue for the ones already
due. Add one to the cart to pay it:
{ "kind": "charge", "chargeId": 8811 }
The whole balance of the charge is paid by default; any amount above zero up to it can be chosen with PATCH. Pay Now
lines and registrations share one card payment.
Paying an amount. For "Another amount: goes toward the oldest charges first", send the amount:
POST …/cart/pay-amount
{ "amountCents": 4000 }
The cart's payment lines are set to cover exactly that amount, oldest charges first (the order of
GET …/account/charges): each charge in full until the last, which takes what is left. Charges the amount doesn't
reach leave the cart; registrations, memberships and donations aren't touched. The amount must be at least one cent
and at most what the account's charges owe (422 pay-amount, with totalCents).
Paying an amount of nothing toward the balance
POST https://api.nfocus.solutions/v1/portals/riverbend/north/cart/pay-amount → 422, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/pay-amount' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"amountCents": 0}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/pay-amount', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"amountCents": 0}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/pay-amount");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"amountCents": 0}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();A charge that a later payment-plan or automatic payment will pay carries scheduledPayment (kind: plan or
automatic) and can be paid now: that payment lets go of what is paid, and becomes smaller or goes (Payment plans and
Automatic payments guides). A payment that runs within about a day holds its charges: they aren't offered. If one
starts running after the line was added, the line shows charge-not-found, and a checkout already under way stops
before the card is charged (409 cart-changed). GET …/account/balance gives the charges each Pay Now button adds
(Account guide).
After a checkout, the family's automatic payments and payment plan follow it: what is left for later goes on automatic payments where the organization uses them (below), and otherwise joins the plan's months.
Some activities don't allow registering while the account has a past-due balance. Their lines show balance-due
with the amount still past due after what the cart pays. Add the past-due charges and pay them in full, and the
problem goes away.
On a parent-portal-only site, registrations are refused (parent-portal-only) and balance payments go through.
A donation
A donation below the minimum
POST https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items → 400, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"kind": "donation", "amountCents": 50}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"kind": "donation", "amountCents": 50}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/items");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"kind": "donation", "amountCents": 50}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();A cart can hold one donation, of an amount the family chooses within the limits GET …/donations/options gives
($1.00 to $10,000.00 by default):
{ "kind": "donation", "amountCents": 2500 }
It is paid in full today, never brings or adds to the convenience fee, and is on the receipt. Change the amount with
PATCH …/cart/items/{itemId} and payCents. An amount outside the limits is 400 (adding) or 422 donation-amount
(changing); a portal that takes no donations answers 409 donations-off. A cart with only a donation checks out like
any other, with the card. Donations are allowed on parent-portal-only sites. Giving without signing in is in the
Donations guide.
Forms and waivers
Before checkout, each member with a registration or a membership in the cart goes through the forms step:
- the portal's participant form;
- the form of each of their activities that has one;
- their waivers;
- the forms' signatures, where the organization uses electronic signatures.
GET …/cart/forms says what each member needs and what is still missing. Checkout refuses with
409 forms-incomplete until every member is complete.
The forms step for everyone in the cart
GET https://api.nfocus.solutions/v1/portals/riverbend/north/cart/forms → 200 OK, JSON
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/forms' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/forms', {
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/cart/forms");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();For each member in people:
forms: the participant form first (kind: participant), then each activity form (kind: activity, with theactivityIdsit is for). Load the definitions fromGET …/forms/participantandGET …/activities/{id}/form(see the forms guide).waivers: each waiver once. An activity's waiver haskind: activity, itsidand theactivityIdsit covers; a membership's haskind: membershipand the membership type'sid. Show thetitleand the wholetext.acceptedsays whether the saved step accepted this exact text.signatures: each signature element on the member's forms once: itssignatureId, theformIdit is on, thesigneeRole, whether it isrequired, andsignedUtconce the step holds it.problems: what is missing (table below).errors: the saved answers' field errors, by field key.
Show one page per member. Prefill it from GET …/cart/forms/people/{personId}: for every field on the member's forms,
the answer saved in the step, or else the stored value (an SSN only masked), and the step's signatures with their
strokes (pass them to Signature Pad's fromData()). Save the page:
PUT /v1/portals/riverbend/north/cart/forms/people/5012
Authorization: Bearer {access token}
Content-Type: application/json
{
"definitionHashes": { "41": "{participant form hash}", "57": "{activity form hash}" },
"answers": { "person.medicalNotes": "Mild asthma", "person.swim": "1" },
"acceptedWaivers": [ { "kind": "activity", "id": 12, "textHash": "{the waiver's textHash}" } ],
"signatures": [ { "signatureId": "{the element's signatureId}", "printedName": "Pat Example", "strokes": [ … ] } ]
}
answershold the fields of all the member's forms together, keyed as on the forms. A field on two forms takes one answer, which must pass both forms' rules. As on the forms, leave a field out to keep the stored value and send it empty to clear it.acceptedWaiverslists every waiver the family ticked, with thetextHashof the text shown. If the organization changes the text afterwards, the step asks for it again (waiver-changed). The step can show a change up to 30 seconds late; checkout always checks the current text and answers409 forms-incompleteif a ticked waiver has changed.signatureslists every signature signed, as on the participant form (forms guide): Signature Pad'stoData()strokes and the typed name. A signature sent again unchanged keeps the time it was first saved; a changed one is new.definitionHashesis optional. A stale one is409 form-changed.- Each save replaces the member's previous one. Answers that don't pass are kept, so the family can go back a page; the answer to the save lists what is still missing.
- Refused saves: a body that isn't an answers object, that names a field or a signature on none of the member's
forms, or whose signature isn't Signature Pad's, is
400, and nothing is kept. A member with nothing in the cart is404 cart-person-not-found.
A forms step for a member with nothing in the cart
PUT https://api.nfocus.solutions/v1/portals/riverbend/north/cart/forms/people/1234 → 404, problem details
curl
curl -s -X PUT 'https://api.nfocus.solutions/v1/portals/riverbend/north/cart/forms/people/1234' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"answers": {}, "acceptedWaivers": []}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/cart/forms/people/1234', {
method: 'PUT',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"answers": {}, "acceptedWaivers": []}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Put, "https://api.nfocus.solutions/v1/portals/riverbend/north/cart/forms/people/1234");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"answers": {}, "acceptedWaivers": []}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();problems[].code |
Meaning |
|---|---|
forms-not-saved |
The member's step hasn't been saved, or it expired (steps are kept for 24 hours after the last save) |
answers-needed |
Some answers don't pass; see errors |
form-changed |
The organization changed a form since the step was saved: load it again, check the answers and save |
form-not-renderable |
A form needs a field the API can't show yet. The family can't check out until the organization changes the form |
waiver-not-accepted |
A waiver isn't ticked |
waiver-changed |
A waiver's text changed since it was ticked |
signature-needed |
A required signature isn't signed (signatureId names it) |
At checkout the API checks every member's step again. If all are complete, it does four things:
- for each member with a signature, it draws a PDF of their forms from the answers, before anything is charged
(
503 documents-unavailableif it can't just now: nothing is recorded or charged; try again); - it records each accepted waiver with the order: who accepted it, for whom, when, and a copy of the text;
- it saves the answers, and files each member's signed PDF with their documents, in the same transaction as the registration, so if checkout fails nothing is saved and the step stays for the next try;
- it deletes the steps once checkout succeeds.
Removing a member's last line also deletes their step. Saved steps are encrypted, and only the login that saved them can read them.
Checkout
POST …/checkout with an Idempotency-Key header, the total the family was shown, the "I'm not a robot" answer and
the card:
POST /v1/portals/riverbend/north/checkout
Authorization: Bearer {access token}
Idempotency-Key: 6f1c0a8e-1f7b-4c51-9a55-3f0f5c2c7e41
Content-Type: application/json
{
"expectedTotalCents": 6330,
"captchaToken": "{the reCAPTCHA answer}",
"payment": {
"nonce": "{payment method nonce from the card form}",
"firstName": "Avery",
"lastName": "Rivera",
"street1": "1 Main Street",
"city": "Springfield",
"stateProvince": "OH",
"postalCode": "43004",
"phone": "(555) 201-0000"
}
}
Idempotency-Keyis required: make a new random value for each checkout and reuse it only to retry the same one. A retry with the same key returns the first answer and never charges twice. The same key with a different body is422 idempotency-key-reused.expectedTotalCentsis the cart'stotalCentsthat the family agreed to. If prices, seats or the balance changed since, nothing happens and the answer is409 price-changedwith the cart as it is now.captchaTokenis required on every checkout, including one with nothing to pay. Render Google's reCAPTCHA v2 checkbox with the portal's site key (captchaSiteKeyinGET …/config) and send the answer it gives you. The answer works once: after any failed checkout, reset the box and ask the family to tick it again. The API checks the answer with Google and checks that the box was ticked on one of the site's own addresses.paymentis needed when the total is above zero. The card itself never reaches the API: the card form turns it into a one-timenonce(see "The card form" below). In development and tests the API uses a stand-in gateway. These nonces approve:fake-valid-nonce,fake-valid-mastercard-nonce. These decline:fake-processor-declined-visa-nonce,fake-gateway-rejected-fraud-nonce. As in Braintree's sandbox, a payment of $2,000.00 to $2,999.99 is declined whatever the card.- A saved card instead of a nonce: send its
paymentMethodId(fromGET …/payment-methods, Saved cards guide) with the billing name and address. Only the signed-in person's own cards are accepted. - Saving the new card: add
"saveCard": true(and optionally"cardName") next to thenonce. The card is verified and saved first, then charged; it stays saved even if the payment is then declined, and the answer names it (paymentMethodId) so the retry can use it. - Automatic payments: where the cart's
automaticPaymentsistrueandlaterCentsis above zero, what is left is paid automatically from a saved card on each installment's due date (Automatic payments guide). Checkout then needs a saved card: itspaymentMethodId, or anoncewith"saveCard": true. Otherwise the answer is409 saved-card-needed(withlaterCents), before anything is recorded or charged. With nothing to pay today, sendpaymentwith the saved card (or the card to save) and the billing name: the card is kept for the later payments and nothing is charged now. An expired saved card is refused (400). - A cart with nothing to pay today, and nothing for automatic payments, checks out without
payment.
Checkout without an Idempotency-Key
POST https://api.nfocus.solutions/v1/portals/riverbend/north/checkout → 400, problem details
curl
curl -s -X POST 'https://api.nfocus.solutions/v1/portals/riverbend/north/checkout' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"expectedTotalCents": 0}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/checkout', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"expectedTotalCents": 0}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nfocus.solutions/v1/portals/riverbend/north/checkout");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"expectedTotalCents": 0}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();A successful checkout answers 201 with the order: what was registered (enroll or waitlist), charged and paid,
the receipt number and the card's type and last four digits (with paymentMethodId when it is a saved card).
Checked-out lines leave the cart.
| Status | code |
What to do |
|---|---|---|
201 |
Show the confirmation | |
400 |
invalid-request |
Fix the field named in errors (a missing key, total, reCAPTCHA answer or card detail) |
400 |
captcha-failed |
The reCAPTCHA answer was refused or has expired. Reset the box, let the family tick it again, and retry |
402 |
payment-declined |
The card was declined; nothing was registered. Ask for another card and use a new key |
409 |
cart-empty, cart-changed, price-changed |
Show the cart in the answer (cart) and let the family check it again |
409 |
forms-incomplete |
Show forms (as GET …/cart/forms returns it) and send the family back to the members still missing something |
409 |
checkout-in-progress |
The first request with this key is still running; check the family's registrations (GET …/registrations) before retrying |
409 |
payments-unavailable |
The organization isn't taking payments online right now |
409 |
saved-card-needed |
Later installments are paid automatically: pay with a saved card, or save this one (saveCard) |
409 |
saved-cards-unavailable, payment-methods-limit |
saveCard can't be used here, or the person already keeps 10 cards; nothing was charged. Pay without saving |
422 |
idempotency-key-reused, below-minimum-payment |
Use a new key; or the payment is below the organization's minimum |
502 |
payment-unavailable |
The payment service didn't answer; nothing was charged. Retry with a new key (with saveCard, use the card it names if there is one) |
503 |
captcha-unavailable |
Google couldn't check the reCAPTCHA answer; nothing was charged. Reset the box and retry shortly |
503 |
documents-unavailable |
A member's signed forms couldn't be drawn as a PDF just now; nothing was recorded or charged. Retry shortly with the same key |
Seats are counted again at the last moment. If one was taken after the family pressed "Pay", the card is released at
once and the answer is 409 cart-changed, showing for example that the line would now go to the waitlist.
The card form
GET …/payments/client-token gives the card form a token for the payment gateway's hosted card fields
(Braintree braintree-web Hosted Fields). The family types the card into fields served by the gateway, and the form
gives you the one-time nonce to send as payment.nonce. Ask for a new token each time you show the form. When the
organization doesn't take card payments online the answer is 409 payments-unavailable.
Include a cardholder name field and pass it when you tokenize (cardholderName, with vault: false). It is printed on
the receipt and kept with the payment; without it, the payer's name from payment is used.
A client token for the card form
GET https://api.nfocus.solutions/v1/portals/riverbend/north/payments/client-token → 200 OK, JSON
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/payments/client-token' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/payments/client-token', {
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/payments/client-token");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();In development and tests the token is a placeholder (fake-client-token) and the nonces above stand in for a card.
The confirmation and receipt
GET …/orders/{id} returns the same order later (for a confirmation page that reloads). Only the family that placed
the order can read it.
An order id that isn't yours
GET https://api.nfocus.solutions/v1/portals/riverbend/north/orders/AAAAAAAAAAAAAAAAAAAAAA → 404, problem details
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/orders/AAAAAAAAAAAAAAAAAAAAAA' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/orders/AAAAAAAAAAAAAAAAAAAAAA', {
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/orders/AAAAAAAAAAAAAAAAAAAAAA");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();Every checkout sends one email to the account's primary holder: what was registered (or waitlisted), what was paid toward the balance, what was paid today and what is still due. After a card payment the receipt is attached as a PDF with the receipt number, the card used and the balance after the payment. The email is sent shortly after the checkout; a problem sending it never undoes the checkout.
GET …/orders/{id}/receipt.pdf returns the same PDF at any time, for a "Download receipt" link. An order with no card
payment has no receipt (404 receipt-not-found).
The receipt of an order that isn't yours
GET https://api.nfocus.solutions/v1/portals/riverbend/north/orders/AAAAAAAAAAAAAAAAAAAAAA/receipt.pdf → 404, problem details
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/orders/AAAAAAAAAAAAAAAAAAAAAA/receipt.pdf' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/orders/AAAAAAAAAAAAAAAAAAAAAA/receipt.pdf', {
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/orders/AAAAAAAAAAAAAAAAAAAAAA/receipt.pdf");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();What changed from the current portal
- Choosing who attends holds the seat for a few minutes, so a family isn't beaten to the last seat while filling in forms. The current portal counted seats only at checkout.
- Lines can be saved for later, and the cart says in plain words what changed since the family last looked. The current portal re-checked the cart only at checkout.
- A family can ask for a reminder email if they leave without checking out. The current portal sent none.
- A visitor can start a cart before signing in, and it joins the family's cart at sign-in. The current portal kept the cart in the browser under the signed-in user's name, so nothing could be picked before signing in.
- Prices, minimums, discounts and the convenience fee are computed on the server; the browser's numbers aren't trusted.
- Every eligibility rule runs again when a line is added and at checkout, and seats are counted under a lock.
- An activity's options aren't registered when its parent goes to the waitlist.
- A Pay Now line can only pay the family's own charges, and the balance-due rule can't be skipped.
- Paying a charge a plan or automatic payment holds makes that payment smaller (the current portal did this too).
- Automatic payments need a saved card, and that is checked before anything is charged. The current portal charged the card first, then failed when the card wasn't a saved one and released the payment.
- A donation is a cart line, checked against the organization's limits and its donations switch on the server, and is on the receipt.
- A problem after the card is approved releases the card; a payment that is saved is never undone.
- The reCAPTCHA answer is checked against the site's own addresses, not only with Google.
- The receipt can be downloaded again from the server; the old confirmation page lived only in the browser tab.
- The forms step is checked on the server: forms complete and every waiver accepted. The current portal checked none of it, its waiver tick box didn't stop checkout, and it never stored the acceptance.
- An activity's waiver is asked for even when the activity has no form. A membership's waiver is asked for when the membership is in the cart; the current portal showed the waivers of the memberships an activity required instead.
- Forms-step answers wait on the server, encrypted, rather than unencrypted in the browser.
- Signatures are checked and timed on the server, and the signed PDF is drawn on the server from the saved answers. The current portal printed the browser's own page, made the PDF after charging the card (and released the card when that failed), and took the signature's time, role and usage from the browser.