# Audit Coupa & SAP Ariba cXML Invoices for Tax & Math Errors

**Use case:** 

Pre-screen outbound or inbound cXML 1.2 InvoiceDetailRequest XML documents before portal submission to catch penny-rounding drift across line items, SubtotalAmount, Tax, Shipping, Discount, and DueAmount.

## Input

```json
{
  "operation_mode": "parse_and_audit_cxml",
  "cxml_documents": [
    "<!DOCTYPE cXML SYSTEM \"http://xml.cxml.org/schemas/cXML/1.2.061/cXML.dtd\"><cXML payloadID=\"inv-20261125-99@supplier.example\" timestamp=\"2026-11-25T11:00:00Z\"><Header><From><Credential domain=\"DUNS\"><Identity>081466849</Identity></Credential></From><To><Credential domain=\"NetworkID\"><Identity>AN01000998877</Identity></Credential></To></Header><Request deploymentMode=\"production\"><InvoiceDetailRequest><InvoiceDetailRequestHeader invoiceID=\"INV-2026-99201\" purpose=\"standard\" operation=\"new\" invoiceDate=\"2026-11-25T11:00:00Z\"/><InvoiceDetailOrder><InvoiceDetailOrderInfo><OrderReference orderID=\"PO-2026-88410\"/></InvoiceDetailOrderInfo><InvoiceDetailItem invoiceLineNumber=\"1\" quantity=\"10\"><UnitOfMeasure>EA</UnitOfMeasure><UnitPrice><Money currency=\"USD\">125.00</Money></UnitPrice><InvoiceDetailItemReference lineNumber=\"10\"><ItemID><SupplierPartID>VLV-SS316-2IN</SupplierPartID></ItemID><Description xml:lang=\"en\">2-Inch Stainless Ball Valve</Description></InvoiceDetailItemReference><SubtotalAmount><Money currency=\"USD\">1250.00</Money></SubtotalAmount></InvoiceDetailItem></InvoiceDetailOrder><InvoiceDetailSummary><SubtotalAmount><Money currency=\"USD\">1250.00</Money></SubtotalAmount><Tax><Money currency=\"USD\">103.13</Money><Description xml:lang=\"en\">Sales Tax</Description></Tax><ShippingAmount><Money currency=\"USD\">25.00</Money></ShippingAmount><GrossAmount><Money currency=\"USD\">1378.13</Money></GrossAmount><NetAmount><Money currency=\"USD\">1378.13</Money></NetAmount><DueAmount><Money currency=\"USD\">1378.13</Money></DueAmount></InvoiceDetailSummary></InvoiceDetailRequest></Request></cXML>"
  ],
  "invoice_json_payloads": [],
  "strict_math_audit": true,
  "mask_contact_pii": true,
  "max_items": 25
}
```

## Output

```json
{
  "document_type": {
    "label": "Doc Type",
    "format": "string"
  },
  "document_id": {
    "label": "Document / PO / Invoice ID",
    "format": "string"
  },
  "related_order_id": {
    "label": "Ref PO ID",
    "format": "string"
  },
  "from_identity": {
    "label": "From (ANID/DUNS)",
    "format": "string"
  },
  "to_identity": {
    "label": "To (ANID/DUNS)",
    "format": "string"
  },
  "currency": {
    "label": "CCY",
    "format": "string"
  },
  "subtotal_amount": {
    "label": "Subtotal",
    "format": "string"
  },
  "tax_amount": {
    "label": "Tax",
    "format": "string"
  },
  "total_or_due_amount": {
    "label": "Total / Due",
    "format": "string"
  },
  "line_count": {
    "label": "Lines",
    "format": "integer"
  },
  "is_valid": {
    "label": "Valid",
    "format": "boolean"
  },
  "math_reconciled": {
    "label": "Math OK",
    "format": "boolean"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The cXML SAP Ariba & Coupa Order, ASN & Invoice JSON Bridge Actor is ready to run with the inputs already set for "Audit Coupa & SAP Ariba cXML Invoices for Tax & Math Errors". [Sign up or log in](https://console.apify.com/create-task-from-example/gBf2cfJFt42E9EEox) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Audit Coupa & SAP Ariba cXML Invoices for Tax & Math Errors" task

The cXML SAP Ariba & Coupa Order, ASN & Invoice JSON Bridge Actor will start running based on the input automatically. You can also change all the input fields, like operation mode, raw cxml xml documents, and more, to match your specific use case.

### 3. Receive the "Audit Coupa & SAP Ariba cXML Invoices for Tax & Math Errors" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as doc type, document / po / invoice id, ref po id, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Audit Coupa & SAP Ariba cXML Invoices for Tax & Math Errors" task via API](https://apify.com/bifrost-data/cxml-ariba-coupa-procurement-bridge.md).

## FAQ

### Why do SAP Ariba Network and Coupa auto-reject supplier cXML invoices?

Portal business rules reject invoices whenever line-item extended subtotals plus Tax and Shipping differ by even $0.01 from GrossAmount, NetAmount, or DueAmount.

### What fields are returned when a math discrepancy is detected?

math_reconciled and is_valid flip to false, and validation_findings lists the exact expected vs declared Decimal figures.

### Can AP teams batch-audit hundreds of cXML invoices in a single call?

Yes. Pass up to 5,000 cXML documents in cxml_documents per run in 256MB RAM.

## About this Actor

This example demonstrates how to use [cXML SAP Ariba & Coupa Order, ASN & Invoice JSON Bridge](https://apify.com/bifrost-data/cxml-ariba-coupa-procurement-bridge.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/bifrost-data/cxml-ariba-coupa-procurement-bridge.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/bifrost-data/cxml-ariba-coupa-procurement-bridge.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
