Inspiration

What it does

Inspiration

A successful payment does not guarantee a successful merchant integration. PayPal can capture a payment and deliver a genuine webhook while downstream merchant code still fails to connect that capture to its order.

We built PayPal Integration Doctor to help developers investigate that gap without giving an AI authority to approve payments, weaken verification, or deploy code.

What it does

PayPal Integration Doctor demonstrates a complete, Sandbox-only workflow:

  1. A human buyer approves a fixed USD 1.00 PayPal Sandbox order.
  2. The trusted server captures it and receives a genuine webhook.
  3. PayPal's postback verification API verifies that webhook before its evidence can unlock diagnosis.
  4. A bundled merchant adapter fails to correlate the capture with its order.
  5. Live NVIDIA Nemotron proposes a narrowly scoped repair and regression test.
  6. Network-isolated Docker checks reproduction, repair, protected baselines, and a separately authored acceptance contract.
  7. A human reviews the exact proposal and authorizes isolated replay, restoring downstream order correlation.

Sandbox funds are simulated. Replay does not make another payment, capture again, or deploy the proposed patch.

How we built it

The application uses Python, FastAPI, Pydantic, httpx, SQLite, and a focused JavaScript dashboard.

PayPal's JavaScript SDK handles buyer approval. Server-side Orders API calls create and capture the fixed-price Sandbox order. A separate webhook-only listener receives genuine events and verifies them through PayPal's signature-verification API.

SQLite persists checkout state, idempotency keys, verified receipts, and repair snapshots. Transactional updates and owner-token leases protect recovery and concurrent operations.

Live diagnosis and patch generation use nvidia/nemotron-3.5-super-vl-120b-a12b through NVIDIA's OpenAI-compatible developer endpoint. The AI receives public bundled source, protected baseline context, and synthetic aliased evidence—not raw webhook bodies, payer information, signatures, or credentials.

The proposal can change only the bundled adapter and add an allowed regression test. Generated code executes inside Docker with networking and host fallback disabled. Human review binds to the proposal, sample, evidence, and harness hashes.

What makes verification meaningful

A plausible patch is not enough:

  • The new regression must fail on original code and pass on repaired code.
  • Existing baseline tests must remain green.
  • Git Guard must accept the proposal without protected-file edits.
  • A separate, non-editable acceptance contract must reject the original adapter and accept the repair.
  • Human approval is required before isolated replay.

The adapter defect is deliberately seeded in the bundled sample. The payment, delivered verified webhook, live model calls, and Docker executions are genuine.

Challenges and what we learned

The hardest challenge was distinguishing convincing output from trustworthy evidence. Early proposals could appear reasonable while failing the independent event contract or breaking existing behavior. Keeping those checks separate prevented unsuccessful attempts from becoming approved repairs.

We also learned that payment timeouts require reconciliation rather than blind retries, that webhook receipt persistence must be atomic with trusted state transitions, and that stale workers must not overwrite newer results.

Provider access was another practical challenge. Earlier Nebius requests failed with HTTP 402, and earlier NVIDIA Lightning attempts timed out or failed validation. Those attempts remained unsuccessful. The accepted runs used NVIDIA's larger Nemotron model with actual inference.

Accomplishments

We completed genuine Sandbox checkout, postback-verified webhook delivery, live AI repair, independent Docker verification, human review, and successful isolated replay.

A second fresh end-to-end execution was recorded for the demonstration. Private buyer login is excluded; omitted waits and accelerated footage are disclosed.

The full local suite recorded 393 passed and 3 skipped with Docker and Chromium enabled. Separate genuine PayPal/AI checks passed, and a clean installation passed focused backend, Docker, and browser validation. These are local results, not a general AI repair success-rate claim.

Project history

The PayPal Doctor extends AeroCode's earlier ProofLoop foundation for bounded repair orchestration and protected test verification. The repository history begins in late October 2026; the Doctor was added afterward. We do not claim that every part of the underlying engine was written specifically for this integration.

What's next

Improve safe diagnostics and provider reliability while preserving the deliberately narrow scope: Sandbox-only payments, a bundled adapter, independent verification, human review, and no automatic deployment.

Try it locally

The public repository includes an Apache-2.0 license, complete local judge setup, and sanitized acceptance evidence:

Built With

Share this project:

Updates

Submission history