Skip to main content

Machine-to-machine micropayments with Lightning

How Bitcoin's Lightning Network powers machine-to-machine micropayments: sub-cent fees, instant settlement, pay-per-call APIs, and account-free agent economies.

Machine-to-machine (M2M) micropayments are tiny, automated payments that one piece of software sends to another without a human approving each transaction. A metering API charges a few satoshis per call. A data feed bills per record. An autonomous agent rents a minute of compute and settles the bill the instant the work is done. The Bitcoin Lightning Network makes these sub-cent transfers practical, because it can move value in fractions of a satoshi, confirm in milliseconds, and cost almost nothing to route.

This guide explains what M2M micropayments are, why Lightning is uniquely suited to them, how the plumbing actually works, and where you can start experimenting with real sats today.

What "machine-to-machine micropayment" actually means

A micropayment is a payment so small that traditional rails can't handle it economically. When a card network charges roughly 30 cents plus a percentage per transaction, a one-cent payment makes no sense — the fee dwarfs the value. M2M micropayments push this even further: the amounts are often a few satoshis (hundredths of a cent), and there may be thousands of them per minute.

The "machine-to-machine" part means there is no human in the loop for each payment. Software decides to pay, constructs the payment, and settles it programmatically. Humans set the budgets and the rules; machines execute the transactions.

Put the two together and you get a new design space:

  • Pay-per-call APIs that bill per request instead of per monthly subscription.
  • Streaming payments where value flows continuously — sats per second of video, per kilobyte of bandwidth, or per token of model output.
  • Agent economies where autonomous software buys data, compute, and services from other software and settles instantly.

The common thread is that the payment has to be cheap enough, fast enough, and final enough that a machine can treat it as a routine function call rather than a heavyweight financial event.

Why legacy rails fail at M2M

Before Lightning, three problems blocked machine-driven micropayments:

Fees

Card and bank rails carry fixed per-transaction costs. Below roughly a dollar, the fee is a larger share of the payment than anyone will tolerate. At a hundredth of a cent, it is absurd. Any system that wants to bill per API call or per kilobyte needs a near-zero marginal fee.

Settlement speed and finality

Cards "authorize" in seconds but settle in days, and payments can be reversed through chargebacks for months. A machine that delivers a digital good in 40 milliseconds cannot wait days to know it was paid, and cannot expose itself to reversal long after the data is gone.

Account friction

Traditional rails assume named accounts, KYC onboarding, and stored credentials. An autonomous agent that wants to buy one record from a service it discovered a second ago can't go through a signup flow. It needs to pay the way it makes an HTTP request: open a connection, transfer value, move on.

Lightning addresses all three at once.

Why Lightning fits machine payments

The Lightning Network is a layer built on top of Bitcoin. Instead of recording every payment on the blockchain, two parties open a payment channel — a shared, multi-signature balance anchored by one on-chain transaction. After that, they can send value back and forth thousands of times by exchanging signed balance updates. Only the opening and closing of the channel ever touch the chain.

Because those updates are just messages, not blocks, Lightning gives machines exactly what they need:

  • Sub-cent amounts. Lightning denominates value in millisatoshis — thousandths of a satoshi. A payment of a few hundred millisats is perfectly normal.
  • Instant settlement. A payment hops across channels and completes in well under a second, with cryptographic finality. There is no chargeback window.
  • Negligible routing fees. Fees are typically a tiny base amount plus a few parts per million. For a small payment that rounds to near zero.
  • No accounts. A Lightning invoice or an offer is just data. A machine can request one, pay it, and never establish an identity.

These properties are not incidental — they are the reason "pay per request" suddenly becomes an engineering option rather than a fantasy.

How a single Lightning micropayment flows

It helps to walk the path of one payment end to end:

  1. The seller generates an invoice. The invoice encodes an amount, a description, and a payment hash — the hash of a secret the seller holds.
  2. The buyer's node finds a route. It looks for a path of channels with enough liquidity to carry the amount from itself to the seller.
  3. The payment is locked along the route. Each hop conditionally commits funds that can only be claimed by revealing the secret behind the payment hash. This is a Hashed Time-Locked Contract (HTLC).
  4. The secret is revealed. When the payment reaches the seller, they release the secret to claim their funds. That secret cascades back along the route, settling every hop.
  5. Done. The buyer's software gets the preimage as a cryptographic receipt that the payment succeeded.

