mppx.validateCredential
Pre-check a Credential
Validates a Credential without settling, reserving, or broadcasting payment.
Usage
Use validateCredential before a later broadcastCredential call when your application needs a non-mutating payment check.
import { , } from 'mppx/server'
const = .({ : [.()] })
const = await .('Payment credential="..."', {
: {
: '0.10',
: '0x20c0000000000000000000006a37DA5C996874BE', // OUSD on Tempo
: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
},
: 'GET /v1/report',
})
.(.)
.(.)
0x70997970C51812dc3A010C7d01b50e0d17dc79C8validateCredential is an advisory pre-check. Call broadcastCredential to accept payment.
Tempo charge and Session methods and EVM charge implement this lifecycle. For an EVM Credential, validation checks the signature, Challenge binding, payment terms, validity window, and source. Facilitator-backed methods also call the facilitator's non-mutating verification endpoint without settling. Custom EVM settlers remain responsible for chain-state checks and replay protection.
validation.payer is optional and comes from the verified payment payload. Tempo and EVM charges report the recovered payer address; its method-specific format may differ from the Credential source.
For a Session Credential, validation checks the channel, action, signature, and voucher state without accepting the voucher or updating channel accounting.
Return type
type ReturnType = Promise<Method.Validation>Parameters
capturedRequest (optional)
- Type:
Method.CapturedRequest
Authoritative request snapshot used by method hooks.
credential
- Type:
string | Credential
Serialized Payment Credential field value or parsed Credential object.
meta (optional)
- Type:
Record<string, string>
Expected Challenge metadata. Route comparison excludes the reserved _mppx_nonce issuance key; the Challenge HMAC still authenticates it. Clients return opaque unchanged.
realm (optional)
- Type:
string
Expected Challenge realm.
request (optional)
- Type:
Record<string, unknown>
Expected method request parameters.
scope (optional)
- Type:
string
Expected route or resource scope bound to the Challenge.