Inspiration

I am Dinesh, a small farmer from Sri Lanka and a beginner in programming. Everyday shopping requires careful decisions about prices, quantities, and the money available.

I built SmartCart AI to explore a simple question: can AI help someone plan shopping within a budget while keeping every purchase under that person’s control?

What it does

SmartCart AI is a working local shopping prototype with AI planning and PayPal Sandbox payments.

  • Shoppers enter a budget and describe their needs.
  • Gemini AI suggests products from the seller’s current catalogue.
  • The application validates product IDs, quantities, availability, and integer-cent totals.
  • Shoppers review the suggestion and explicitly choose whether to replace their basket.
  • Sellers can add products and update sample prices through a password-protected interface.
  • The interface offers 21 language options.
  • Manual shopping and the basic spending summary remain available when AI is unavailable.

In the demonstrated example, two packs of Fresh carrots at USD 2.37 each cost USD 4.74, leaving USD 20.26 from a USD 25 budget.

How PayPal and AI work together

AI helps prepare the shopping decision. PayPal handles the separate test-payment flow.

The backend uses PayPal Sandbox authentication and the Orders API to create an order, retrieve its status, and capture an approved payment after explicit user confirmation.

The checkout preserves the reviewed product names, quantities, and prices. Payment completion is displayed only after the backend validates the returned payment details. A failed or uncertain provider response is not presented as a successful payment.

AI cannot authorize a purchase or initiate payment approval on the user’s behalf.

All payments use PayPal Sandbox. No real money is used, and the sample products are not offered for delivery.

How I built it

The frontend uses React, Vite, JavaScript, and CSS. The backend uses Node.js and Express, with SQLite for the seller catalogue and checkout records. Gemini provides AI shopping suggestions. Zod and application validation check requests and responses.

Credentials remain in ignored local environment files and are not included in the browser build or public repository.

I used ChatGPT for development assistance, explanations, code, and testing guidance. I ran and reviewed the project on my Mac and tested the actual AI and Sandbox flows.

The project runs locally. The repository includes setup instructions. Manual shopping can be explored without AI or PayPal credentials; those integrations require the reviewer’s own private configuration.

Challenges I faced

The main challenges were keeping AI suggestions consistent with changing seller prices, distinguishing similarly named products, and handling payment uncertainty.

I added product-reference checks, server-side calculations, saved checkout details, and separate payment states. I also corrected test fixtures that accidentally depended on the active development configuration.

Accomplishments

On my development Mac, 503 automated Node tests passed. Browser mock suites covered 154 distinct cases.

Actual Sandbox checks included a completed USD 4.74 payment, cancellation, and verification after a backend restart.

A provider-simulated Sandbox API error was also tested. The application showed an unconfirmed payment state rather than claiming payment success. This was an API-error test, not a real bank decline.

What I learned

I learned to separate AI suggestions from trusted calculations and payment authorization. I also learned how to protect credentials, preserve checkout records, and distinguish browser mocks from actual provider tests.

What’s next

I want to connect saved shopping lists to the editable catalogue, improve product-name translations, and gather feedback from people who shop with a limited budget.

The current version is a local demonstration with sample USD prices and Sandbox payments, rather than a live retail service.

Built With

Share this project:

Updates

Submission history