# MPP

> The ATR hash as the MPP challenge id, the opaque members, and the MPP pairings.

Source: https://lcp.integraledger.com/guides/mpp

Updated 2026-11-20. Documents @integraledger/lcp 0.6.3 and @integraledger/profile-facilitator 0.5.1. Every page of this site is listed in https://lcp.integraledger.com/llms.txt.

MPP, the Machine Payments Protocol, carries payment in HTTP authentication, as the
[Payment HTTP authentication scheme](https://paymentauth.org) defines it: the seller answers with one or more
`WWW-Authenticate: Payment` challenges, each naming a `method` (such as `evm`, `tempo`, `solana`, `stripe` or `lcp`)
and an `intent` (`charge`, `session` or `subscription`), and the buyer answers with a credential that echoes the
challenge it pays. Import the MPP pieces from `@integraledger/lcp/mpp`. This page is for a seller or a buyer on MPP: it
gives where H rides in a challenge, how to place and read it, every MPP pairing, the checks a resource server makes
before money moves, and how to answer the buyer.

## Where H rides

On every MPP pairing, H rides in the challenge itself, in two places:

- **The challenge `id`** is the base64url (no padding) of H's 32 bytes, then `.` and the challenge's position, 0 to
  31, which the seller gives each challenge of the sale, its charge and agreement challenges together. A Tempo `subscription` challenge's id is the bare base64url of H, so a 402 that carries H holds one
  Tempo `subscription` challenge at most: `place` refuses a Tempo `subscription` challenge in a 402 that holds another
  (`mpp/witness-taken`). The `mppx` SDK's `tempo.subscription()` offers one subscription challenge per currency, by
  default two on Tempo's mainnet and testnet; a seller placing H there names one `currency`. `challengeId(h, index)`
  writes the id and `challengeH(id)` reads H back.
- **The challenge's `opaque`** map carries `legalContext`, H's LCP string, and `legalContextUrl`, the link. Where the
  pairing's payment carries H in nothing public, it also carries `legalContextAgreementUrl`.

MPP binds the credential to the challenge it echoes, so whatever the payer signs over the challenge id, or over a
value derived from it, commits to H. Some methods also carry H in a request member; `CARRIER` names that member for
each intent and method. Where the payer signs it, as `externalId` on `solana` charges and `methodDetails.invoiceId` on
`xrpl`, it is in the payment.

The package reads a challenge's `id`, `request` and `opaque` as base64url without padding in its canonical form only
(RFC 4648 §3.5). One with `=` padding, or whose last character has a bit set past its last byte, is malformed:
`mpp/id-not-ours`, `mpp/request-malformed` and `mpp/opaque-malformed`, on every pairing. `read` passes over a challenge
whose `id` or `opaque` is in such a form, as it passes over one that carries no hash.

`issuedDigest(challenge)` is the digest of what the seller issued: SHA-256 over the RFC 8785 form of the bound
members, with `request` decoded and its `CARRIER` member left out, and `opaque` without the LCP members. The seller
compares the echoed challenge's digest with the one it recorded at issue. On a pairing whose quote or invoice the
seller writes after H (`mpp/charge/nearintents`, `mpp/charge/lightning` and `mpp/session/lightning`), `issuedDigest`
and `tie` read the challenge as the pairing's `unplaced` gives it, without the members written after H, so the
challenge sent once they are written has the digest of the one the ATR binds. A credential whose echoed `opaque` is the
object of its members, as `mppx` releases before 0.6.4 write it, is read by those members, as the base64url form is.

## Placing and reading

`place(doc, h, link, option, position, act?, agreementUrl?)` is the seller's placement over a list of challenges: the
challenge whose bound members equal `option` gets the id derived from H at `position` and an `opaque` holding the
seller's own map plus the LCP members. `place` writes only the id and `opaque`. On a method whose request carries H in
a member that `CARRIER` names, such as `externalId` on Solana, `methodDetails.invoiceId` on the XRP Ledger,
`methodDetails.splits` on Tempo and `methodDetails.metadata.legal_context` on Stripe, use the pairing's `advertise`,
which writes that member too.
`act` is `"payment"`, the default, or `"agreement"`. The seller gives each
challenge of a sale its own position, 0 to 31, its charge challenges and its agreement challenges together, since an
agreement challenge is sent in a response of its own; a Tempo `subscription` challenge takes `null`. A position that another challenge of the list already carries is
`mpp/position-taken`. `place`, and so each pairing's `advertise`, which takes the same arguments, refuses a list holding
a challenge that carries a `refused` member as `mpp/challenge-malformed`.
`read(doc)` is the buyer's reading: the challenges whose `opaque` carries an LCP hash and an `https` link and whose id
derives from that hash. `pairingsOf(challenge)` names the pairings a challenge offers, and `pairingsOfPlaced(challenge)`
those a placed challenge offers, with the Lightning invoice the seller's node writes after `place` required.
`tie(challenges)` is the ATR's binding slot: every challenge's bound members, as issued.

A challenge's `expires`, when present, is an RFC 3339 date-time, else `mpp/expires-required`. MPP's core makes it a
SHOULD for servers. A pairing needs it where its `build` writes it into what the payer signs: the EVM `authorization`
and `permit2` charges, the `usdc` EVM charge and the EVM and Tempo sessions; the NEAR Intents and XRP Ledger charge
drafts require it too. Without `expires` those pairings are left out of what `pairingsOf`, `advertise`, `build`, `bound`
and `reference` take, and a challenge left with no pairing is `mpp/expires-required`. The `lcp` method's filter also
refuses a charge challenge without it (`mpp/charge/lcp/hedera`).

```ts
import { hash, isRefusal } from "@integraledger/lcp";
import { challengeH, pairingsOf, place, read, type MppChallenge } from "@integraledger/lcp/mpp";

const request = Buffer.from(
  JSON.stringify({
    amount: "10000",
    currency: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
    methodDetails: {
      chainId: 84532,
      credentialTypes: ["permit2", "authorization"],
      permit2Address: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
    },
    recipient: "0x209693Bc6afc0C5328bA36FaF03C514EF312287C",
  }),
).toString("base64url");
const issued: MppChallenge = {
  id: "issued-by-the-seller",
  realm: "api.seller.example",
  method: "evm",
  intent: "charge",
  request,
  expires: "2026-09-21T14:14:20Z",
};
console.log(pairingsOf(issued));

const h = await hash(new TextEncoder().encode("abc"));
const placed = place([issued], h, "https://atr.seller.example/b3195b1f-4115-46b2-95a3-c9d61d7bfb01", issued, 0);
if (isRefusal(placed)) throw new Error(placed.code);
const id = placed[0]!.id!;
console.log(id, challengeH(id) === h);
console.log(Buffer.from(placed[0]!.opaque!, "base64url").toString());

const offer = read(placed);
if (isRefusal(offer)) throw new Error(offer.code);
console.log(offer.h === h, offer.offer.challenges.length);
```

```text
[ 'mpp/charge/evm/permit2', 'mpp/charge/evm/authorization' ]
ungWv48Bz-pBQUDeXa4iI7ADYaOWF3qctBD_YfIAFa0.0 true
{"legalContext":"lcp:sha256:0xba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad","legalContextUrl":"https://atr.seller.example/b3195b1f-4115-46b2-95a3-c9d61d7bfb01"}
true 1
```

## The fields

MPP carries its three forms in HTTP fields, and the package writes and reads each as the `mppx` SDK (0.17.6) does:

- `encodeChallenge(challenge)` writes one challenge as a `WWW-Authenticate` field value: `Payment`, then each member
  the challenge holds as a quoted-string, in the order `id`, `realm`, `method`, `intent`, `request`, `description`,
  `digest`, `expires`, `header`, `opaque`. It writes the members as given, `request` and `opaque` in the base64url
  `place` and `advertise` write, and only a value `parseChallenges` reads back as the same members: a challenge missing
  `id`, `realm`, `method`, `intent` or `request`, or holding one empty, a `header` other than
  `Payment-Authorization`, the one value MPP allows it, a member holding a control character or a character above
  U+00FF, which no quoted-string carries, or a value over 8,192 characters is `mpp/challenge-malformed`. A 402 offering several challenges sends one `WWW-Authenticate` field line for each.
  `parseChallenges(fieldValues)` parses `WWW-Authenticate` field values into challenges.
- `decodeCredential(fieldValue)` reads the credential from the field the challenge selected, `Authorization`, or
  `Payment-Authorization` where the challenge carries `header`: `Payment`, in any case, one or more spaces and the
  credential's JSON in base64url without padding, at most 65,536 bytes, held to the shape every `bound` reads first.
  Any other value is `mpp/credential-malformed`. It reads nothing else: the challenge's id and H are
  `challengeBound`'s to check ([The server's order](#the-servers-order)).
- `encodeCredential(credential)` writes the value a buyer's client sends in that field, which `decodeCredential`
  reads back, as `mppx` writes it: `Payment`, a space and the credential's JSON in base64url without padding, the
  challenge's members in their order with `opaque` and then `request` last, then `payload`, then `source`. It leaves
  out the echoed challenge's `meta` and an empty `source`, as `mppx` does, and writes every other member as given. A
  credential `decodeCredential` would refuse, or one that is not JSON (a `bigint`, an `undefined` inside the payload),
  is `mpp/credential-malformed`.
- `encodeReceipt(receipt)` writes the `Payment-Receipt` field value of a successful response: the receipt's JSON, in
  its own member order, in base64url without padding. A receipt whose `status` is not `success`, whose `method` is not
  lowercase ASCII letters, whose `timestamp` is not an RFC 3339 date-time or whose `reference` is not a string is
  `mpp/receipt-malformed`. A method's own receipt members, such as `externalId`, are written as given.
- `decodeReceipt(fieldValue)` reads the receipt a buyer's client finds in a successful response's `Payment-Receipt`
  field: base64url without padding in its canonical form, at most 65,536 bytes (`MAX_HEADER_BYTES`), of a JSON object
  that `encodeReceipt` would write, every member kept as given. Any other value, a longer or padded one among them, is
  `mpp/receipt-malformed`. The receipt is what the seller reports; it reads
  no payment.

`problem(code)` gives the Payment scheme's problem type and HTTP status for a refusal code this package returns
([Answering the buyer](#answering-the-buyer)).

## The MPP pairings

Every MPP pairing in the registry. `Confirmed` is `yes` where something outside this package has shown the form as its
profile defines it, and `no` where nothing has yet.

| Method | Pairings | Where H rides in what the payer signs or lands | Confirmed |
|---|---|---|---|
| `evm` | `mpp/charge/evm/authorization` | The EIP-3009 nonce: keccak256 of the challenge id and realm (`challengeHash`). | yes |
| `evm` | `mpp/charge/evm/permit2` | The Permit2 witness's `challengeHash`, keccak256 of the challenge id and realm. | no |
| `evm` | `mpp/charge/evm/transaction`, `mpp/charge/evm/hash` | Nothing signed or landed; H is in the challenge. On `transaction`, `build`'s `complete` takes an EIP-1559 transaction, else `mpp/credential-malformed`, signed for the challenge's `methodDetails.chainId`, else `evm/chain-mismatch`, as draft-evm-charge-00's transaction verification reads it. | yes |
| `tempo` | `mpp/charge/tempo/split-memo` | The memo of the one `transferWithMemo` call to `currency` whose memo is H: the split `{recipient, amount: "1", memo: H}` that the pairing's `advertise` appends to `methodDetails.splits`, and that the stock client copies into the transaction the payer signs. The resource server's settler broadcasts it. | yes |
| `tempo` | `mpp/charge/tempo/split-memo/push` | As on `mpp/charge/tempo/split-memo`, in a transaction the payer broadcasts and names by its hash, which `fetchPresented` reads. | yes |
| `solana` | `mpp/charge/solana`, `mpp/charge/solana/unsponsored` | The one LCP-form Memo instruction, holding H's LCP string (the request's `externalId`); other Memo instructions, such as split labels, are not read. The first pairing is a challenge whose `methodDetails.feePayer` is `true`, the second any other. | yes |
| `xrpl` | `mpp/charge/xrpl` | The Payment's `InvoiceID`: H itself (the request's `methodDetails.invoiceId`), in a Payment the payer signs with a single key. The Payment carries no `NetworkID`: each network the challenge names has an id of at most 1024, where rippled refuses one, so a blob that carries it is `xrpl/network-mismatch`, which `build`'s `complete`, reading the blob as `bound` does, also gives. | yes |
| `lightning` | `mpp/charge/lightning` | The BOLT11 invoice's description hash `h`, which the seller's node signs. | no |
| `usdc` | `mpp/charge/usdc/evm`, `mpp/charge/usdc/gateway` | The EIP-3009 nonce, or the Gateway burn intent's salt: `usdc`'s derivation over the challenge id. | yes: `mpp/charge/usdc/evm`; no: `mpp/charge/usdc/gateway` |
| `usdc` | `mpp/charge/usdc/solana`, `mpp/charge/usdc/stacks` | The signed LCP-form Memo instruction (H's LCP string), or the SIP-010 `transfer` memo (H's 32 bytes). The Stacks transaction is signed for the challenge's `chainId`, which `build`'s request names, at that network's version, 0x00 on chain 1 (mainnet) and 0x80 on any other, as a Stacks node requires, else `stacks/chain-mismatch`, which `build`'s `complete` also gives it. | yes: `mpp/charge/usdc/solana`; no: `mpp/charge/usdc/stacks` |
| `nearintents` | `mpp/charge/nearintents` | The request's `externalId`; the deposit carries nothing. | no |
| `lcp` | `mpp/charge/lcp/hedera` | The memo of the `TransferTransaction` body the buyer signs, H's LCP string, on the method's `hedera` rail. `methodDetails.supportedModes` must be `["pull"]` (`mpp/modes-not-pull`), and the challenge must state `expires`; the LCP profile [`mpp/method/lcp`](https://lcp.integraledger.com/profiles/mpp-method-lcp.md) states the rules. | yes |
| `card`, `stripe` | `mpp/charge/card`, `mpp/charge/stripe`, `mpp/subscription/stripe` | The request's `externalId`, or `methodDetails.metadata.legal_context`, which on a `stripe` charge the seller's server copies into the PaymentIntent it creates at settlement; MPP's Stripe subscription method does not say where the metadata goes. The buyer's card or token signs nothing that carries H. | no |
| sessions | `mpp/session/evm`, `mpp/session/tempo`, `mpp/session/xrpl`, `mpp/session/lightning`, `mpp/session/solana/memo` | Where the channel opens. See [Channels, sessions and subscriptions](https://lcp.integraledger.com/guides/sessions.md). | yes: `mpp/session/tempo`; no: `mpp/session/evm`, `mpp/session/xrpl`, `mpp/session/lightning`, `mpp/session/solana/memo` |
| sessions | `mpp/session/xrpl/stock`, `mpp/session/solana/stock`, `mpp/session/hedera/stock` | Nothing: the stock client opens the channel, so the session is served only after an agreement on its own network (coverage `none`), and `bound` refuses `mpp/no-signed-place`. | yes: `mpp/session/solana/stock`; no: `mpp/session/xrpl/stock`, `mpp/session/hedera/stock` |
| subscription | `mpp/subscription/tempo` | The key authorization the payer's root key signs, whose witness is H. | yes |
| subscription | `mpp/subscription/solana` | The Memo instruction of the activation, H's LCP string (the request's `externalId`). | no |

On `mpp/charge/nearintents`, both Tempo charges, the three stock sessions and `mpp/subscription/solana`, the payer's own
client builds the payment, and the pairing has no `build`.

`challengeHash` is keccak256 of the UTF-8 of `JSON.stringify([id, realm])`: the id and realm framed as a JSON array of
two strings, as the `mppx` SDK computes it from 0.13.1, so that no two pairs share a preimage (`"ab"` and `"c"`, `"a"`
and `"bc"`). MPP's EVM charge draft (draft-evm-charge-00) still writes `abi.encodePacked(id, realm)`, the bare
concatenation; a credential signed over that form is `mpp/nonce-not-challenge-hash`, or
`mpp/witness-not-challenge-hash` for `permit2`.

The challenge's `id` and `realm` are hashed as UTF-8. A string holding a lone surrogate has no UTF-8 form, so a
challenge whose `realm` is not a well-formed string is `mpp/challenge-malformed` in `pairingsOf`, `place` and `build`,
and in every `bound`, and in each `reference` and `fetchPresented` that reads H from a credential's echoed challenge. An
`id` that is not a well-formed string derives from no H: every `bound`, and every `build`, refuses it `mpp/id-not-ours`.

Each pairing that this package builds for has a `build(choice, h)`, which takes the chosen challenge (`MppChoice`) and
returns what the buyer signs; on card and Stripe, where nothing the buyer signs can carry H, it refuses
`mpp/no-signed-place`. Its `bound(credential)` reads H from the echoed challenge and, where the payer signs a value that
carries it, checks that value; where nothing signed carries H, the card, Stripe and EVM `transaction` and `hash`
pairings and the three stock sessions (`mpp/session/solana/stock`, `mpp/session/xrpl/stock` and
`mpp/session/hedera/stock`) refuse `mpp/no-signed-place`. `reference` and `status` read the settlement where the method
lands on a chain. In push mode, where the buyer broadcasts and presents only the transaction's hash or signature,
`fetchPresented(credential, reader)` reads the landed transaction first, and
refuses one that failed: `svm/err` on Solana, which it gives only once a read at `finalized` holds the transaction with
its error (`svm/not-final` when the error is at `confirmed` and that read does not hold the transaction yet), and
`xrpl/not-success` on the XRP Ledger, which it reads only once the transaction is in a validated ledger
(`xrpl/not-validated` before that). A read that fails, cannot yet read the landed payment, or reads a revert or error
that is not final yet is a read to repeat, not a refusal of the payment: the seller asks again later.
`readToRepeat(code)`, from the package root, is true for each such code ([Reads to
repeat](https://lcp.integraledger.com/concepts/refusals.md#reads-to-repeat)).

`fetchPresented` returns the credential with what it read written under one member, keyed by the registered symbol
`FETCHED`, `Symbol.for("@integraledger/lcp/fetched")`, which `@integraledger/lcp`, `@integraledger/lcp/mpp` and
`@integraledger/lcp/hedera` export: the landed transaction on the Solana charge, and the signed blob on the XRP Ledger
charge. `bound` and `reference` read the seller's read from that member and from no other. A credential's own push
`transaction` or `blob` member, or any other string-keyed member, is never read: a credential that arrives with one
gives the answer the same credential without it gives, `<rail>/read-first` where the read is needed. No wire form
carries a symbol-keyed member: `JSON.parse` makes none, and `JSON.stringify` and `structuredClone` drop it. So the
seller keeps the object `fetchPresented` returned, or a spread or `Object.assign` copy of it, both of which copy the
member; a copy made through JSON or `structuredClone` is read as a credential `fetchPresented` has not read. Calling
`bound` first, and `fetchPresented` when it answers `<rail>/read-first`, reads only what the seller's reader read.

`mpp/charge/evm/authorization`, `mpp/charge/evm/permit2` and `mpp/charge/usdc/evm` are pull pairings: the payer signs
an authorization that the server executes later. Each gives `authorizer(credential)`, the account whose signature
authorises the pull, and its reference's `authorization` names the nonce the payer signed (the challenge-derived value,
not H), the deadline, the token and the contract that records the nonce's use, for `authorizationUsed` in
`@integraledger/lcp/evm`. `status` on `mpp/charge/evm/permit2` counts a Permit2 witness transfer of the payer's, found
at any byte offset of the transaction's input, that carries that nonce or the challenge's witness word, where the
receipt holds its `Transfer`s and the payer's bit for the nonce is set at the receipt's block and unset at the block
before, as on x402's Permit2 pairings.

`reference(credential, challenge)` and `status(ref, reader, query)` take and answer as on x402: `status` answers
`settled`, `pending`, `failed` or `unreadable`, with one reason of the closed list
[the x402 guide](https://lcp.integraledger.com/guides/x402.md#reading-the-payment) gives. On the EVM and `usdc` EVM charges, it answers `failed`
(`transaction-failed`, `instrument-consumed`, `instrument-unused` or `before-position`) only from a read at the
reader's `finalized` mark and, where the payer's signed act carries H, only once the search is whole. A failed result
read above that mark is pending `below-mark` ([Reading settlement](https://lcp.integraledger.com/guides/rails.md#reading-settlement)).

The LCP profile [`mpp/charge`](https://lcp.integraledger.com/profiles/mpp-charge.md) states where each charge carries H.

### How the pairings hold a challenge and a credential

`bound`, `reference` and `fetchPresented` start from the echoed challenge's H, require its intent and method to be the
pairing's, and hold the echoed challenge to the pairing's filter: `pairingsOf`'s checks over it as placed, which must
name the pairing (`pairingsOfPlaced`). A challenge those checks refuse gives their code, and one that offers only other
pairings (another credential type, mode or `usdc` profile, or no `expires` where the pairing needs it) is
`mpp/not-this-pairing`, as `advertise` and `build` answer for the same challenge. Every MPP `build` that takes a chosen
challenge holds it as `bound` holds an echoed one, before it builds anything. It reads the challenge as `bound` reads
its JSON form: a snapshot of its own members (`realm`, `method`, `intent`, `request`, `id`, `expires`, `digest`,
`description`, `header` and `opaque`), so a member the challenge inherits counts as absent. It reads the challenge only
from that snapshot, and the credential its `complete` returns carries the snapshot, so a change made to the caller's
challenge after `build` does not reach the credential. Each fault in the challenge gets `bound`'s code, in `bound`'s
order: a challenge that is not an object, is not challenge-shaped or has no string id, or whose least credential, `{
challenge, payload: {} }`, is over the credential size bound (`mpp/credential-malformed`); its realm; an id that derives
from H; an `opaque` that names that H (else `mpp/opaque-not-this-hash`); its request; its intent and method; and the
same filter. An id that derives from an H other than the one `build` is given is then `mpp/id-not-ours`. A fault in an
argument other than the challenge keeps the build's own code: a choice that is not an object (`mpp/input-malformed`, or
`svm/input-malformed` on the Solana charges and `mpp/credential-malformed` on Lightning), and the payer, token domain,
spender, deposit and each other value the choice carries. So no `complete` is handed a challenge `bound` refuses.
`pairingsOf` makes every check `build`, `bound` and `reference` make on the challenge alone: on Lightning, that the
invoice decodes strictly, as `decodeBolt11` decodes it, with one `h` field and no `d`, carries the request's payment
hash and the currency of the `network` the challenge names, and expires no earlier than the challenge; on the Solana
charges, no `splits` or `confidential` transfer and the form of the `decimals`, `tokenProgram` and `recentBlockhash` the
build writes; on Permit2, an `amount` above its `splits`; on the XRP Ledger charge, no `memos`; the XRPL session
recipient's checksum; the Tempo subscription's period and expiry within the key authorization's uint64; and, on `usdc`'s
EVM and Gateway profiles, a request in its RFC 8785 form. So no pairing binds a payment presented under a challenge
`pairingsOf` would not name for it. Of a challenge the filter takes, each function reads only the request members its
own read keys or derivation use, such as the network or chain, the currency, the recipient, the escrow, the member that
carries H, and `expires` where it is the payment's deadline; on the Lightning charge and session, the read keys name the
network of the invoice's currency. The EVM `transaction` and `hash` charges' `bound` then refuses a credential of
another type (`mpp/credential-type`) and every other (`mpp/no-signed-place`), and a `fetchPresented` given a signed
transaction returns it as given.

The `complete` of each `build` that makes a credential measures it as `bound` measures every credential, its echoed
challenge included, and refuses one over the credential size bound, 64 KiB, with `mpp/credential-malformed`, the code
`bound` gives it, whatever the challenge's own size. It holds the payment it carries to the size `bound` reads it at
too: the XRP Ledger charge's signed blob to 8,192 hex digits, the stock server's bound (`xrpl/blob-too-large`). So no `build`'s `complete` returns
a credential `bound` refuses for its size. It checks in `bound`'s order, measuring the credential before it reads the
payment: a payment fault in a credential over the bound, such as a `usdc` Stacks transaction over 16,384 bytes or a
Tempo key authorization over 8,192 bytes, is `mpp/credential-malformed`, as `bound` gives it. One rule covers the
credentials in a channel too: a `buildWithin`'s `complete` measures the in-channel credential it would return, and a
session pairing's `channel.kind`, `channel.ref` and `channel.boundWithin` measure the payment they are given before they
read it, with the same bound and code, except the Stripe subscription's, which read only the activation receipt.

## The server's order

A resource server makes two checks a stock MPP server does not make, and makes them before anything can move money
([`mpp/charge`](https://lcp.integraledger.com/profiles/mpp-charge.md), rule 10):

1. **The challenge belongs to this agreement.** `challengeBound(credential, recorded)`, given the credential
   `decodeCredential` reads from the request, gives `{ h, request }`, H and
   the echoed challenge's decoded request, where the echoed challenge's id and `opaque` name H and the id is, whole,
   `recorded`, the id the server recorded when it issued that challenge (else `mpp/id-not-ours`; a `recorded` that is
   not such an id is `mpp/input-malformed`); and `issuedDigest` of the echoed challenge equals the digest the server recorded
   for H: from the ATR's binding slot (`tie`), or, for an agreement challenge, which no slot holds, the digest it
   recorded for its agreement option. `place(doc, h, link, option, position, "agreement", agreementUrl)`, and each
   pairing's `advertise` given the same arguments, composes an agreement challenge only where it states `expires` (else
   `mpp/expires-required`); composed anew once that `expires` has passed, in the position of the one it replaces, it
   keeps that challenge's id, and a credential of the replaced challenge is refused at `issuedDigest`.
2. **The payment carries H.** The pairing's `bound`, which checks how the credential carries H, or its link, and never
   what the payment pays. For a credential whose payer already broadcast the payment, `fetchPresented` reads the landed
   transaction first, and `bound` refuses `<rail>/read-first` until then. Where the payer signs nothing that carries H
   (`card`, `stripe`, an EVM `transaction` or `hash`, and the three stock sessions, `mpp/session/solana/stock`,
   `mpp/session/xrpl/stock` and `mpp/session/hedera/stock`), `bound` refuses `mpp/no-signed-place`, and the second
   check is the pairing's `link` and the server's own record that the agreement for this H is recorded.

Then validation that moves nothing, where the method's library separates it; then the server's own record that this H's
agreement or payment is now taken, once for each H and act; and only then any call that can move money. The vectors are
`mpp-server-checks.json`.

`toX402(credential, token, issued)` maps an `evm` `authorization` credential or a `usdc` EVM credential to x402's
`exact` EIP-3009 `PaymentPayload` and `PaymentRequirements`, so a resource server that already runs an x402 facilitator
settles it there as step 4 ([`mpp/charge`](https://lcp.integraledger.com/profiles/mpp-charge.md), rule 12). `token` is the token's EIP-712 `{name, version}`, which no MPP
challenge carries, and `issued` the Unix second at which the server issued the challenge: `maxTimeoutSeconds` is the
challenge's `expires` less `issued`. Any other credential is `mpp/no-x402-twin`; a challenge with no `expires` is
`mpp/expires-required`.

## Answering the buyer

`problem(code)` maps a refusal code this package returns to the Payment scheme's status codes and problem types, under
`https://paymentauth.org/problems/`:

| Code | Status | Problem type |
|---|---|---|
| `mpp/credential-malformed`, `mpp/request-malformed`, `mpp/opaque-malformed` | 402 | `malformed-credential` |
| `mpp/id-not-ours` | 402 | `invalid-challenge` |
| A read to repeat, a code `readToRepeat` answers true for: each rail's `<rail>/not-found` and `<rail>/unreadable` (such as `tempo/not-found` and `svm/unreadable`), `casper/not-executed`, `ccd/not-finalized`, `xrpl/not-validated`, `evm/not-final`, `polkadot/not-final`, `stacks/not-final`, `starknet/not-final`, `svm/not-final` and `tempo/not-final` | 500 | `internal-payment-error` |
| A call that cannot read the payment: `tempo/wrong-reader`, `svm/wrong-reader`, `xrpl/wrong-reader`, `hedera/wrong-reader`, `tempo/read-first`, `svm/read-first`, `xrpl/read-first`, `hedera/read-first` | 500 | `internal-payment-error` |
| Every other code this package returns | 402 | `verification-failed` |
| A code this package does not return | 500 | `internal-payment-error` |

A read to repeat is a code `readToRepeat` answers true for, such as what a `fetchPresented` or `recover` returns when
its read fails, cannot yet read the landed payment, or reads a revert, an error or a verdict that is not final yet:
the seller asks again later ([Reads to repeat](https://lcp.integraledger.com/concepts/refusals.md#reads-to-repeat)). A call that cannot read the
payment is the seller's own call: a reader that is not
for the network the challenge or reference names, or an input `recover({ network, tx, option }, reader)` cannot read:
one that is not an object, or whose `tx` is not in its rail's form (a 32-byte hash on Tempo, a signature, base58 of 64
bytes, on Solana, 64 hex digits on XRPL) (`<rail>/wrong-reader`), or `bound` or `reference` on a push credential before `fetchPresented` has
read it (`<rail>/read-first`). The same call gives the same code until the
seller changes it. In both, the payment may already have moved, so the seller sends no fresh challenge the buyer could
pay a second time. Answer a 402 with a fresh challenge and a 500 with none: a challenge goes out only with a 402, and
neither carries `Payment-Receipt`, which only a successful response carries (`encodeReceipt`). Any other code is the
caller's to answer: `problem` gives it 500 `internal-payment-error`, never a 402.
