PayPath — Payment Reliability, AI Diagnostics & Verified Repair

The Problem

Payment integrations are often tested on the happy path, but real integrations must also handle timeouts, issuer declines, duplicate webhook deliveries, uncertain capture outcomes and inconsistent application state.

A timeout does not necessarily mean a payment failed. Retrying blindly can create unsafe repeated operations, while trusting stale local state can lead to incorrect recovery decisions. Developers need a way to reproduce these failures, understand what happened, and test a correction before accepting it.

The Solution

PayPath is a developer-focused reliability workbench for PayPal Orders v2 Sandbox integrations. It combines deterministic payment-safety checks, fault-injection scenarios, evidence-grounded diagnostics and an isolated candidate-repair workflow.

Instead of treating an error message as the entire diagnosis, PayPath connects payment events and invariant violations to an execution trace. It helps developers investigate the failure, evaluate a proposed correction and verify the candidate against regression tests before human review.

Key Features

  • Deterministic Safety Invariants: Evaluates payment operations against 10 explicit safety invariants.
  • Fault-Injection Scenario Lab: Reproduces checkout failures such as instrument declines and gateway timeouts.
  • Idempotency and State Reconciliation: Tests safe handling of repeated operations and uncertain payment outcomes using authoritative state.
  • AI-Assisted Diagnostic Studio: Uses structured Gemini diagnostic output grounded in execution evidence, with a deterministic rule-engine fallback when AI inference is unavailable.
  • Correlated Execution Flow Graph: Visualizes related lifecycle events and traces to support investigation.
  • Isolated Repair Workflow: Creates a candidate patch in an isolated Git worktree and runs regression verification where the required local tooling is available.
  • Human Review Boundary: Presents the proposed changes for operator review instead of automatically merging or pushing them.
  • Webhook Simulation and Deduplication: Tests webhook handling, duplicate-event behaviour and signature-validation paths.
  • Sanitized Incident Evidence: Produces diagnostic evidence while masking sensitive credentials and payment-related data.

How We Built It

PayPath uses Next.js, React, TypeScript and Tailwind CSS for the application interface, with the PayPal Orders v2 Sandbox API for payment integration testing.

Its diagnostic architecture combines deterministic safety rules with structured Gemini-based analysis. The deterministic engine provides a fallback path when AI inference is unavailable. Correlated execution data supports diagnosis and incident inspection.

The repair workflow isolates candidate changes in a Git worktree, runs regression checks and presents the result for human review. It is a candidate-generation and verification workflow—not an unrestricted agent that automatically merges or deploys code.

Vitest is used for automated testing of invariants, scenarios, diagnostics, sanitization and repair behaviour.

Challenges and Learnings

One of the core challenges is distinguishing a failed request from the actual payment outcome. A network error alone may not establish whether a capture succeeded, so reconciliation and idempotency matter.

Another challenge is making AI-assisted diagnosis verifiable. PayPath combines model-generated explanations with execution evidence, deterministic checks and an explicit fallback path. Separating candidate repair from human approval also helps keep code changes reviewable and testable.

Scope and Safety

PayPath is a developer testing and diagnostic tool, not a production payment processor. Demonstrated payment operations use the PayPal Sandbox.

The autonomous repair workflow requires Git worktree support and test tooling. In environments where those capabilities are unavailable, repair execution is blocked rather than falsely reported as successful. Candidate changes require human review; PayPath does not automatically push or merge them.

The repository's setup and testing instructions explain how to run the application and evaluate its supported workflows.

Built With

Share this project:

Updates

Submission history