Inspiration

Truck drivers are paid by the load, not by the hour. When a warehouse keeps a truck waiting at the dock past the free time in the rate confirmation (usually two hours), the carrier is owed detention pay. The US DOT Office of Inspector General estimated in 2018 that detention cuts drivers' earnings by $1.1 billion to $1.3 billion a year. Most of that money is never billed, because collecting it means noting the times, writing an invoice after a long shift, sending it to the broker and chasing it for weeks. At the same dock the driver often has to pay the unloading crew (the lumper) on the spot.

So the question behind DockTab is simple: what if billing detention took one sentence, spoken in the cab, with PayPal doing the rest?

What it does

The driver talks (or taps an example) and DockTab acts through PayPal:

  • Bill detention. "I've been stuck at the Columbus dock all morning, bill the broker." DockTab takes the truck's arrival from the geofence and the appointment and free time from the rate confirmation, computes the billable time and amount in code, then creates and sends a PayPal invoice to the broker. The dock timeline goes on the invoice as evidence.
  • Pay the lumper. "Lumper wants 150 dollars for load 1042." DockTab sends a PayPal Payout to the lumper's account.
  • Ask about money. "Has Prairie paid me for Indianapolis yet?" DockTab checks the invoice status and can confirm what money actually moved with PayPal Transaction Search. "Yes, remind them" sends a PayPal invoice reminder.
  • Fix it by voice. "Update the invoice" cancels the open invoice and bills detention up to now. "Cancel the Columbus invoice" cancels it in PayPal, and "Lakeshore paid by check" records the payment so PayPal shows the invoice as paid. DockTab never sends a second invoice for the same load, and asks before paying the same lumper twice.

Replies are one or two short sentences, number first, read aloud, because the driver is listening rather than reading. A dispatcher board next to the driver panel shows each load's detention clock, invoice status and lumper payout, refreshed from PayPal. It works one-handed on a phone.

How I built it

  • An AI agent runs a tool-calling loop with prompt caching on the fixed system prompt and tool list, so each request reuses about 5,000 cached tokens and a full flow takes 4 to 12 seconds. The model never invents money: amounts and times come from DockTab's own tools.
  • PayPal Agent Toolkit (@paypal/agent-toolkit) for Invoicing v2. Its read and reminder tools are handed to the agent directly; creating and sending an invoice happens inside DockTab's bill_detention tool so the amount is computed, not generated. Cancelling and recording outside payments also use the toolkit, through DockTab tools that first check the invoice belongs to the driver and is still unpaid.
  • PayPal Server SDK (@paypal/paypal-server-sdk 2.5.0) for Transaction Search and the APIMatic Context Plugin for PayPal. The plugin's TypeScript skills supplied the client configuration, the TransactionSearchController parameters and models, and the ApiError handling, so the integration worked on the first sandbox call.
  • PayPal Payouts REST API for the lumper, with a $500 demo cap.
  • Next.js 16 with an NDJSON stream, so the driver sees each PayPal call as it happens. Voice uses the browser's Web Speech API.
  • Hosted on a small VM behind Apache with HTTPS, rate limits per IP and overall, a sandbox-only guard, and a generic public health check.

Challenges I ran into

  • A token that never renewed. After a few hours the hosted demo started crashing on any request. The PayPal Agent Toolkit fetches one OAuth token and keeps it for the life of the process; once PayPal rejected it, invoice lookups came back as error payloads with a numeric 401, the board stored that number as an invoice status, and the page crashed. The APIMatic plugin's authentication skill explained the difference: the Server SDK renews its token before expiry. DockTab now uses the SDK's token handling for Transaction Search, rebuilds the toolkit every 30 minutes, retries once on a 401, and only accepts a text status.
  • Keeping the model honest about money. Early on the model sometimes asked "should I wait until you leave the dock?" instead of billing. The fix was in the prompt and the tools: bill when asked, cover detention up to now, and refuse a second invoice for the same load.
  • Sandbox data lag. Transaction Search in the sandbox trails by a few hours, so the tool reports when its data was last refreshed and the assistant says so.

Accomplishments that I'm proud of

  • A spoken sentence becomes a real, sent PayPal invoice with the evidence attached, in about 10 seconds.
  • Three PayPal surfaces (Agent Toolkit, Server SDK, REST Payouts) working together behind one voice interface.
  • It works on a phone in the cab, and the whole demo is live for anyone to try.

What I learned

  • For voice, the answer has to fit in one breath: number first, no ids, one question at a time.
  • Agent toolkits are great for reads; anything that moves money should go through a tool whose amounts come from code.
  • Token lifetimes matter on a server that stays up for weeks.

What's next for DockTab

  • Real geofence and ELD data instead of seeded loads, and detention that updates the invoice when the truck leaves.
  • PayPal webhooks for paid invoices, so the driver hears "Lakeshore just paid $150" without asking.
  • Arabic and Spanish voice for drivers who prefer them, and a fleet view for small carriers.

Built With

Share this project:

Updates

Submission history