GuidesAPI Reference
Guides

Evidence-as-a-Service

API-Based AI Evidence Generation for platforms

TL;DR

Evidence-as-a-Service (EaaS) transforms messy dispute data into a polished, bank‑ready PDF evidence package in about 30 seconds (up to ~3 minutes). The platform (or PSP) provides dispute details and supporting materials; we enrich, validate, and assemble a consistent letter designed to refute the claim. Once ready, we notify you and provide a secure download link for the PDF.


Getting Started

Interested in Evidence-as-a-Service? Get a demo today!

To begin, accept your invitation to Chargeflow Connect, ensure your account is opted into the Evidence‑as‑a‑Service product, generate production and test API keys, and subscribe to relevant webhooks to track the evidence lifecycle.

  • Chargeflow Connect account: You and your team will receive an invitation to your platform account from Chargeflow.
  • EaaS opt‑in: Your account manager must enable EaaS on your Chargeflow Connect account before you can execute EaaS API calls.
  • Generate API keys: After accepting the invitation, navigate to the Developer Hub and generate your production and test keys.
  • Register webhooks: Subscribe to evidence.ready and evidence.error webhooks to stay informed about evidence generation status.

Entitlement (Opt‑in) Gating

EaaS access is enabled per platform by the platform’s account manager. Without this entitlement, EaaS API calls return a 403_eaas_not_enabled error.

Who this is for

EaaS is designed for B2B platforms and PSPs.

  • Merchants don’t integrate directly with EaaS but can automate disputes through the Chargeflow platform by connecting their payment providers.
  • Platforms can integrate EaaS by exposing a “Generate Evidence” action in their merchant portal or triggering it seamlessly behind the scenes.

What Evidence‑as‑a‑Service (EaaS) Does

EaaS is powered by an AI agent that automates analysis, enrichment, and drafting of dispute evidence at scale via a single API endpoint.

Key capabilities:

  • Works for all disputes at any stage, in any country, and any language.
  • Leverages dispute data, enrichments, and optional merchant context (e.g., policies, checkout steps, buyer verification).
  • Outputs a single, versioned PDF for bank submission.
  • Allows regeneration with version control to refine evidence as new data arrives.
  • Provides structured and unstructured access to enriched data via a single API call.

Why Platforms Choose EaaS

  • Efficiency: Eliminate ad‑hoc documents and manual copy‑paste.
  • Transparency: Access enriched data directly via API.
  • Impact: Achieve a ≥20% relative uplift compared to the historical win‑rate baseline, strengthening merchant trust and retention.

How It Works (End‑to‑End)

Step 1: Obtain Chargeflow Connect Account

Chargeflow invites you to your Connect account, where EaaS will be enabled. From there, you can generate API keys, register webhooks, and start testing.

Step 2: Generate API Keys and Subscribe to Webhooks

💡 Tip: Enable HMAC Signature Validation for stronger security.

Generate test and production API keys in the Developer Hub, then subscribe to these webhooks:

EventTriggerDescription
evidence.errorAn error occurs during evidence generation.Chargeflow retries automatically; final failure sends detailed error info in the webhook payload.
evidence.readyEvidence generation completed.A versioned PDF is ready for review and submission.

Mock Payloads

{
  "event": {
    "id": "evt_XXXXXXXXXXXXXXXX",
    "type": "evidence.ready",
    "created_at": "2025-07-29T12:34:56Z"
  },
  "evidence": {
    "id": "ev_abc123456789",
    "account_id": "acct_9876543210",
    "ext_account_id": "ext_acct_54321",
    "dispute": "dp_1122334455",
    "created_at": "2025-07-29T14:35:00Z",
    "status": "completed",
    "file_url": "https://cdn.chargeflow.io/evidence/ev_abc123456789/v2/evidence.pdf",
    "file_version": 1
  }
}
{
  "event": {
    "id": "evt_XXXXXXXXXXXXXXXX",
    "type": "evidence.error",
    "created_at": "2025-07-29T12:34:56Z"
  },
  "evidence": {
    "id": "ev_abc123456789",
    "account_id": "acct_9876543210",
    "ext_account_id": "ext_acct_54321",
    "dispute": "dp_1122334455",
    "created_at": "2025-07-29T14:35:00Z",
    "status": "error",
    "file_url": null,
    "file_version": 1
  },
  "error_code": "422_dispute_invalid_state",
  "error_message": "Dispute status must be needs_response"
}

Common Errors

Error CodeDescription
422_dispute_invalid_stateDispute must have status needs_response to generate evidence.
409_generation_in_progressEvidence generation already in progress; use idempotency-key to avoid duplicates.
404_*_not_foundDispute not found; verify dispute.id.
403_eaas_not_enabledAPI key not entitled to EaaS; contact account manager.
504_generation_timeoutOperation timed out; retry required.

Step 3: Create a Merchant Entity

For each merchant, create an entity using the Accounts API with minimal details:

  • Business Name (used in narrative).
  • Business URL (enriched with metadata).
  • Email Address (primary merchant contact).

Chargeflow enriches merchant profiles to align evidence strategies.

Step 4: Generate Evidence

There are two integration patterns:

  • Platform‑managed automation: Trigger evidence automatically when disputes appear.
  • Merchant self‑serve: Create disputes in Chargeflow and let merchants enrich details via your portal, using Chargeflow's Update Dispute API. Evidence generation is triggered by the platform.

The Generate Evidence API accepts either an existing dispute.id or a full inline dispute object, and returns the following response payload:

{
  "id": "ev_abc123456789",
  "account_id": "acct_9876543210",
  "ext_account_id": "ext_acct_54321",
  "dispute_id": "dp_1122334455",
  "created_at": "2025-07-29T14:35:00Z",
  "status": "in_progress",
  "file_url": null,
  "file_version": 1
}

It takes a few seconds (~30 seconds) for the AI Agent to generate the evidence; expect evidence.ready or evidence.error events.

Step 5: Regenerate Evidence

Evidence can be regenerated as long as disputes remain in needs_response. Each attempt increments file_version. Regeneration is recommended when new data becomes available.

Tip: More data = stronger narratives. Missing pieces won’t block generation; the system prioritizes impactful evidence.

Step 6: Report Dispute Outcomes

Share dispute outcomes (won/lost) when available. This data helps Chargeflow continuously refine strategies and improve win rates for merchants.

Privacy & Security

  • Short‑lived links: Evidence download links expire after 7 days; requesting again generates a fresh link.
  • Data minimization: Share only relevant data; the system selects impactful details.
  • Data residency: Regional storage supported as applicable.
  • Compliance: SOC2 Type 2 and GDPR compliant.
  • Notifications: Webhook alerts when PDFs are ready or errors occur.