Inspiration

Tradies quote on the back of a docket book, on the bonnet of the ute. Then the evening goes on typing it up, sending invoices and chasing deposits. Small trade businesses often wait weeks to be paid, and jobs start without a deposit because asking for one is awkward. Extras found on site ("the cable to the garage is chewed through") turn into arguments at the end. We wanted the whole loop, from the quote to the money in the bank, in the pocket of a one-person business.

What it does

Docket takes a job from quote to paid:

  1. Dictate the job on site, in plain words.
  2. AI drafts the quote from the tradie's own price book. It picks the items, estimates labour, and explains every quantity. It also lists what the price assumes, what's excluded, and what to confirm on site.
  3. Send via PayPal. One tap creates and sends a PayPal invoice with GST on every line and the deposit set as the minimum payment. The customer gets a link to their quote.
  4. The customer approves and pays the deposit with PayPal Checkout, either a PayPal wallet or a card. The quote is stamped DEPOSIT PAID and the payment is recorded on the PayPal invoice.
  5. Variations. Extra work found on site is described in a sentence. The AI prices it from the same book, and the customer approves it on their link, which creates a separate PayPal invoice.
  6. Job done. One tap, and PayPal sends the customer a balance reminder. They pay the balance (job plus variations) on the same link, split across the PayPal invoices, which then show as paid in PayPal.
  7. Ask Docket. An agent answers questions like "who still owes me?" by checking live PayPal invoice status. It drafts reminders and variations as proposals. Nothing reaches a customer until the tradie taps Confirm.

How we built it

  • PayPal:
    • REST APIs on the sandbox.
    • Invoicing v2 handles invoices: create, send, get, record payment and remind. Invoices carry GST per line and a minimum partial payment for the deposit.
    • Orders v2 creates and captures each payment. custom_id binds every order to its job and stage, and Docket checks it on capture.
    • The JavaScript SDK Buttons provide PayPal and card checkout in AUD.
  • AI:
    • The OpenAI Responses API with strict JSON schemas drafts quotes and variations.
    • The same API with function calling powers Ask Docket. Its tools are list_jobs, check_paypal, propose_reminder, propose_variation and propose_complete.
  • Guard rails:
    • The model chooses items and quantities. The server owns every price, GST calculation, rounding and the deposit, all in cents.
    • Lines not in the price book are blocked from sending until the tradie checks them.
    • The agent's action tools only create proposals.
    • Customer links are random 144-bit tokens. Cross-site requests are blocked.
    • A strict Content Security Policy allows only PayPal's SDK domains.
    • AI and PayPal calls are rate-limited.
  • App: plain Node.js 22 with no npm dependencies, plus vanilla HTML, CSS and JS. The design is a carbon-copy docket book, with rubber stamps for APPROVED, DEPOSIT PAID and PAID IN FULL.
  • Hosting: Render (Blueprint in the repo).
  • Testing:
    • An end-to-end flow test with PayPal and the AI mocked.
    • paypal-flow-check.mjs runs every PayPal call against the sandbox.
    • A live check drafts quotes with the real model.

Challenges we ran into

  • Matching checkout to invoices. PayPal Checkout payments don't settle an invoice automatically. Docket records each capture against the invoice. Passing the Orders capture ID as payment_id returns RESOURCE_NOT_FOUND, so the capture ID goes in the payment note instead, and failed recordings are retried.
  • Splitting the balance. One balance payment covers the main job and its variations, so it's split across the invoices, oldest first.
  • Cached scopes. After we enabled Invoicing on the sandbox app, PayPal kept handing out the cached token without the new scope. We had to terminate the token to pick up the change.
  • Keeping the AI away from money. Prices, GST and deposits never come from the model.

Accomplishments that we're proud of

  • The full loop works live on the PayPal sandbox: quote, invoice, deposit, variation, reminder, balance, paid.
  • A tradie can go from voice notes to a sent PayPal invoice in under a minute.
  • An agent that's useful but can't do anything to a customer without a tap.

What we learned

  • PayPal Invoicing and Checkout fit together well once each payment is recorded against its invoice.
  • Structured outputs make the AI reliable at choosing, as long as the code keeps the arithmetic.

What's next

  • Photo-to-quote (snap the switchboard).
  • PayPal webhooks, so payments made through the PayPal invoice link sync back.
  • Price book import from supplier price lists.
  • PayPal Payouts to subcontractors on job completion.

Built by Treyn at AppForge Digital (Mackay, Queensland) with Claude as an AI coding partner. Business, customers and prices in the demo are fictional.

Built With

Share this project:

Updates

Submission history