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

    EVM client implementation for the Up-To payment scheme.

    Uses EIP-2612 Permit to authorize up to a maximum amount, enabling usage-based billing where the actual settlement amount is determined by the server based on usage.

    import { UptoEvmScheme } from "@t402/evm/upto/client";
    import { privateKeyToAccount } from "viem/accounts";

    const signer = privateKeyToAccount(privateKey);
    const scheme = new UptoEvmScheme(signer);

    // Client will register this with the t402 client
    client.registerScheme("eip155:8453", scheme);

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    scheme: "upto"

    Methods

    • Creates a payment payload for the Up-To scheme.

      The payload contains an EIP-2612 permit signature authorizing the router contract (or facilitator) to transfer up to the specified maximum amount.

      Parameters

      • t402Version: number

        The t402 protocol version

      • paymentRequirements: PaymentRequirements

        The payment requirements (must include maxAmount)

      Returns Promise<Pick<PaymentPayload, "t402Version" | "payload">>

      Promise resolving to a payment payload