Inspiration

Small cafes, bakeries and salons know their regulars by face, not by data. Most run no loyalty program at all: 73% of US micro and small businesses have none (SumUp survey of 617 owners, Nov 2025). Paper punch cards get lost, and loyalty apps ask customers to sign up for something they will never open. Meanwhile 68% of US adults prefer cash back to points (PayPal and Reach3 survey of 1,068 adults, Jul 2025).

Their regulars already pay with PayPal and Venmo. We asked: what if that payment was the punch card, and the reward went straight back to the same wallet?

What it does

For customers: scan the counter sign, pay with PayPal or Venmo, and see your progress ("Visit 4 of 5"). On the qualifying visit, Kickback refunds part of that same payment (at our demo cafe, Rosa's: $2 on every 5th visit), with a thank-you note PayPal keeps on the refund. No app, no account, no sign-up.

For the owner:

  • Connect PayPal through Partner Referrals; Kickback reads up to 90 days of sales with Transaction Search.
  • Design the program with AI. The owner types a goal and a budget. Claude proposes three programs, a deterministic simulator replays the shop's own sales history under each (monthly cost, reach, time to first reward, break-even lift), and nothing goes live until the owner activates it.
  • Guard scores every reward in code: merged split payments, bursts of visits, outsized tickets or earlier clawbacks raise the score. Routine rewards go out instantly; unusual ones wait 24 hours or for the owner's review, with a plain-words explanation from Claude whose numbers are checked against Guard's data. Code decides; AI only explains.
  • Cockpit built on AG Studio: KPIs, a reward funnel, a customer ledger and an Analyst, a custom Claude agent inside AG Studio that answers from the business's data through scoped read-only tools and can arrange charts on the dashboard. It can never move money.

Try it now (PayPal sandbox, no real money): https://kickback-web.onrender.com/demo. Watch a real reward happen in seconds, pay as a customer with a published test buyer, or explore the merchant app read-only (including a reward Guard is holding for review).

How we built it

PayPal: every money movement is a real sandbox API call.

  • JavaScript SDK v6 (PayPal and Venmo buttons): customer checkout on the pay page.
  • Orders v2: create and capture each payment. The payer's wallet on the order becomes a merchant-specific HMAC key; no names, emails or PayPal account IDs are stored.
  • Payments v2 refunds: each reward is a partial refund of the qualifying capture, with note_to_payer and a persisted PayPal-Request-Id, so a retry can never pay twice.
  • Webhooks with signature verification: captures, refunds, reversals and disputes update visits and rewards; disputes freeze eligibility, returns cancel or offset rewards.
  • Partner Referrals v2 and PayPal-Auth-Assertion: merchant consent; API calls run on the merchant's behalf.
  • Transaction Search: imports history for backtests and reconciliation.
  • Vault v3 setup tokens: saved sandbox wallets for the demo customers behind "Watch a reward happen".
  • Server SDK (@paypal/paypal-server-sdk): order lookup, built with the APIMatic PayPal Context Plugin.

AI (Claude, claude-opus-5-5): always checked in code, never trusted to move money.

  • Program Designer: structured outputs propose three diverse rules; our deterministic reward engine backtests them; Claude explains the computed results, and every number in the explanation must match a computed figure or the text is regenerated or replaced with a template.
  • Scribe: thank-you notes, terms introduction and sign pitch, validated for business name, milestone, length and allowed numbers.
  • Guard explanations: plain-words reasons for held rewards; the score itself is deterministic, and any number Claude quotes must come from Guard's data.
  • Analyst: a custom agent in AG Studio's Agent Framework through our Claude adapter, with five scoped tools (program metrics, risk flags, customer progress, rule simulation, design proposals), per-business quotas and usage logging.

AG Studio / AG Grid: the Cockpit, with custom widgets (Reward Funnel, Customer Ledger), our theme, saved per-business layouts, Loyalty and Risk pages, and the Analyst working alongside Studio's built-in agents.

Render: Next.js web service, Postgres, a five-minute cron for jobs, and Render Workflows for the nightly reconciliation fan-out. A public status page and a daily end-to-end check (a real sandbox payment to a confirmed refund) keep the demo honest.

Stack: Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS v4, Drizzle ORM, Better Auth, Zod, Vitest (522 tests, including PGlite-backed ledger tests), and a Postman collection with published API docs.

Challenges we ran into

  • Who paid? Webhooks don't carry a stable payer identity; the order does. We key customers off the order's wallet, hashed per merchant, so a regular is recognized without storing who they are.
  • Paying exactly once. Rewards are committed to the database before any refund attempt, each with a persisted request ID; a worker recovers interrupted sends, and webhook replays are idempotent.
  • Honest demos. A demo customer must be at visit 4 of 5 without faking timestamps. We record real sandbox purchases on earlier days, label them as replay history, and keep a pool of customers ready so anyone can watch a reward happen.
  • Sandbox limits. PayPal sandbox rate-limits per IP, so the client paces requests per service with priority lanes and backs off after a 429.
  • AI with arithmetic. Language models are bad at numbers, so the numbers never come from the model: the simulator computes them and a checker rejects any explanation that invents one.

Accomplishments that we're proud of

  • A real end-to-end loop: payment, visit, Guard, partial refund, webhook confirmation, usually in under 10 seconds in sandbox.
  • No customer account, app or personal data: just the wallet the customer already uses.
  • AI that designs and explains, with code deciding every money movement.
  • A live demo anyone can use without signing up, plus a status page and a daily automated end-to-end check.

What we learned

  • A partial refund of the qualifying payment is a natural loyalty rail: it returns to the same wallet, carries a note, and settles through webhooks.
  • Grounding Claude in a deterministic simulator makes its proposals trustworthy and easy to explain.
  • AG Studio's agent framework let our own Claude agent and Studio's agents share one dashboard.

What's next for Kickback

  • Live partner approval and a pilot with a few neighborhood shops.
  • Payouts as a second reward rail, and more spend-based programs.
  • Measuring actual lift with merchants who agree to a holdout.

Try it

  1. Watch a reward happen (no sign-in): https://kickback-web.onrender.com/demo, then Start a live run.
  2. Pay as a customer: on the same page, Get a demo buyer (a published PayPal sandbox login, held for you for 30 minutes), open Rosa's Cafe and pay for any item from $3 with PayPal. Your payment is the buyer's fifth visit.
  3. Explore the merchant app read-only: Explore read-only, then Overview, Rewards (one reward is waiting for review), Customers, Program and Cockpit; ask the Analyst a question.
  4. Status: https://kickback-web.onrender.com/status
  5. Run it locally: https://github.com/varunbhandarii/kickback#run-locally

Everything runs in PayPal sandbox with test balances.

Built With

  • ag-grid
  • ag-studio
  • anthropic
  • apimatic
  • better-auth
  • claude
  • drizzle-orm
  • next.js
  • partner-referrals
  • paypal
  • paypal-js-sdk
  • paypal-rest-api
  • postgresql
  • postman
  • react
  • render
  • render-workflows
  • tailwindcss
  • transaction-search
  • typescript
  • venmo
  • vitest
  • zod
Share this project:

Updates

Submission history