> For the complete documentation index, see [llms.txt](https://kb.theloops.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.theloops.io/agentstudio/skills-library/projects/detect-afp-payment-matching-exception.md). Agents can also search and read this documentation through its [MCP server](https://kb.theloops.io/~gitbook/mcp).

# Detect AfP Payment Matching Exception

Customer payments against sales-contract applications for payment (AfPs) are matched in IFS as AfpPayment records.

| Business area | Action type |
| ------------- | ----------- |
| Projects      | Read-only   |

## Overview

A match can be left unconfirmed, can be only partly allocated to AfP items, can exceed the amount due, or can disagree with the AfP status (for example, payment confirmed but the AfP still shows Certified).

IFS Cloud OData integration.

## How it works

{% stepper %}
{% step %}
Matches: AfpPaymentSet filter.
{% endstep %}

{% step %}
Match: Single AfpPaymentSet row.
{% endstep %}

{% step %}
Allocation: GetPaymentDetails function.
{% endstep %}

{% step %}
Status: AppForPaymentSet.
{% endstep %}

{% step %}
Return structured results and any escalation guidance.
{% endstep %}
{% endstepper %}

## Key capabilities

* Read one AfP payment match or all matches of one AfP.
* Evaluate confirmation status against the IFS confirmation gate (Confirmed = false and LedgerItemId != null and MatchedAutomatically = false).
* Compare paid amount with allocated item amounts (TotalPaidAmount from GetPaymentDetails).
* Detect over-payment (RemainingAmount < 0 or PaidAmount > AmountDue at match level).
* Detect inconsistency between confirmed matches and AfP state / balance (Objstate, CertBalanceDue).
* Surface payment and ledger item references (series, payment ID, voucher, pay date, ledger item state) for follow-up.
* Report write-off amounts on the match.
* Return a ranked list of exceptions with a recommended next action and owner role.

## Requirements

The following IFS Cloud components and projections must be available, with permission sets that grant access to each projection.

| Component        | Projection                                 |
| ---------------- | ------------------------------------------ |
| APPPAY           | SalesContractAfpPaymentsHandling           |
| PAYLED (PAYMENTS | SalesContractApplicationForPaymentHandling |

## Version compatibility

| Projection                                 | Supported IFS Cloud releases |
| ------------------------------------------ | ---------------------------- |
| SalesContractAfpPaymentsHandling           | 24R2, 25R1, 25R2, 26R1, 26R2 |
| SalesContractApplicationForPaymentHandling | 24R2, 25R1, 25R2, 26R1, 26R2 |

## Known limitations

* Scope matches the packaged tools and instructions only.
