> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mercoa.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mercoa.com/_mcp/server.

# Validation Workflow

> Learn how the vendor card agent validates invoices and determines payment modalities

# Validation Workflow

The vendor card agent uses a sophisticated validation workflow to process invoices and determine the best payment approach for each vendor. This process ensures accurate payment processing while minimizing manual intervention.

## Overview

The validation workflow follows a systematic approach to extract invoice data, identify payment methods, and determine vendor payment capabilities. This process is crucial for successful card payment processing.

## Validation Process

```mermaid
flowchart TD
    A[Extract data from invoice] --> B{Is there a payment link?}
    
    B -->|Yes| C[Navigate to payment link]
    C --> D[Extract amounts and fees]
    D --> E[Process payment via link]
    
    B -->|No| F{Does vendor exist in Mercoa database?}
    
    F -->|Yes| G[Use existing vendor data]
    G --> H[Determine payment modality]
    
    F -->|No| I[Search for vendor online]
    I --> J{Vendor found online?}
    
    J -->|Yes| K[Agent determines payment modality]
    K --> L{Payment modality}
    L -->|Phone| M[Phone payment]
    L -->|Gateway| N[Payment gateway]
    L -->|Account| O[Account-based payment]
    L -->|Does not accept| P[Mark as non-card-accepting]
    
    J -->|No| Q[Mark vendor as unknown]
    
    H --> R[Process payment based on modality]
    M --> R
    N --> R
    O --> R
    P --> S[Use alternative payment method]
    Q --> S
```

## Step-by-Step Breakdown

### 1. Extract Data from Invoice

The agent begins by parsing the invoice document to extract key information including:

* Vendor name and contact details
* Invoice amounts and line items
* Payment terms and due dates
* Any embedded payment links or instructions

### 2. Payment Link Detection

If a payment link is present on the invoice:

* The agent navigates to the provided URL
* Extracts payment amounts and any associated fees
* Processes the payment directly through the vendor's payment system

### 3. Vendor Database Lookup

When no payment link is available, the agent checks if the vendor already exists in the Mercoa database:

* Searches for vendor by name, website, or other identifiers
* Retrieves existing payment modality information
* Uses stored vendor preferences and capabilities

### 4. Online Vendor Search

For vendors not in the database, the agent performs an online search:

* Searches business directories and websites
* Analyzes vendor websites for payment information
* Identifies available payment methods and modalities
* If a phone number is available, the agent can call the vendor directly to inquire about payment acceptance

### 5. Payment Modality Determination

Based on the search results, the agent categorizes vendors into payment modalities:

* **Phone Payment**: Vendor accepts payments over the phone
* **Payment Gateway**: Vendor has an online payment system
* **Account-based**: Vendor requires account setup or ACH
* **Does Not Accept**: Vendor doesn't accept card payments

## Benefits

This validation workflow provides several advantages:

* **Automated Processing**: Reduces manual vendor research and setup
* **Payment Optimization**: Identifies the most efficient payment method for each vendor
* **Error Reduction**: Minimizes payment failures through proper validation
* **Scalability**: Handles large volumes of invoices efficiently
* **Compliance**: Ensures proper payment processing according to vendor requirements

## Next Steps

After validation, the agent proceeds to [process the payment](/virtual-card-agent/process-payment) using the determined modality. For vendors that don't accept cards, the system can fall back to [ACH payments](/virtual-card-agent/ach-fallback) or other alternative methods.