Inspiration
Digital merchants and SaaS enterprises face a dual financial vulnerability whenever a customer initiates a payment dispute. On high-value orders, businesses suffer severe revenue leakage from friendly fraud—where buyers claim an item was not received or a transaction was unauthorized despite verified carrier delivery and active account usage. For most finance teams, manually aggregating server logs, shipping proofs, and transaction records within strict SLA windows is operationally unscalable.
Simultaneously, micro-transactions present an asymmetric fee trap. Contesting a $14.00 duplicate-charge claim carries a standard $15.00 dispute fee, exposing the merchant to a $29.00 downside risk to protect a $14.00 sale. We built PayShield AI to bring autonomous, expected-value financial governance to the PayPal ecosystem, protecting merchant revenue while eliminating unnecessary dispute fees.
What it does
PayShield AI is an autonomous dispute defense and revenue triage platform that connects directly to the PayPal Sandbox environment[cite: 9].
- Live PayPal Sandbox Synchronization: Authenticates via PayPal OAuth 2.0 (
/v1/oauth2/token), creates and inspects live merchant transactions through the Orders v2 API (/v2/checkout/orders), and monitors active claims via the Customer Disputes v1 API (/v1/customer/disputes). - Expected-Value Fee-Waiver Triage: Evaluates incoming claims against a $25.00 economic threshold[cite: 9]. When contesting a micro-dispute would cost more in dispute fees than the transaction value itself, the engine automatically routes the claim to
POST /v1/customer/disputes/{id}/accept-claim, issuing an immediate refund and waiving the $15.00 dispute fee[cite: 9]. - Cryptographic PDF Evidence Dossier Generation: For high-value disputes exceeding $25.00, the system cross-references carrier delivery signatures alongside IP and device session telemetry. It dynamically compiles a standardized PDF-1.4 legal evidence packet and prepares the payload for
POST /v1/customer/disputes/{id}/provide-evidence. - AG Grid & AG Studio Financial Command Center: Consolidates all live PayPal Sandbox telemetry into a unified, dark-mode financial matrix featuring real-time KPI reconciliation, custom status indicators, and instant AI triage lenses[cite: 9].
How we built it
We engineered PayShield AI around a zero-dependency Node.js runtime deployed on Render, ensuring sub-second response times and deterministic reliability.
On the integration layer, we connected directly to the PayPal Developer Platform using OAuth 2.0 client credentials to drive real-time order creation and verification. To prevent schema drift or malformed agentic API requests, we embedded an APIMatic MCP context registry that enforces strict OpenAPI 3.0 validation across every operation ID (ordersCreate, disputesProvideEvidence, and disputesAcceptClaim) prior to execution[cite: 9].
For the executive interface, we implemented AG Grid (ag-theme-quartz-dark) paired with AG Studio AI lenses, allowing treasury and operations teams to filter high-value defense cases, fee-waiver auto-refunds, and resolved claims instantaneously[cite: 9]. Rather than relying on heavy third-party binary dependencies for document generation, we wrote a native binary PDF-1.4 byte-stream compiler in Node.js that generates audit-ready evidence dossiers on demand[cite: 9].
Challenges we ran into
Our primary architectural challenge was ensuring that every single record displayed in the financial grid corresponded to a genuine, verifiable 17-character PayPal Sandbox Order ID[cite: 9] while maintaining instant response times during live cloud demonstrations. Additionally, generating properly formatted, multi-field legal PDF evidence files in a lightweight cloud container without external system libraries required constructing the PDF-1.4 object tree, cross-reference tables, and byte offsets natively in JavaScript.
What we learned
Building financial automation requires pairing generative reasoning with strict deterministic guardrails. By combining expected-value mathematical thresholds with APIMatic OpenAPI 3.0 schema validation[cite: 9], we ensured that our autonomous engine never hallucinates an API payload or makes an economically irrational dispute decision.
What's next for PayShield AI
Our next milestone is transitioning from on-demand synchronization to an event-driven architecture using live PayPal Webhook listeners (CUSTOMER.DISPUTE.CREATED), paired with direct carrier webhook integrations from FedEx, DHL, and UPS for zero-touch autonomous chargeback resolution at enterprise scale.
Built With
- ag-grid
- apimatic
- javascript
- node.js
- openapi
- paypal
- render
- rest-api