Inspiration
Cross-border and online shoppers—particularly in emerging markets like Nigeria, Ghana, and Kenya—face a recurring dilemma: PayPal is their most trusted, chargeback-protected payment method, but thousands of independent merchants and regional e-commerce stores simply do not accept PayPal (they only take local or direct credit/debit cards).
Shoppers waste hours manually comparing prices across dozens of foreign websites, calculating volatile international shipping costs, and risk card fraud or refusal when attempting to use personal cards on unfamiliar foreign stores.
We asked: What if an autonomous AI shopping agent could search the web for the best price, calculate true landed delivery costs to the shopper's doorstep, and autonomously execute checkout on their behalf—while the shopper pays 100% safely through PayPal?
That vision is Cartwise.
What It Does
Cartwise is an autonomous AI commerce concierge available on both Web and Android:
- Natural Language Search: The shopper types or speaks what they need (e.g., "Find itel BudsFit 5 under $30 with shipping to Lagos" or "Redmi 15C 128GB").
- AI Intent & Multi-Store Deal Discovery: Powered by Google Gemini 3.8 Flash, Cartwise extracts structured constraints (brand, specs, budget, delivery location), queries live merchants (Jumia Nigeria, AliExpress, Amazon, and Demo Market), and retrieves direct product detail pages.
- Real Landed Cost & Incremental Shipping: Calculates real destination-tailored delivery methods (courier door delivery, pickup stations, air parcel) and dynamically scales incremental shipping with quantity.
- PayPal Escrow Authorization Hold (
intent=AUTHORIZE): The shopper approves the order with PayPal Orders v2. Funds are held in escrow, never charged upfront. - Autonomous Cloud Browser Agent (Kernel + Playwright): Cartwise boots an isolated cloud Chromium browser via Kernel. The user watches a real-time live browser stream as the agent navigates the store, selects variants, enters shipping details, and injects Cartwise's purchasing card into checkout.
- Double-Safety & Dual Outcomes:
- Happy Path: The merchant confirms order placement $\rightarrow$ Cartwise captures the PayPal authorization $\rightarrow$ Instant receipt with merchant order ID and PayPal capture ID.
- Failure / Out-of-Stock Guardrail: If an item sells out during checkout $\rightarrow$ Cartwise immediately voids the PayPal authorization $\rightarrow$ Held funds are instantly released and the buyer sees "You were not charged."
How We Built It
- PayPal Developer Platform (Orders v2 & Payments v2):
- Orders v2 with
intent=AUTHORIZEcreates the escrow hold for item price + destination shipping + $3.00 service fee. - Payments v2
POST /v2/payments/authorizations/{id}/captureexecutes payment once merchant confirmation is verified. - Payments v2
POST /v2/payments/authorizations/{id}/voidcancels the hold if checkout fails or inventory drops. - Real-time webhooks (
CHECKOUT.ORDER.APPROVED,PAYMENT.AUTHORIZATION.CREATED,PAYMENT.CAPTURE.COMPLETED).
- Orders v2 with
- Google Gemini 3.8 Flash (
@google/genai): Natural language intent parser, strict brand-fidelity filtering, and product image resolution. - Kernel Cloud Browser (
@onkernel/sdk) & Playwright: Isolated sandbox browser execution with live session viewport streaming. - Channel3 Multi-Store API: Powers real-time product discovery across hundreds of online retailers, fetching live merchant inventory, product varieties, and pricing with sub-second query latency.
- Mobile & Web Clients:
- Android Native App: Kotlin, Jetpack Compose, Material 3, OkHttp SSE timeline listener.
- Web Companion: Responsive, mobile-first companion with interactive PayPal Sandbox modal and live agent timeline.
- Backend: Node.js, Express, TypeScript, and ACID transaction logging.
Challenges We Ran Into
- Preserving Deep Links vs. Search Lists: Early iterations generated catalog search pages (
/catalog/?q=...). We re-architected URL sanitization so every deal opens the exact individual product detail page (.htmlon Jumia,/item/<id>.htmlon AliExpress,/dp/<asin>on Amazon). - State Preservation Across Cross-Origin PayPal Redirects: In web browsers, redirecting to PayPal Sandbox and returning wipes in-memory JavaScript state. We implemented server-persisted order models and session caching so the exact product image, selected variety, and courier option survive the redirect cleanly.
- Card Security Guardrail: Ensuring zero card credentials ever enter LLM contexts. All purchasing card credentials are held strictly in backend server environment variables and injected directly via DOM automation.
Accomplishments That We're Proud Of
- True End-to-End Autonomous Purchasing: Watching an AI browser agent add an item, fill out guest delivery details, and inject payment while keeping the buyer protected under PayPal escrow.
- Real Landed Cost Calculation: Dynamic courier fees specifically tailored to West Africa (Lagos, Nigeria) and global destinations.
- 100% Zero-Risk Shopper Protection: Verified void-on-failure guarantee ensuring funds are never captured unless order confirmation is secured.
What We Learned
- Integrating PayPal Orders v2
AUTHORIZEwith autonomous agents represents the future of agentic e-commerce: users don't have to trust third-party websites with their debit cards or trust agents with open-ended spending limits. - Structured DOM event streaming provides user confidence by turning an opaque automated process into an engaging, transparent live experience.
What's Next for Cartwise
- Multi-Merchant Cart Splitting: Purchasing bundles from 3 separate merchants under a single unified PayPal escrow hold.
- Automated Import Duty & Tariffs: Instant CIF calculations for West African, Latin American, and Southeast Asian cross-border shoppers.
- PayPal Agent Toolkit MCP Integration: Exposing Cartwise as a standard Model Context Protocol (MCP) skill for AI assistants.
Built With
- android
- channel3
- express.js
- google-gemini
- html5
- jetpack-compose
- kernel
- kotlin
- node.js
- paypal
- paypal-orders-v2
- paypal-payments-v2
- playwright
- rest-api
- tailwind-css
- typescript