@nevermined-io/payments
    Preparing search index...

    Interface MppFetchOptionsExperimental

    Options for mppFetch / MppAPI.fetch.

    The MPP buyer surface may change in a minor release.

    The request's init.body, if any, must be replayable if the endpoint may challenge the request: a ReadableStream body throws a typed PaymentsError once a 402 challenge actually requires a retry, since the stream cannot be resent. A request that is never challenged sends a stream body exactly once, exactly like plain fetch.

    This helper mints nvm:erc4337 access tokens only in this release — a buyer holding an nvm:card-delegation delegation cannot use it yet.

    interface MppFetchOptions {
        agentId?: string;
        delegationConfig: DelegationConfig;
        maxCredits?: string | number | bigint;
        planId?: string;
    }
    Index

    Properties

    agentId?: string

    Overrides the agent id the seller's challenge names — the minted token is addressed to this agent id instead of whatever the challenge carries. Unlike planId, this is not a guard: a mismatch is not checked or refused, it simply replaces what the seller asked for. Leave unset to honor the challenge as issued.

    delegationConfig: DelegationConfig

    The delegation that backs the payment — the same one x402 uses.

    maxCredits?: string | number | bigint

    Budget for the WHOLE call, not for one challenge: the helper refuses to mint whenever the credits named so far plus the credits this challenge asks for would exceed it. A seller unilaterally names the price, and a re-challenge names it again — a per-turn cap would therefore bound each turn at maxCredits and the call at twice it, which is not what "cap" reads as. creditsPresented on the result is the same running total, so the two always speak about the same number.

    Must be a non-negative integer (a decimal string, a safe integer, or a bigint); anything else is refused with a PaymentsError at entry, before the first request, rather than mid-flight on the first 402.

    planId?: string

    Fail before minting if the challenge names a different plan than this.