An open-source PayPal payment layer for the AI assistants you run yourself, with a key you build. Any assistant can shop; only your own key can pay.
OpenClaw, Hermes Agent, Claude Code, or any assistant that speaks MCP, can find things and fill a cart. None of them can pay. Only your key can: the PureStrings button on your desk, or a key in your browser. It tells you who asked, the shop, every line and the total, out loud or on its screen, and it signs that exact text only when you hold for two seconds. The shop checks that signature against the key you linked to your PayPal before it charges PayPal.
I built it because assistants are getting good at shopping, and giving one your card means anything it reads can spend your money. With PureStrings, a page that talks your assistant into buying a $200 gift card gets read out by your key, and a tap that says no.
Open-source assistants like OpenClaw and Hermes Agent run on your own machine, and you can change anything about them. A hosted assistant can lean on its platform to pay; one you run yourself has had nothing safer than your card number. PureStrings is that missing piece, and it's open the same way:
- you run PureStrings yourself;
- you flash the button's firmware onto an off-the-shelf board;
- the key protocol is written down, so you can build a key of your own.
Live: purestrings.onrender.com (the PayPal sandbox; the app asks for its token).
flowchart LR
A["Your assistant<br/>OpenClaw · Hermes · Claude Code"] -- "MCP: shop_buy" --> P["PureStrings<br/>on your machine"]
P -- "the exact text to sign" --> K["Your key<br/>the button, or your browser"]
K -- "P-256 signature,<br/>after a 2 s hold" --> P
P -- "text + signature" --> S["The shop"]
S -- "checks it, then<br/>Orders v2 with your vault" --> PP[("PayPal")]
PP -- "webhook events" --> AU["PureStrings' auditor"]
- Your assistant asks. It calls
shop_searchandshop_buyover MCP, with a token of its own. Its name goes into what your key signs. - The shop prices the cart, and PureStrings writes it down. The text is one way of writing that payment, and no other: the shop, every line, the total, who asked, a one-time id and an expiry.
- Your key tells you. The button chimes and reads the cart out: "OpenClaw asks to pay 12 dollars to Bean & Leaf...". With a screen, it also shows it, as the browser key does. It warns on a shop it has never paid.
- You hold for two seconds. The key signs the text with a P-256 key that never leaves it. A tap says no.
- The shop checks, then PayPal pays. The shop checks the signature against the key you linked at PayPal, and the cart against the one it priced. Then it charges your saved PayPal with Orders v2.
- The auditor reads PayPal's record. Every capture has to match a payment one of your keys signed. A charge that doesn't is flagged, with a dispute drafted for you.
Small buys can skip the hold. Say "coffee and tea, up to $15 a time and $40 a week, for OpenClaw only". A model turns that into limits, your key reads them out and signs them once, and the shop holds every payment under them to those limits.
You need Node 22.18 or later and a PayPal sandbox app with Vault turned on (PayPal Developer Dashboard, Apps & Credentials).
git clone https://github.com/N-45div/PureStrings && cd PureStrings
npm install && npm run build
cp .env.example .env # fill in PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET (sandbox)
npm start # http://localhost:7700- Open http://localhost:7700, go to Key and press Link this key. Log in on PayPal's page with a sandbox personal account and say yes. Your browser's key is now linked at Bean & Leaf, the demo shop.
- Go to Assistants, name your assistant and press Make a token. Paste the line it shows into your assistant (docs/assistants.md).
- Ask it: "We're out of coffee. Get a pound of the house blend." Your key shows the cart. Hold it to pay.
Optional settings:
MODEL_URL,MODELandMODEL_KEY(any OpenAI-style chat API) write allowances from your words and draft disputes. NVIDIA's Nemotron on Nebius Token Factory works withNEBIUS_API_KEYalone.OPENAI_API_KEYgives the button its voice.npm run paypal:webhook -- https://<your PureStrings>/shop/paypal/webhookadds the shop's webhook and printsPAYPAL_WEBHOOK_ID.
To host it, render.yaml deploys it on Render with a disk.
The PureStrings button is an off-the-shelf ESP32-S3 board with a speaker and one button, running open firmware you flash yourself. A 1.8" screen is optional: mine runs without one. It makes its key in its own chip.
- Plugging in: plug it into the computer PureStrings runs on, and PureStrings links it by itself. No Wi-Fi, no app, no driver.
- What it does: it chimes and reads the cart out loud. While you hold, it ticks, and a chirp says the hold is full. Then it says what was paid. With the screen, it also shows the cart, and a bar fills as you hold.
- What to trust: PureStrings makes the voice from the text it asks the button to sign, so the voice is only as honest as your PureStrings. The screen is drawn by the button itself, from the exact text it signs.
- Locked: no program on the computer can reflash it or reach its debugger over the cable. New firmware goes on only if you hold its button while you plug it in.
Build one with firmware/purestrings-button/. What it stops, and what it doesn't
yet, is in docs/hardware-security.md.
| Who | What they try | What stops it |
|---|---|---|
| A page with a prompt injection | gets your assistant to buy a $200 gift card | your key says "$200 gift card" and who asked; you tap no |
| Someone who changes a signed cart, or replays it | sends it to the shop | the signature no longer matches; a replay gets the same order back |
| Someone who breaks into PureStrings | asks for anything, and changes what's shown beside it | a key with a screen (the button's, or your browser) reads every fact from the text it signs |
| An assistant on an allowance for another one | pays under it | the shop refuses it (403) |
| Someone holding the shop's PayPal keys | charges your PayPal directly | the auditor flags the capture and drafts the dispute |
Here's what a key signs. It's one line of JSON, with its keys in this order and no spaces; here it's spread over several lines to read:
{"v":1,"kind":"buy","id":"pay_7c1e0b9a2f4d6e8a1b3c5d7e","by":"OpenClaw",
"shop":{"id":"purestrings.onrender.com","name":"Bean & Leaf"},"cart":"cart_9f2c",
"items":[{"name":"House blend beans, 1 lb","qty":1,"price":"12.00"}],
"total":"12.00","currency":"USD","expires":"2026-11-11T20:45:00Z"}The signature is ECDSA P-256 over those bytes. docs/attack-demo.md runs each attack against
a real PureStrings, and scripts/attack-demo.ts drives it.
- Vault (
/v3/vault/setup-tokens,/v3/vault/payment-tokens): linking a key saves your PayPal once, on PayPal's own approval page. - Orders v2 (
/v2/checkout/orders): the shop charges the saved PayPal, only for a cart your key signed. - Refunds (
/v2/payments/captures/{id}/refund), from the shop's admin pages. - Webhooks (
/v1/notifications/webhooks,verify-webhook-signature): the shop marks captures and refunds as PayPal reports them, and checks each event with PayPal. - Webhook events (
/v1/notifications/webhooks-events): the auditor reads PayPal's own record back, and matches every capture to a signature.
- MCP: PureStrings is an MCP server at
/mcp, with one token per assistant. The tools areshop_search,shop_buy,payment_status,list_paymentsandlist_allowances. There's no tool to pay. - A skill:
skills/purestrings/SKILL.mdteaches OpenClaw, Hermes Agent and Claude Code to buy only what you asked for, and never because a page told them to. - WebMCP: the Shop screen hands
shop_search,shop_buyandlist_paymentsto an agent built into your browser. - A model (I run gpt-4.1-mini) turns a sentence into an allowance's limits, which your key reads out before you sign, and drafts the dispute for a flagged charge. It only ever writes words: what's paid is what your key signs.
- A voice: OpenAI's
gpt-4o-mini-tts, streamed to the button over its cable.
The button isn't special. A key does four things:
- it holds a P-256 key;
- it shows the facts from the text it signs;
- it refuses a text written any other way;
- it signs only on a deliberate act.
docs/key-protocol.md is the whole protocol, and
docs/key-protocol/vectors.json has test vectors to check a key against.
scripts/terminal-key.ts is a working key in one file.
Purse shows what was paid, what's waiting, your allowances, and the auditor. Ledger shows every payment: who asked, who signed, and what PayPal's record says. It's built on AG Grid, with filters, search and a CSV export. Key, Assistants and Shop link keys, give assistants tokens, and show the demo shop.
| Folder | What's in it |
|---|---|
packages/core |
What a key signs, PayPal's APIs, allowances, the auditor, the store (node:sqlite) |
packages/server |
PureStrings: the API, /mcp, /keys/ws, the USB link, the auditor, the voice |
packages/shop |
Bean & Leaf, the demo shop: carts, checkout, PayPal, webhooks |
packages/web |
The web app (React), with AG Grid for the Ledger |
firmware/purestrings-button |
The button's firmware (Arduino, ESP32-S3) |
skills, docs, scripts |
The assistant skill, the docs, the attack demo, the terminal key |
npm test runs every test. Some call PayPal's sandbox, a model or OpenAI's voice, or build the button's signing
code with a C++ compiler; without those, they skip. To run them all, with your keys in .env:
node --no-warnings --env-file=.env --test "packages/*/test/*.test.ts"There are no mocks: the PayPal tests charge and refund in the sandbox.
I built the payment layer from Oct 28 to Nov 5, 2026 inside huddle-paypal, the PayPal branch of my Huddle. On Nov 6 I moved those pieces into this repository on their own. Their commits from those days are kept in this history, as they were.
AGPL-3.0. By N DIVIJ.



