Inspiration## Inspiration
Digital payments have made transactions faster and easier, but users can still face risks when sending money to unintended recipients or responding to suspicious payment requests.
We wanted to explore how AI could provide an additional layer of protection before a user approves a payment.
This inspired us to build PayPal Trust & InstantPay AI, a prototype that combines recipient verification, transaction risk assessment and AI-powered payment message analysis.
What it does
Our application helps users understand payment risks before proceeding with a transaction.
Key features include:
- PayPal Sandbox Integration: Creates checkout orders and retrieves actual PayPal payee information using OAuth 2.0.
- Recipient Verification: Compares the intended recipient's email with the actual PayPal payee email and identifies mismatches.
- Transaction Risk Assessment: Uses a Java-based rules engine to evaluate recipient mismatch, suspicious keywords, transaction amount and recipient familiarity.
- AI-Powered Analysis: Uses the pretrained Gemma 3 1B model through Ollama to analyse payment messages and identify potentially suspicious language.
- Approval Protection: Enforces backend verification and approval checks before allowing the application to proceed towards payment capture.
How we built it
We developed the frontend using React and Vite, with a Java 17 Spring Boot backend.
The backend integrates with the PayPal REST API Sandbox using OAuth 2.0 to create orders and retrieve payee information.
A Java-based risk assessment engine evaluates transaction characteristics and generates a risk score with a recommendation.
To introduce contextual AI analysis, we integrated the pretrained Gemma 3 1B model using Ollama, running locally on our development machine.
The frontend communicates with the backend through REST APIs and presents recipient verification results, risk classifications and AI-generated analysis.
Challenges we faced
One of the main challenges was retrieving and validating the actual PayPal payee information rather than relying only on the recipient details entered by the user.
We also worked on enforcing backend approval controls so that a recipient mismatch or high-risk assessment could prevent the application-level approval workflow.
Another challenge was integrating a locally running AI model with the Spring Boot backend and displaying its analysis in the React interface.
What we learned
Through this project, we gained practical experience integrating PayPal Sandbox APIs, implementing OAuth 2.0 authentication, developing backend risk assessment logic and integrating a pretrained local AI model.
We also learned that AI should complement deterministic verification and backend security controls rather than replace them.
What's next
Future enhancements include persistent transaction history, more advanced risk intelligence, enhanced recipient verification capabilities and improved integration with eligible PayPal platform services.
Our vision: Verify the recipient. Understand the risk. Then approve the payment.