API Reference mpp v#0.14.0

Copy Markdown View Source

Modules

MPP

Elixir implementation of the Machine Payments Protocol (MPP).

Parse, format, and rank the Accept-Payment client-preference header.

Amount and decimal helpers for converting human-readable amounts to base units.

SHA-256 body digest computation and verification.

Payment challenge — the 402 response that tells a client what to pay.

Gates Accept-Payment header injection on outgoing HTTP requests.

Payment-aware MCP client orchestration.

Wraps multiple payment providers and dispatches to the first match.

Behaviour for client-side payment providers.

Built-in Stripe charge provider using Shared Payment Tokens (SPTs).

Built-in Tempo charge provider.

Payment-aware Req plugin.

Returned when payment-aware retry cannot complete a 402 challenge.

Transport-neutral challenge selection and ordering.

Behaviour for client-side transports that bridge a protocol response/request pair and the MPP payment flow.

HTTP implementation of MPP.Client.Transport over Req.

JSON-RPC implementation of MPP.Client.Transport for generic (non-MCP) RPC.

JSON-RPC implementation of MPP.Client.Transport for MCP.

Reconnect and payment-retry policy for MPP-over-WebSocket.

Shared base64url→JSON token decoding for the wire-format modules (MPP.Credential, MPP.Receipt, MPP.Methods.Tempo.SessionReceipt).

Payment credential — the client's response to a 402 challenge.

Decentralized identifier (DID) helpers for MPP credential sources.

Demo payment method — accepts a magic token for local testing.

Demo router for mix mpp.demo — serves a protected endpoint behind MPP.

Generates OpenAPI 3.1.0 discovery documents for MPP-enabled HTTP operations.

Parser and normalizer for the discovery specification's x-payment-info extension.

RFC 9457 Problem Details for MPP payment errors.

Expiration timestamp helpers for MPP challenges.

Parse and format the three MPP protocol wire-format headers.

Small internal hex-string helpers shared across the payment-method and wire-format modules.

Shared contract implemented by payment-intent schemas.

Charge intent request schema — the "Intent = Schema" half of MPP.

Session intent request schema — the "Intent = Schema" half of MPP for pay-as-you-go / metered sessions.

Shared recurring-subscription intent schema.

RFC 8785 JSON Canonicalization Scheme (JCS) — MPP subset.

MCP (Model Context Protocol) payment transport helpers.

Behaviour for pluggable payment method verification.

Generic EVM payment method — verifies on-chain ERC-20 or native ETH transfers.

EIP-3009 transferWithAuthorization credential for Circle USDC/EURC.

NEAR Intents charge method backed by the 1Click Swap API.

Solana payment method — verifies native SOL and SPL token charge payments.

Parse and match Solana payment instructions for MPP.Methods.Solana.

Stripe payment method for one-time charges and recurring subscriptions.

Stripe Billing activation for the shared subscription intent.

Tempo payment method — verifies payment via on-chain TIP-20 token transfer.

Sponsor (fee-payer) gas-economics policy for Tempo transactions.

Hosted Tempo fee-payer JSON-RPC fill support.

Tempo subscription key-authorization wire codec and verifier.

Canonical first-party machine-token (MPP Credits / machineUSD) charge routes.

EIP-712 proof credentials for zero-amount Tempo charge flows.

Session-intent receipt for Tempo — returned in the Payment-Receipt header for session/pay-as-you-go payments.

Atomic aggregate in-flight accounting for Tempo fee sponsorship.

Tempo recurring-subscription activation and renewal.

Plug middleware implementing the MPP 402 payment handshake.

Validated configuration for MPP.Plug.

Per-method configuration within a multi-method endpoint.

Payment receipt — proof-of-payment returned in the Payment-Receipt header.

Server-side session credential action handlers.

State and TIP-1034 precompile identity for an MPP payment channel.

ETS-backed default implementation of MPP.Session.Store.

Convenience use wrapper that implements MPP.Method.verify/2 by dispatching session credential actions through MPP.Session.Actions.

Session credential payload schema, discriminated on action.

Behaviour and dispatch helpers for pluggable session-channel persistence.

TIP-1034 Tempo Channel Reserve voucher and EIP-712 signature verification.

Single-node atomic ETS store for recurring subscriptions.

Persisted recurring-payment authority and settlement state.

Behaviour and dispatch helpers for recurring-subscription persistence.

Server-side payment observability via standard :telemetry events.

Built-in ETS-based atomic store using ConCache (TTL-enabled ETS wrapper by Saša Jurić).

Behaviour for atomic Tempo state stores used by MPP.Methods.Tempo.

Bare JSON-RPC 2.0 payment transport (non-MCP).

Plug adapter for the bare JSON-RPC payment transport.

Server-side WebSocket adapter for JSON-RPC plus MPP payment challenges.

Transport-neutral payment credential verification.

Mix Tasks

Starts a local HTTP server demonstrating the full MPP 402 payment flow.

Generates a static api_manifest.json from the library's descripex annotations.

Generates an OpenAPI 3.1.0 discovery document from an Elixir config file.