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

    Function erc8004IdentityCheck

    • Create a BeforePaymentCreationHook that verifies agent identity before signing a payment.

      Works with t402Client.onBeforePaymentCreation(), which means it automatically applies to @t402/fetch and @t402/axios wrappers.

      Parameters

      Returns BeforePaymentCreationHook

      A hook for registration on t402Client

      import { createPublicClient, http } from "viem";
      import { base } from "viem/chains";
      import { erc8004IdentityCheck } from "@t402/erc8004";

      const viemClient = createPublicClient({ chain: base, transport: http() });
      const client = new t402Client()
      .register("eip155:8453", evmScheme)
      .onBeforePaymentCreation(erc8004IdentityCheck(viemClient));

      const fetchWithPay = wrapFetchWithPayment(fetch, client);