salt-sdk - v0.0.45
    Preparing search index...

    Class PaymentAuthorisationErrorSealed

    Thrown when the payer failed to sign the x402 fee payment for an operation — not when the operation itself failed.

    Paying is a step of its own, taken before the paid-for request is sent. When it fails, nothing was created: no account record, no transaction proposal. Starting the operation again is a clean retry.

    Whatever the payer threw is kept as cause. With Salt.accountAsPayer, that is an error from the paying account's own signing ceremony — e.g. a RoboStatusError for the paying account's robos, or a PolicyBreachError from its policies — which would otherwise be indistinguishable from the same failure in the operation being paid for.

    import { PaymentAuthorisationError, RoboStatusError } from 'salt-sdk';

    try {
    const ceremony = await salt.createAccount({ ...params, payer });
    await ceremony.wait();
    } catch (err) {
    if (err instanceof PaymentAuthorisationError) {
    // The fee was never paid and no account was created.
    console.error(`Payer ${err.payer} could not sign:`, err.cause);
    if (err.cause instanceof RoboStatusError) {
    // The paying account's robos are offline, not the new account's.
    }
    } else {
    throw err;
    }
    }

    Hierarchy

    • Error
      • PaymentAuthorisationError
    Index
    cause: unknown

    Whatever the payer's signTypedData threw.

    message: string
    name: string
    payer: string

    Address of the payer that failed to sign.

    stack?: string
    terms?: FeeTerms

    The terms it was asked to sign, when x402 had chosen them.