Payments Validator

Validates that payment amounts on the cart match the order total.

Overview

The Payments Validator ensures that the cart has valid payments and that the total amount paid matches the order total exactly. It checks for missing payments, underpayment, and overpayment.

Identifier

PropertyValue
Connector IDpaymentsValidator
Validation TypePayment

Behavior

  1. If no payments exist on the cart, returns a "No payments selected" error
  2. If any payment has a StaticPaymentType property, validation passes (static payment types are handled separately)
  3. Filters to active payments only
  4. If no active payments remain, returns a "No payments selected" error
  5. Calculates the total paid amount:
    • Uses AuthorizedAmount - CreditedAmount for each payment
    • Falls back to InvoicedAmount if the authorized amount minus credits is zero or negative
  6. Compares total paid to the order total:
    • If total paid is less than the order total, returns a "Not enough payments" error
    • If total paid is greater than the order total, returns a "Too much paid" error
    • If they match exactly, validation passes

Error messages

ConditionTranslation Key
No payments on cartNoPaymentsSelected
No active paymentsNoPaymentsSelected
Total paid is less than order totalNotEnoughPayments
Total paid exceeds order totalTooMuchPaid

Configuration

No additional properties required.

{
  "name": "paymentsValidator",
  "implementations": ["IValidator"],
  "disableStandardErrorPolicy": false
}

On this page