/** * paygate/fastify — Fastify plugin for x402 paywalls (v3). * * Usage (v3): * import Fastify from 'fastify'; * import paygate from 'paygate/fastify'; * * const app = Fastify(); * await app.register(paygate, { merchantId: process.env.PAYGATE_MERCHANT_ID }); * * // Route-config-driven paywall * app.get('/api/data', * { config: { paygate: { priceCents: 10 } } }, * async (req, reply) => reply.send({ data: 'premium' }) * ); * * // Or imperative * app.get('/api/premium', async (req, reply) => { * const { paid } = await req.paygatePay({ priceCents: 25 }); * if (!paid) return; * reply.send({ data: '...' }); * }); */ import type { FastifyPluginAsync } from "fastify"; import { type PaygateConfig, type RoutePrice } from "./core.js"; export type { PaygateConfig, RoutePrice }; declare module "fastify" { interface FastifyRequest { paygate?: { paid: boolean; txHash?: string; trustTier?: string; merchant?: string; /** True when this delivery rides an earlier request's settlement (re-delivery). */ replayed?: boolean; }; paygatePay: (routePrice: RoutePrice) => Promise<{ paid: boolean; }>; } interface FastifyContextConfig { paygate?: RoutePrice; /** @deprecated — v2 key. Use `paygate` instead. */ x402?: RoutePrice; } } declare const paygatePlugin: FastifyPluginAsync; export default paygatePlugin; export { paygatePlugin }; //# sourceMappingURL=fastify.d.ts.map