RetryGuard AI — AI-Powered Payment Investigation and Reconciliation

Inspiration

Payment systems can become difficult to debug when a payment gateway and an application's internal database report different payment statuses.

For example:

  • PayPal reports that a payment has been approved, but the application still shows it as pending.
  • A webhook arrives late or is missing.
  • The application and payment provider have conflicting payment evidence.
  • Developers need to investigate payment incidents without accidentally triggering another payment operation.

I wanted to build a system that helps developers investigate these payment incidents, understand the available evidence, and make safer decisions.

What it does

RetryGuard AI is an AI-assisted payment investigation and reconciliation console built around PayPal Sandbox.

Its key capabilities include:

  • Payment Autopsy: Investigates payment attempts and identifies inconsistencies in payment evidence.
  • AI Agent Workflow: Uses Groq-powered function calling to investigate payment incidents through a controlled set of diagnostic tools.
  • Evidence-Based Recommendations: Produces recommendations such as WAIT or RECONCILE based on available evidence.
  • Payment Timeline: Displays payment activity, attempts, and webhook events.
  • PayPal Sandbox Integration: Supports creating and capturing sandbox payments.
  • Safety Controls: The AI agent is advisory and read-only. It cannot independently capture, refund, retry, or modify payment states. Payment state changes remain under deterministic Java services.

How I built it

I built RetryGuard AI using Java 21 and Spring Boot, with PostgreSQL for persistent storage.

The backend integrates with PayPal Sandbox for payment operations and webhook processing. The AI investigation workflow uses Groq Chat Completions with OpenAI-compatible function calling.

The dashboard is built using HTML, CSS, and JavaScript. It provides visibility into orders, payment attempts, investigation results, and agent workflow execution.

The application uses a controlled diagnostic workflow so that AI recommendations do not directly execute financial operations.

Challenges I faced

Some of the main challenges were:

  • Integrating PayPal Sandbox payment creation and capture.
  • Understanding payment approval versus actual payment capture.
  • Handling webhook events and payment-state inconsistencies.
  • Implementing security controls around payment endpoints.
  • Designing a bounded AI tool-calling workflow.
  • Preventing AI-generated recommendations from directly changing payment states.
  • Debugging incomplete provider evidence and unsuccessful AI responses.

These challenges helped me understand why payment systems need reliable evidence, deterministic state management, and carefully controlled AI integration.

What I learned

Through this project, I gained practical experience with PayPal Sandbox integration, Spring Boot backend development, PostgreSQL, webhook handling, application security, and AI function calling.

Most importantly, I learned that AI should assist with payment investigation and decision support, while actual financial operations should remain controlled by trusted backend services.

Technology Stack

Java 21, Spring Boot, Spring Security, Spring Data JPA, PostgreSQL, PayPal Sandbox, Groq AI, HTML, CSS, JavaScript, Maven.

Project Status

RetryGuard AI is a hackathon prototype running locally with PayPal Sandbox. It is not a production payment platform or publicly deployed service.

Built With

Share this project:

Updates

Submission history