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

    Function parseChallengeHeader

    • Parses a WWW-Authenticate header into a challenge.

      Parameters

      • headerValue: string

      Returns MppChallenge | null

      null when there is no usable Payment challenge to parse: the header carries no Payment scheme at all, OR the scheme is present but missing one of the structural auth-params (id/realm/method/intent/ request) needed to even attempt decoding it. Both cases mean the same thing to a caller deciding whether to retry: there is nothing here to pay.

      A Payment scheme that has all of those structural params present, but whose request value fails to decode as JSON or decodes to something that is not a usable { planId, credits } object, raises a typed MppError instead — that is a seller who tried to speak MPP and sent something broken, a distinct failure from "there is no challenge here to parse".