All of this happens in roughly the time of a network round trip. For a machine, it feels like calling a function that returns "paid."

Patterns for building M2M payments

Once you have fast, cheap, account-free payments, several architecture patterns become practical.

Pay-per-request APIs (HTTP 402)

The HTTP spec reserved status code 402 Payment Required decades ago and left it mostly unused. Lightning revived it. The pattern: a client requests a resource, the server replies 402 with a Lightning invoice in the headers, the client pays, then retries the request with proof of payment. The server verifies the preimage and returns the data.

This turns any endpoint into a metered service with no subscriptions, no API keys to provision, and no monthly billing reconciliation. A machine that has never seen the service before can use it on first contact.

Streaming and per-unit billing

For continuous services — bandwidth, compute time, media — you can send a steady trickle of small payments. Bill per second, per chunk, or per token. If payments stop, service stops. The buyer never overpays for unused capacity, and the seller never extends unsecured credit.

Agent budgets and wallets

An autonomous agent can be given a dedicated Lightning wallet with a hard balance cap. It spends within that budget to buy whatever it needs, and the cap is the safety rail: the worst case is bounded by what's in the wallet. This is how you let software transact without handing it your whole treasury.

Keysend and offers

Sometimes a machine wants to push a payment without first fetching an invoice — for example, tipping a node for a useful response. Keysend and the newer "offers" mechanism let a payer send to a known public key or a reusable static string, removing the request-an-invoice round trip for certain flows.

Where Lightning Faucet fits

Lightning Faucet is a Bitcoin and Lightning playground. It started as a faucet — a place to claim free sats — and grew into a set of surfaces where you can earn, spend, play, and build with real Lightning. For developers exploring M2M payments, it's a low-stakes environment to get hands-on with Lightning flows before you wire them into production.

A few places to start:

  • Earn surfaces. The earn page is where you accumulate sats through offers and activities — a simple way to fund a test wallet without buying Bitcoin first. Funding an experiment with earned sats keeps your first M2M prototype genuinely zero-risk.
  • Builder tools. The build section is aimed at developers who want to integrate Lightning and experiment with programmatic payments rather than just click around.
  • Prediction markets. The prediction markets show automated, sat-denominated settlement in action — small positions resolving against real-world outcomes, which is a useful mental model for how machines can settle conditional payments.

You can also see fast, low-value Lightning settlement at work across the games on the site — from sat-denominated poker where real players move sats hand to hand, to the free spin on the casino floor. Every one of those interactions is a tiny Lightning payment confirming in near real time — the same primitive M2M systems are built on.

Practical design considerations

If you're moving from concept to a working prototype, a few things matter more than the marketing suggests.

Liquidity and channel management

A node can only send what its channels have on the outbound side. If you plan to send many small payments, you need outbound liquidity in the right direction, and you need it to not run dry. For receiving, you need inbound liquidity. Plan channel topology around the direction your value actually flows.

Failed payments and retries

Lightning payments can fail mid-route if liquidity isn't where the pathfinder expected. This is normal. Build retry logic and treat a failed attempt as a routing problem, not a lost payment — funds are never stuck mid-flight; an HTLC either settles or unwinds.

Invoice lifecycle

Invoices expire. For machine flows, generate them on demand, keep expiry windows short, and verify the preimage rather than trusting a client's claim that it paid. The preimage is the proof; everything else is a hint.

Holding versus settling

Some flows use "hold invoices," where the seller can accept a payment but delay releasing the secret until they've delivered the goods. This lets a machine guarantee atomic "pay-and-deliver" semantics: either the buyer gets the data and the seller gets paid, or neither happens.

Budgets, not blank checks

Never give automated software unbounded spending authority. Use a capped wallet, per-period spend limits, and per-counterparty caps. The point of M2M payments is to let machines transact freely within boundaries you set, not to remove the boundaries.

A mental model for the agent economy

The reason machine-to-machine micropayments matter beyond API billing is that they make a genuine agent economy possible. When software can pay for exactly what it consumes — a single inference, one data record, a second of bandwidth — services can price at the true unit of value. Providers can offer capabilities to anyone, human or machine, without onboarding. And autonomous systems can compose services on the fly, paying as they go.

