Client
The client is whatever makes the initial HTTP request: a browser, a mobile app, a CLI, an agent runtime. It holds the buyer’s wallet (or delegates to one), signs the authorization entries that authorize the transfer, and attaches the resultingX-Payment header on retry.
The client never broadcasts the transaction itself. That is the facilitator’s job. This split is what lets the facilitator sponsor Stellar fees on the client’s behalf without the client needing XLM.
Server (resource server)
The server is the API being paid for. It:- Emits the initial
402withPaymentRequired. - On retry, hands the
X-Paymentpayload plus thePaymentRequirementsto the facilitator’s/verifyendpoint. - Only serves the protected resource after receiving a successful verification.
- Optionally calls
/settleto finalize the payment on-chain (or lets the facilitator settle automatically).
Facilitator
The facilitator is the neutral third party that:- Verifies that the client’s signed payload matches the server’s
PaymentRequirements. - Sponsors Stellar fees so neither buyer nor seller pays gas.
- Submits the settled transaction to the Stellar network and returns the
txHash. - (In this implementation) catalogs the endpoint into the Bazaar for discovery.
Why the split matters
It is tempting to imagine the server handling payment directly. It would be simpler, until the server has to sponsor gas, index every SEP-41 token it accepts, and stay online 24/7 to settle late transactions. The facilitator absorbs that operational surface and lets the server be a normal HTTP API that happens to charge for calls.Where next
- Facilitator goes deeper on what a facilitator does internally.
- The Bazaar explains how servers get discovered by clients.
- Self-Facilitation is for the (rare) case where you want to be your own facilitator.