Back to the cloud

Connect Lemon Squeezy

You are already logged into Lemon. Flybid needs four values from that account, then a webhook that lands paid orders onto the cloud. One $1 variant. Checkout quantity is the dollar total.

Local 127.0.0.1 cannot receive Lemon webhooks. Tunnel the observatory first (ngrok or Cloudflare), then paste that public URL into Lemon.

1. API key

  1. Lemon → Settings → API
  2. Create a key with checkout + order read
  3. Copy it into LEMON_SQUEEZY_API_KEY

2. Store ID

  1. Lemon → Settings → Stores
  2. Open the store that will sell neurons
  3. Copy the numeric store ID into LEMON_SQUEEZY_STORE_ID

3. One $1 product variant

  1. Lemon → Products → New product
  2. Name it something like Neuron
  3. Price $1.00. Allow quantity on checkout (or leave quantity editable)
  4. Publish it
  5. Open the variant. Copy the numeric variant ID into LEMON_SQUEEZY_VARIANT_ID

Checkout sends quantity = dollars. Ten $1 field neurons = quantity 10. One $100 apex = quantity 100.

4. Webhook

  1. Lemon → Settings → Webhooks
  2. Callback URL: https://flybid.lol/api/ads/webhook
  3. Subscribe to order_created only
  4. Copy the signing secret into LEMON_SQUEEZY_WEBHOOK_SECRET

That POST commits the reserved neurons. First paid commit owns them. No steal.

5. Put the keys on disk

Copy fleyntist/.env.example to fleyntist/.env and fill the four lines. Restart observatory after saving:

py -3.12 -m fleyntist observatory --port 8765

Homepage header should read Lemon live. If it still says Lemon off, a key is missing or the process was not restarted.

6. What a paid click does

  1. Buyer enters a site or @handle, a count 1–1000, then Pay
  2. Server reserves those FlyEM body IDs for 15 minutes
  3. Lemon collects the money
  4. order_created hits /api/ads/webhook
  5. Those neurons are logged as owned and painted on the cloud
  6. Buyer returns to /?paid=1

Without the four env values, Pay still paints in local preview mode. That is not a real charge.