Lightning is the settlement layer that makes this economical. It won't replace large-value rails for buying a house, and it doesn't need to. Its job is to be the cheap, fast, final money plumbing for the millions of tiny transactions that software wants to make. That's a different job, and Lightning does it better than anything else available.

Frequently asked questions

What is the smallest payment Lightning can send?

Lightning accounts in millisatoshis — thousandths of a single satoshi. One satoshi is a hundred-millionth of a bitcoin, so a millisatoshi is an extraordinarily small unit of value. In practice the smallest routable payment is around one satoshi, because intermediate nodes round to the satoshi for their on-chain commitment, but the accounting precision below that level is what lets streaming and per-unit billing work cleanly.

How is Lightning different from just using on-chain Bitcoin?

On-chain Bitcoin records every transaction in a block, which costs a fee and waits for confirmations. That's secure but too slow and too expensive for thousands of tiny payments. Lightning opens a channel with a single on-chain transaction, then lets the two parties exchange unlimited off-chain updates that settle instantly and nearly for free. Only opening and closing the channel touch the blockchain.

Do machine-to-machine payments require a human to approve each one?

No — that's the entire point. A human sets the rules: a budget, spending limits, and which counterparties are allowed. After that, software constructs and settles each payment on its own. The control surface is the budget and the policy, not a manual approval for every transaction.

What is HTTP 402 and why does it matter for M2M?

402 Payment Required is a long-reserved HTTP status code. Combined with Lightning, it lets a server respond to a request with an invoice instead of data: pay the invoice, retry the request, get the data. This turns ordinary web endpoints into pay-per-call services that a machine can use on first contact, with no signup, API key provisioning, or subscription.

Is it safe to give an autonomous program a Lightning wallet?

It's safe when you bound it. Give the program a dedicated wallet funded with only what it's allowed to spend, set per-period and per-counterparty limits, and treat the wallet balance as the maximum possible loss. The worst case is capped by design. Never connect automated software to a wallet holding funds you can't afford to lose.

Where can I experiment with Lightning micropayments without risking much?

A faucet-based playground is a good starting point. On Lightning Faucet you can accumulate sats on the earn surfaces, then use the builder tools to get hands-on with programmatic Lightning flows. Because you can fund the wallet with earned sats, your first experiments cost nothing but time.

Will Lightning replace credit cards for everything?

No, and it doesn't try to. Lightning is optimized for fast, cheap, final, small-value transfers — exactly the regime where cards fail. Large purchases, credit, and reversibility still have their place on traditional rails. Lightning's contribution is opening up the enormous space of payments that were previously too small to make at all.

---

By the Lightning Faucet team.

Frequently asked questions

What is the smallest payment Lightning can send?

Lightning accounts in millisatoshis — thousandths of a satoshi. The smallest routable payment is around one satoshi, but the sub-satoshi accounting precision is what makes streaming and per-unit billing work cleanly.

How is Lightning different from just using on-chain Bitcoin?

On-chain Bitcoin records every transaction in a block, which costs a fee and waits for confirmations. Lightning opens a channel with one on-chain transaction, then settles unlimited off-chain payments instantly and nearly for free. Only opening and closing touch the blockchain.

Do machine-to-machine payments require a human to approve each one?

No. A human sets the budget, spending limits, and allowed counterparties; after that, software constructs and settles each payment on its own. The control surface is policy, not manual approval per transaction.

What is HTTP 402 and why does it matter for M2M?

402 Payment Required is a reserved HTTP status code. With Lightning, a server can answer a request with an invoice instead of data: pay it, retry, get the data. This turns ordinary endpoints into pay-per-call services usable on first contact, with no signup or API keys.

Is it safe to give an autonomous program a Lightning wallet?

It's safe when bounded. Use a dedicated wallet funded with only what the program may spend, set per-period and per-counterparty limits, and treat the balance as the maximum possible loss. Never connect automated software to a wallet holding funds you can't afford to lose.

Where can I experiment with Lightning micropayments without risking much?

A faucet-based playground is a good start. On Lightning Faucet you can accumulate sats on the earn surfaces, then use the builder tools to get hands-on with programmatic Lightning flows — funding experiments with earned sats so they cost nothing but time.