Data element: Transaction Amount
Definition
- Purpose: Monetary value associated with a financial transaction.
- Data type: Fixed-point decimal or integer in minor units (recommended).
- Currency dependency: Precision and allowed decimal places depend on the transaction currency per ISO 4217 minor unit (exponent).
- Sign convention: Configurable by transaction_type (e.g., debit, credit, refund) and account/ledger rules.
Validation rules
Syntactic and type integrity
- R1. Not-null
- Rule: amount must be present for any posted or authorized monetary transaction.
- Severity: Reject.
- R2. Numeric and finite
- Rule: amount must be a numeric value; NaN, Infinity, and string formats are not allowed in stored data fields.
- Severity: Reject.
- R3. Fixed-point representation
- Rule: amount must be stored using fixed-point decimal with defined precision/scale or as integer in minor units (e.g., cents).
- Severity: Reject.
Currency-scale and precision
- R4. Decimal places match currency minor unit
- Rule: decimal scale must equal the currency’s minor unit (ISO 4217). For example, USD=2, JPY=0, KWD=3.
- Severity: Reject.
- R5. Rounding mode
- Rule: when calculations produce more precision than allowed, round to the currency minor unit using a defined rounding mode (e.g., round half up or bankers rounding). The rounding mode must be consistent across all services and documented.
- Severity: Reject if not conformant; Flag if internal intermediate breach before normalization.
Value range and sign
- R6. Non-zero (default)
- Rule: amount must be > 0 for standard purchase, transfer-out, or deposit transactions.
- Exception: amount may be < 0 for refunds/chargebacks or = 0 for authorization reversals; exceptions must be explicitly whitelisted by transaction_type.
- Severity: Reject if outside allowed ranges for the given transaction_type.
- R7. Sign aligned with transaction_type
- Rule: sign must match the transaction_type-to-sign mapping (e.g., debit=positive, credit=negative) defined in policy.
- Severity: Reject.
- R8. Maximum per transaction
- Rule: amount must not exceed Policy.MaxPerTransaction[currency] for the customer/segment/risk tier.
- Severity: Reject.
- R9. Minimum per transaction
- Rule: amount must be >= Policy.MinPerTransaction[currency], respecting currency minor units.
- Severity: Reject.
Contextual and business consistency
- R10. Currency consistency
- Rule: amount’s precision and rounding must be validated against the transaction currency. If conversion is performed, store original_amount, original_currency, conversion_rate, and converted_amount; validate converted_amount scale to the target currency.
- Severity: Reject if inconsistent.
- R11. Payment method constraints
- Rule: enforce method-specific rules (e.g., cash transactions cannot be negative; prepaid cards cannot create negative balances).
- Severity: Reject.
- R12. Balance protection (if applicable)
- Rule: posting the amount must not violate account constraints (e.g., no negative balance for accounts without overdraft).
- Severity: Reject.
- R13. Total reconciliation (if total present)
- Rule: subtotal + taxes + fees - discounts must equal total_amount within currency minor unit tolerance.
- Severity: Reject.
Anomaly and limit monitoring
- R14. Rolling limits
- Rule: sum of amounts per account/identity within defined windows (e.g., daily, weekly) must not exceed Policy.MaxRollingLimit[currency].
- Severity: Reject or Flag based on policy.
- R15. Outlier detection
- Rule: Flag if amount exceeds dynamic threshold (e.g., > P99 of last 90 days for the account or > 3 standard deviations above mean).
- Severity: Flag.
- R16. Duplicate prevention (amount-level)
- Rule: Flag potential duplicates when identical amount + currency + merchant + payment method occur within a short time window and same authorization reference.
- Severity: Flag.
Data quality and formatting at ingestion (for string inputs)
- R17. Canonicalization
- Rule: strip currency symbols, thousands separators, and locale-specific formatting; convert to canonical numeric before storage.
- Severity: Reject if canonicalization fails.
- R18. Leading/trailing characters
- Rule: no leading/trailing spaces; no non-numeric characters except one decimal separator (if using decimal representation).
- Severity: Reject.
Auditability and lineage
- R19. Provenance
- Rule: record source_system, capture_method, and transformation steps affecting amount and rounding.
- Severity: Flag if missing (data quality issue).
Configuration parameters (examples)
- Currency minor units: maintained from ISO 4217; override table for non-ISO assets (e.g., crypto).
- Rounding mode: round_half_up or bankers_rounding; single authoritative setting.
- Max/Min per transaction: per currency, per product, per KYC/risk tier.
- Rolling limits: per account/identity and time window.
- Transaction_type-to-sign map: explicit mapping table.
Example implementation patterns
Preferred storage schema
- Option A (minor units integer):
- amount_minor_units: BIGINT NOT NULL
- currency_code: CHAR(3) NOT NULL
- Constraint: amount_minor_units % 1 = 0 (implicit); scale guaranteed by currency minor unit.
- Option B (decimal fixed-point):
- amount: DECIMAL(18, s) NOT NULL, where s is determined by currency minor unit; if a single column must store multi-currency, enforce scale on write via application logic and validation triggers.
SQL check constraints (illustrative; adjust for your RDBMS)
- Enforce non-zero for purchase:
- CHECK (transaction_type <> 'PURCHASE' OR amount_minor_units > 0)
- Enforce sign for refunds:
- CHECK (transaction_type <> 'REFUND' OR amount_minor_units < 0)
- Per-transaction maximum (example for USD; 2 minor units):
- CHECK (currency_code <> 'USD' OR ABS(amount_minor_units) <= 10000000) -- e.g., USD 100,000.00
Great Expectations-style rules (illustrative)
- expect_column_values_to_not_be_null: amount
- expect_column_values_to_be_of_type: Decimal/Integer
- expect_column_values_to_be_between: min_value=Policy.MinPerTxn[currency], max_value=Policy.MaxPerTxn[currency], parse dynamically per row
- expect_multicolumn_values_to_satisfy: sign aligned with transaction_type
- custom expectation: decimal_places_equal_currency_minor_unit
Operational notes
- Avoid binary floating-point types; use fixed-point decimal or store minor units as integers.
- Maintain a currency metadata service for minor units and rounding rules; do not hardcode in application code.
- All exceptions must be explicit, logged, and reviewed; default stance is reject on violation.
- Version the policy configuration and capture effective_from dates to ensure reproducible validation across policy changes.