Merchant SDK
Description and purpose
The Merchant SDK is a library that intercepts your route handlers, manages the 402 challenge-and-response cycle and verifies the onchain payment, all in a few lines of code.
How the Merchant SDK works
The merchant-side integration usually works as middleware. Instead of writing blockchain logic, the merchant adds a few lines to the existing web server:
- Intercept the request. When a client (an AI agent) calls the API, the middleware looks for a valid payment signature in the request headers.
- Trigger the 402 response. If no payment is present, the SDK automatically produces the HTTP
402response that contains the merchant’s wallet address and the required amount. - Verify and settle. Once the agent has paid, the SDK works with the Signet Facilitator to verify and settle the payment, and then lets the request proceed.
Platform and merchant responsibilities
Figure 6. Division of responsibilities between the merchant server, the agent and the Signet platform.
- The merchant defines what must be paid and which flow applies, based on its product type.
- The Merchant SDK handles how those payment rules are expressed as standard HTTP 402 headers.
- The Signet platform provides the underlying infrastructure: SignetPass, session keys, spending-policy validation and facilitator settlement, so that the payment is verified and cleared.
To download the SDK, see Merchant SDKs.