# Satoshi's Shelf — agent checkout and payment instructions Satoshi's Shelf is an independent bookstore. All prices are in USD. Crypto payments are processed through Blockonomics Payment Intents. No account, card, or API key is required to place an order. Resolve relative URLs against this site's origin. ## 1. Browse books GET /api/books Returns JSON: { "currency": "USD", "count": 12, "books": [ { "id": 5, "slug": "dune", "title": "Dune", "author": "Frank Herbert", "category": "Sci-Fi", "year": 1965, "pages": 688, "isbn": "9780441172719", "price_cents": 2199, "price": "$21.99", "currency": "USD", "stock": 15, "description": "..." } ] } Only order books with stock > 0. Do not send prices; the server computes all totals. ## 2. Create an order POST /api/orders Content-Type: application/json { "items": [{ "id": 5, "quantity": 1 }], "customer": { "name": "Ada Lovelace", "email": "ada@example.com", "addressLine": "12 Analytical Way", "city": "London", "postalCode": "N1 1AA", "country": "United Kingdom" } } Quantity must be 1-10 per title. Shipping is $5.00, free for subtotals of $50.00 or more. Response 201: { "ref": "BK-0DF8830B17", "intent_id": "pi_8um95hNDq1kY7eHZT4FmAc", "pay_url": "/pay/BK-0DF8830B17" } Keep both `ref` and `intent_id`. ## 3. Check what is due GET https://www.blockonomics.co/api/v2/pay_stat/{intent_id} This endpoint is public. It returns `status`, `due_amount`, `accepted_cryptos`, and `testmode`. If `status` is `paid`, stop. If `testmode` is `true`, the store is in Blockonomics test mode: do not send real funds. ## 4. Get a payment quote POST https://www.blockonomics.co/api/v2/pay/{intent_id} Content-Type: application/json { "crypto": "BTC" } Use `"crypto": "USDT"` for USDT. The response is under `data`: { "address": "bc1q...", "crypto_amount": "12966", "expires_timestamp": 1793615475, "status": "pending" } - BTC: `crypto_amount` is satoshi. 1 BTC = 100,000,000 satoshi. - USDT: `crypto_amount` is base units. 1 USDT = 1,000,000 base units. - USDT is ERC-20 on Ethereum. Send exactly `crypto_amount` to `address` before `expires_timestamp`. The price is locked for five minutes. If the quote expires or `due_amount` changes, request a new quote. ## 5. Submit the USDT transaction hash After sending USDT, submit the transaction hash: POST https://www.blockonomics.co/api/v2/pay/{intent_id}/submit Content-Type: application/json { "crypto": "USDT", "txhash": "0x..." } USDT transfers are not detected until the hash is submitted. This step is not required for BTC. ## 6. Poll until paid Poll every 10 seconds: GET /api/orders/{ref}/status or GET https://www.blockonomics.co/api/v2/pay_stat/{intent_id} Fulfil the order only when the status is `paid`. Confirmation time depends on the network. If the status becomes `underpaid`, request a new quote for the remaining `due_amount` and pay the difference. ## Payment rules - Accepted assets: Bitcoin (BTC) on Bitcoin mainnet, and USDT (ERC-20) on Ethereum. - Do not send any other asset or use another network. - Payments are non-custodial and go directly to the shop wallet. - The human checkout page is available at /pay/{ref}. - Public order status page: GET /order/{ref}.