T402 API Reference - v2.8.0
    Preparing search index...

    Function paymentProxyFromConfig

    • Next.js payment proxy for t402 protocol (configuration-based).

      Use this when you want to quickly set up proxy with simple configuration. This function creates and configures the t402ResourceServer internally.

      Parameters

      • routes: RoutesConfig

        Route configurations for protected endpoints

      • OptionalfacilitatorClients: any

        Optional facilitator client(s) for payment processing

      • Optionalschemes: SchemeRegistration[]

        Optional array of scheme registrations for server-side payment processing

      • OptionalpaywallConfig: PaywallConfig

        Optional configuration for the built-in paywall UI

      • Optionalpaywall: PaywallProvider

        Optional custom paywall provider (overrides default)

      • syncFacilitatorOnStart: boolean = true

        Whether to sync with the facilitator on startup (defaults to true)

      Returns (req: NextRequest) => Promise<NextResponse<unknown>>

      Next.js proxy handler

      import { paymentProxyFromConfig } from "@t402/next";

      export const proxy = paymentProxyFromConfig(
      routes,
      myFacilitatorClient,
      [{ network: "eip155:8453", server: evmSchemeServer }],
      paywallConfig
      );