DocsGuides

Amounts and directions

amount is always positive. direction carries the sign. To get a signed figure, negate when direction is debit.

How direction is decided#

From the document, never from the payee name. Issuers encode it four ways:

  1. A sign on the amount. A leading or trailing minus, or brackets.
  2. A section heading that owns every row beneath it, such as CHECKS AND OTHER DEBITS. The rows themselves carry no marker.
  3. Paired columns, Débit | Crédit, where the column decides the direction.
  4. A marker against a default. On a card statement every row is a charge unless it carries CR.

Income#

Only count credits on type: "bank" accounts. A credit card's credits are the monthly repayment and merchant refunds. Summing credits across every account in a file inflates income by whatever the customer spent on the card.

Filter on account type
const income = doc.accounts
  .filter((a) => a.type === "bank")
  .reduce((sum, a) => sum + a.totals.credits, 0);

The same applies in reverse. A payment from a current account to a credit card is not spending if you also hold that card's statement for the month, because the purchases it settles are itemised there.

Totals#

totalsstatedTotals
Where it comes fromSummed from the rows in this response.Copied from the figure the issuer printed.
Use it toAdd up money.Check our extraction against the document.
Watch out forNothing. It agrees with transactions by construction.Convention. Amex's total new spend is net of refunds; most banks' is not.

A gap between the two is usually a difference of convention. See Verification.

Something wrong or missing on this page? [email protected]