mpp
Interfaces
MPPMethodHandler
Defined in: packages/types/src/mpp/handler.ts:16Properties
capabilities
capabilities: HandlerCapabilities
Defined in: packages/types/src/mpp/handler.ts:18
method
method: string
Defined in: packages/types/src/mpp/handler.ts:17
Methods
getChallenge()
getChallenge(Defined in: packages/types/src/mpp/handler.ts:20intent,pricing,resourceURL,opts?):Promise<{description?:string;digest?:string;expires?:string;id:string;intent:string;method:string;opaque?:string;realm:string;request:string; }>
Parameters
intent
string
pricing
ResourcePricing
resourceURL
string
opts?
ChallengeOpts
Returns
Promise<{ description?: string; digest?: string; expires?: string; id: string; intent: string; method: string; opaque?: string; realm: string; request: string; }>
getSupportedIntents()
getSupportedIntents(): string[]
Defined in: packages/types/src/mpp/handler.ts:19
Returns
string[]
handleSettle()
handleSettle(Defined in: packages/types/src/mpp/handler.ts:26credential):Promise<null| {method:string;reference:string;status:"success"|"failed";timestamp:string; }>
Parameters
credential
challenge
{description?: string; digest?: string; expires?: string; id: string; intent: string; method: string; opaque?: string; realm: string; request: string; } = mppChallengeParams
challenge.description?
string = "string"
challenge.digest?
string = "string"
challenge.expires?
string = "string"
challenge.id
string = "string"
challenge.intent
string = "string"
challenge.method
string = "string"
challenge.opaque?
string = "string"
challenge.realm
string = "string"
challenge.request
string = "string"
payload
Record<string, unknown> = "Record<string, unknown>"
source?
string = "string"
Returns
Promise<null | { method: string; reference: string; status: "success" | "failed"; timestamp: string; }>
Type Aliases
ChallengeOpts
ChallengeOpts = object
Defined in: packages/types/src/mpp/handler.ts:12
Server-side handler for an MPP payment method.
Named after the spec’s concept of a “payment method” — the mechanism
for transferring value (e.g. “solana”). A method handler supports one
or more intents (e.g. “charge”).
Properties
digest?
Defined in: packages/types/src/mpp/handler.ts:13optionaldigest:string
mppChallengeParams
mppChallengeParams = typeof mppChallengeParams.infer
Defined in: packages/types/src/mpp/types.ts:8
mppCredential
mppCredential = typeof mppCredential.infer
Defined in: packages/types/src/mpp/types.ts:22
MPPPaymentExecer
MPPPaymentExecer = object
Defined in: packages/types/src/mpp/handler.ts:32
Result of executing an MPP payment on the client side.
Properties
challenge
challenge: mppChallengeParams
Defined in: packages/types/src/mpp/handler.ts:33
Methods
exec()
exec():Defined in: packages/types/src/mpp/handler.ts:34Promise<{challenge: {description?:string;digest?:string;expires?:string;id:string;intent:string;method:string;opaque?:string;realm:string;request:string; };payload:Record<string,unknown>;source?:string; }>
Returns
Promise<{ challenge: { description?: string; digest?: string; expires?: string; id: string; intent: string; method: string; opaque?: string; realm: string; request: string; }; payload: Record<string, unknown>; source?: string; }>
MPPPaymentHandler()
MPPPaymentHandler = (Defined in: packages/types/src/mpp/handler.ts:43 Client-side handler that matches MPP challenges and produces credentials. Returns null when the challenge does not match this handler’s method or intent, allowing multiple handlers to be composed.challenge) =>Promise<MPPPaymentExecer|null>
Parameters
challenge
mppChallengeParams
Returns
Promise<MPPPaymentExecer | null>
mppReceipt
mppReceipt = typeof mppReceipt.infer
Defined in: packages/types/src/mpp/types.ts:30
Variables
AUTHORIZATION_HEADER
Defined in: packages/types/src/mpp/types.ts:4constAUTHORIZATION_HEADER:"Authorization"="Authorization"
MPP_PAYMENT_SCHEME
Defined in: packages/types/src/mpp/types.ts:6constMPP_PAYMENT_SCHEME:"Payment"="Payment"
mppChallengeParams
Defined in: packages/types/src/mpp/types.ts:8constmppChallengeParams:Type<{description?:string;digest?:string;expires?:string;id:string;intent:string;method:string;opaque?:string;realm:string;request:string; }, { }>
mppCredential
Defined in: packages/types/src/mpp/types.ts:22constmppCredential:Type<{challenge: {description?:string;digest?:string;expires?:string;id:string;intent:string;method:string;opaque?:string;realm:string;request:string; };payload:Record<string,unknown>;source?:string; }, { }>
mppReceipt
Defined in: packages/types/src/mpp/types.ts:30constmppReceipt:Type<{method:string;reference:string;status:"success"|"failed";timestamp:string; }, { }>
PAYMENT_RECEIPT_HEADER
Defined in: packages/types/src/mpp/types.ts:5constPAYMENT_RECEIPT_HEADER:"Payment-Receipt"="Payment-Receipt"
WWW_AUTHENTICATE_HEADER
Defined in: packages/types/src/mpp/types.ts:3constWWW_AUTHENTICATE_HEADER:"WWW-Authenticate"="WWW-Authenticate"
Functions
canonicalizeSortedJSON()
canonicalizeSortedJSON(Defined in: packages/types/src/mpp/encoding.ts:38 Sorted-key JSON canonicalization following RFC 8785 JCS for the subset of inputs used by MPP (string keys, no integer-indexed properties). Integer-indexed keys would violate RFC 8785 sort order due to ECMAScript property enumeration rules.obj):string
Parameters
obj
unknown
Returns
string
computeBodyDigest()
computeBodyDigest(Defined in: packages/types/src/mpp/encoding.ts:165 Computes an RFC 9530 content digest for a request body. Format:body):Promise<string>
sha-256=:base64value:
Parameters
body
ArrayBuffer
Returns
Promise<string>
decodeBase64URL()
decodeBase64URL(Defined in: packages/types/src/mpp/encoding.ts:21encoded):string
Parameters
encoded
string
Returns
string
encodeBase64URL()
encodeBase64URL(Defined in: packages/types/src/mpp/encoding.ts:9input):string
Parameters
input
string
Returns
string
formatWWWAuthenticate()
formatWWWAuthenticate(Defined in: packages/types/src/mpp/encoding.ts:58challenges):string
Parameters
challenges
object[]
Returns
string
parseAuthorizationPayment()
parseAuthorizationPayment(Defined in: packages/types/src/mpp/encoding.ts:125header):undefined| {challenge: {description?:string;digest?:string;expires?:string;id:string;intent:string;method:string;opaque?:string;realm:string;request:string; };payload:Record<string,unknown>;source?:string; }
Parameters
header
string
Returns
undefined | { challenge: { description?: string; digest?: string; expires?: string; id: string; intent: string; method: string; opaque?: string; realm: string; request: string; }; payload: Record<string, unknown>; source?: string; }
parseReceipt()
parseReceipt(Defined in: packages/types/src/mpp/encoding.ts:171header):undefined| {method:string;reference:string;status:"success"|"failed";timestamp:string; }
Parameters
header
string
Returns
undefined | { method: string; reference: string; status: "success" | "failed"; timestamp: string; }
parseWWWAuthenticate()
parseWWWAuthenticate(Defined in: packages/types/src/mpp/encoding.ts:93 Parses a WWW-Authenticate header value containing one or more Payment challenges. Each challenge starts with the token “Payment” followed by auth-param key=value pairs.header):object[]
Parameters
header
string
Returns
object[]
resolveMPPChallenges()
resolveMPPChallenges(Defined in: packages/types/src/mpp/handler.ts:63 Generates MPP challenges by matching pricing entries to handlers. For each handler, matches pricing by capabilities, then calls getChallenge for each matched pricing entry and each supported intent. The middleware emits all challenges; the client picks one.handlers,pricing,resourceURL,opts?):Promise<object[]>
Parameters
handlers
MPPMethodHandler[]
pricing
ResourcePricing[]
resourceURL
string
opts?
ResolveOpts
Returns
Promise<object[]>
serializeCredential()
serializeCredential(Defined in: packages/types/src/mpp/encoding.ts:153credential):string
Parameters
credential
challenge
{description?: string; digest?: string; expires?: string; id: string; intent: string; method: string; opaque?: string; realm: string; request: string; } = mppChallengeParams
challenge.description?
string = "string"
challenge.digest?
string = "string"
challenge.expires?
string = "string"
challenge.id
string = "string"
challenge.intent
string = "string"
challenge.method
string = "string"
challenge.opaque?
string = "string"
challenge.realm
string = "string"
challenge.request
string = "string"
payload
Record<string, unknown> = "Record<string, unknown>"
source?
string = "string"
Returns
string
serializeReceipt()
serializeReceipt(Defined in: packages/types/src/mpp/encoding.ts:157receipt):string
Parameters
receipt
method
string = "string"
reference
string = "string"
status
"success" | "failed" = “‘success’|‘failed‘“
timestamp
string = "string"
Returns
string
settleMPPPayment()
settleMPPPayment(Defined in: packages/types/src/mpp/handler.ts:114 Routes an MPP credential to the appropriate handler for settlement. Filters handlers by exact method match against the credential’s challenge method, then iterates handleSettle until one returns a non-null result.handlers,credential):Promise<{method:string;reference:string;status:"success"|"failed";timestamp:string; }>
Parameters
handlers
MPPMethodHandler[]
credential
challenge
{description?: string; digest?: string; expires?: string; id: string; intent: string; method: string; opaque?: string; realm: string; request: string; } = mppChallengeParams
challenge.description?
string = "string"
challenge.digest?
string = "string"
challenge.expires?
string = "string"
challenge.id
string = "string"
challenge.intent
string = "string"
challenge.method
string = "string"
challenge.opaque?
string = "string"
challenge.realm
string = "string"
challenge.request
string = "string"
payload
Record<string, unknown> = "Record<string, unknown>"
source?
string = "string"
Returns
Promise<{ method: string; reference: string; status: "success" | "failed"; timestamp: string; }>