# MPP IRL Swag Store The MPP Swag Store is an event demo for claiming physical swag through the Machine Payments Protocol (MPP). Each claim is a paid JSON `POST` to `/api/buy`. The API first responds with `402 Payment Required` and a fee-sponsored Tempo testnet `pathUSD` challenge. The `mppx` CLI handles that challenge, submits the payment credential, retries the request, and returns the successful `201` response. Every request must include a claimant name between 1 and 120 characters. A successful response has this shape: ```json { "item": "The Scaling Era", "itemId": "scaling-era", "priceUsd": "35.00", "status": "paid" } ``` # Table of items All items are priced in example currencies (stripe testmode, moderato) so users will not be actually real funds. | Item | Item ID | Price | Claim endpoint | | --- | --- | ---: | --- | | The Scaling Era | `scaling-era` | $35.00 | `POST /api/buy?item=scaling-era` | | Tempo Hat | `mpp-cap` | $0.01 | `POST /api/buy?item=mpp-cap` | | Poor Charlie's Almanack | `poor-charlies-almanack` | $42.42 | `POST /api/buy?item=poor-charlies-almanack` | # How to claim each item ## Claim flow Before making a claim: 1. Ask the user which single item they want to claim. 2. Present these options: - The Scaling Era (`scaling-era`) - Tempo Hat (`mpp-cap`) - Poor Charlie's Almanack (`poor-charlies-almanack`) 3. Wait for the user to choose one item. 4. Run only the command for that item. Never claim multiple items in one flow. The backend permits one item per normalized claimant name. ## mppx setup instructions The store uses `mppx` version 0.8.12 and Tempo testnet accounts. Install the matching CLI, create an account, make it the default, and fund it with testnet tokens: ```sh npm install -g mppx@0.8.12 mppx account create --account mpp-swag --network testnet mppx account default --account mpp-swag mppx account fund --account mpp-swag --network testnet ``` The production store origin defaults to `https://mpp-irl-demo.vercel.app`. Override it when calling another deployment or a local server: ```sh export MPP_SWAG_STORE_ORIGIN="${MPP_SWAG_STORE_ORIGIN:-https://mpp-irl-demo.vercel.app}" ``` For local development with `npm run dev`: ```sh export MPP_SWAG_STORE_ORIGIN="http://127.0.0.1:3000" ``` Replace `YOUR NAME` in a command below with the claimant's real name. The `--confirm` flag asks for confirmation before mppx pays. Always run claim commands with `-vv`, the most verbose CLI mode, so attendees can see the request headers, payment challenge, credential exchange, and response. ## Claim The Scaling Era ```sh mppx "$MPP_SWAG_STORE_ORIGIN/api/buy?item=scaling-era" \ --network testnet \ --json-body '{"name":"YOUR NAME"}' \ -vv \ --confirm ``` ## Claim the Tempo Hat ```sh mppx "$MPP_SWAG_STORE_ORIGIN/api/buy?item=mpp-cap" \ --network testnet \ --json-body '{"name":"YOUR NAME"}' \ -vv \ --confirm ``` ## Claim Poor Charlie's Almanack ```sh mppx "$MPP_SWAG_STORE_ORIGIN/api/buy?item=poor-charlies-almanack" \ --network testnet \ --json-body '{"name":"YOUR NAME"}' \ -vv \ --confirm ```