OMPX JavaScript SDK
    Preparing search index...

    Class MPPAdapter

    Index

    Constructors

    Properties

    id: "mpp" = ...

    Methods

    • Build WWW-Authenticate: Payment challenge headers for a 402 response. Returns an array of header values (one per payment method). Use Headers.append() to add multiple WWW-Authenticate headers.

      Parameters

      • amount: Money
      • recipient: string
      • methods: OmpxPaymentMethod[]
      • request: Request
      • Optionaldescription: string
      • Optionalsecret: string

      Returns Promise<{ "WWW-Authenticate": string[] }>

    • Build the Authorization: Payment header from an MPP credential (client-side).

      Parameters

      Returns Record<string, string>

    • Build the Payment-Receipt header for a successful response.

      Parameters

      Returns Record<string, string>

    • Parse all MPP challenges from a 402 response's WWW-Authenticate headers (client-side). Returns an empty array if no MPP challenges are found.

      Parameters

      • response: Response

      Returns MPPChallenge[]

    • Parse the Authorization: Payment header from an incoming request (server-side). Returns null if no MPP credential is present.

      Parameters

      • request: Request

      Returns ParsedCredential | null

    • Parse the Payment-Receipt header from a successful response (client-side).

      Parameters

      • response: Response

      Returns MPPReceipt | null