Tenzro
Tutorial — Payments

Pay with MPP

MPP is the IETF wire format co-authored by Stripe and Tempo for session-based machine payments. The Tenzro node implements the full challenge / credential / receipt flow with Stripe Payment Intents underneath. The SDK gives you a one-call entry point that handles everything.
Level
Intermediate
Time
~20 min
Prerequisites
Funded agent wallet
Stack
TypeScript · MPP
01

Server issues an MPP challenge

The resource server returns HTTP 402 with a challenge specifying amount, asset, and session parameters.

HTTP/1.1 402 Payment Required
Payment-Protocol: mpp
WWW-Authenticate: MPP challenge="abc...", amount="0.25", asset="USDC"
02

Create a challenge on the node (optional)

You can also produce a challenge directly via the node when the resource server is itself a Tenzro node.

import { TenzroClient } from "tenzro-sdk";
const client = new TenzroClient({ endpoint: "https://rpc.tenzro.network" });

const challenge = await client.payment.createChallenge(
  "https://api.tenzro.network/inference",
  0.25,
  "USDC",
  "mpp",
);
03

Pay the resource

The SDK fetches the 402, signs an MPP credential bound to the payer DID, and replays the request — gated by the DelegationScope and runtime SpendingPolicy.

const receipt = await client.payment.payMpp(
  "https://api.tenzro.network/inference",
  "did:tenzro:machine:agent-1",
);
console.log("settled:", receipt);
04

Inspect open sessions

MPP holds an open session for the resource — subsequent requests reuse the same credential until the ceiling is exhausted.

const sessions = await client.payment.listSessions();
console.log(sessions);
Related
← All tutorials