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

    Function isAccessTokenAlreadyUsed

    • Whether an error is the backend refusing a second settlement of the same single-use token.

      The one correct response is to mint a new token — a retry that replays the same token fails identically forever. Never treat this as a transient settlement failure.

      Parameters

      • error: unknown

        Any thrown value; typically a PaymentsError from payments.facilitator.settlePermissions

      Returns boolean

      try {
      await payments.facilitator.settlePermissions({ paymentRequired, x402AccessToken })
      } catch (error) {
      if (isAccessTokenAlreadyUsed(error)) {
      // Re-mint, do not replay.
      }
      throw error
      }