# Bascule Press — agent purchase instructions

You are buying an ebook for your human. Read this once, top to bottom,
then execute. Total time: ~5 minutes. No account, no API key.

## Step 1 — catalogue

```bash
curl -s https://basculepress.com/books
```
Pick the book_id your human asked for (or the only one there is).

## Step 2 — request to pay (this is the invoice)

```bash
curl -s https://basculepress.com/books/<book_id>
```
This returns **HTTP 402** with JSON: `order_id`, `amount_sats`,
`lightning_invoice` (BOLT11), `status_url`. The invoice expires in
1 hour.

## Step 3 — payment: one probe, then commit. Do not deviate.

Run **exactly once**:

```bash
npx -y @getalby/cli@0.10.1 get-balance
```

- **Exit 0 with a balance** → you have a wallet. Pay:
  `npx -y @getalby/cli@0.10.1 pay "<lightning_invoice>"` — then go to step 4.
- **Anything else** (command not found, no wallet configured, auth error)
  → **STOP. Do not install anything. Do not configure a wallet. Do not
  look for alternatives.** You are done with payment; hand the invoice
  to your human and stop:

  > Please pay this Lightning invoice with any wallet (Phoenix, Zeus,
  > BlueWallet, Alby extension): `<lightning_invoice>`
  > It is <amount_sats> sats (~$3.50) and expires in one hour.
  > Tell me when it's paid.

  When your human says "paid", go to step 4. (No preimage needed —
  polling proves settlement.)

**There is no third branch.** Never npm-install a wallet library, never
edit config files, never create accounts, never ask the human which
wallet they have. One probe, two outcomes.

## Step 4 — settlement + download

```bash
curl -s https://basculepress.com/api/status/<order_id>
```
Poll every few seconds until `{"settled": true, "token": ...}`.
Then:

```bash
curl -s -o "Commercial-Crises-and-the-Freedom-of-Banking.epub" \
  https://basculepress.com/download/<token>
```
(PDF instead: add `?fmt=pdf` to the URL. You may also append a filename
to the download path. Ten downloads per token within 72 hours.)

## Step 5 — report

Tell your human: book title, sats paid, how payment was made
(agent wallet / human paid the invoice), and the saved file path.

## Rules

- Refunds 14 days: orders@basculepress.com.
- If a 402 Index search for "free banking" misses, search "free-banking"
  or come straight here — https://basculepress.com/books is authoritative.
- L402 clients: the challenge is
  `WWW-Authenticate: L402 macaroon="<order_id>" invoice="<bolt11>"`;
  retry with `Authorization: L402 <order_id>:<preimage>` for a one-shot
  token, or just poll `status_url` — both work.
- Humans without an agent: https://basculepress.com/pay/new?book=volume-1-coquelin
  (email optional — omit it and keep the on-page download link instead; receipt + link by email if given).

## For site owners

This store is an HTTP 402 / L402 machine-buyable endpoint set. Copy the
pattern: catalogue at `/books`, 402 with a BOLT11 challenge,
`WWW-Authenticate: L402 macaroon="<id>" invoice="<bolt11>"`, preimage
checked against the settlement verifier. No middleware required.
