Skip to main content

Overview

Tempo is a blockchain built for machine-to-machine payments. Its Machine Payment Protocol (MPP) extends the HTTP 402 “Payment Required” status code so that agents and servers can automatically pay for API access in a single round-trip — no checkout flow, no user accounts, no manual approval. This recipe shows the minimum code to:
  1. Create an EVM wallet on Tempo Moderato testnet with Dynamic’s Node SDK
  2. Fund it with test stablecoins from Tempo’s faucet
  3. Wire up a viem LocalAccount backed by Dynamic’s MPC signing that understands Tempo’s custom transaction format
  4. Use mppx to make a paid request to any MPP-protected endpoint
For a full example, see the tempo-ppm-integration example on GitHub. For how HTTP 402 payment flows work in general—and how MPP relates to the separate x402 stack—see the HTTP 402 overview.

Prerequisites

  • Node.js 22+
  • Dynamic Environment ID and API token — find these in the Dynamic Dashboard
  • Embedded wallets enabled in your Dynamic dashboard

Setup

Install the required packages:
Create a .env file with your credentials:
.env
Use node --env-file=.env to load the file automatically, or a library like dotenv.

Step 1: Initialize the Dynamic wallet client


Step 2: Create a wallet

Wallets are created with a 2-of-2 threshold signature scheme (MPC). The returned externalServerKeyShares are your signing credentials — store them securely alongside the wallet address.

Step 3: Fund with test stablecoins

Tempo’s Moderato testnet faucet distributes test stablecoins (pathUSD, AlphaUSD, BetaUSD, ThetaUSD). These are used as payment tokens for MPP requests.
You can also visit docs.tempo.xyz to request tokens manually.

Step 4: Build a Tempo-compatible viem account

Dynamic’s Node SDK signs transactions using its internal viem serializer, which doesn’t understand Tempo’s custom transaction format. You need to create a LocalAccount adapter that uses Tempo’s serializer instead.

Step 5: Make an MPP payment

Initialize mppx with the Tempo payment method and use mppx.fetch() in place of the global fetch for any 402-protected URL. The client handles the negotiation, signs the payment, and resends the request automatically.
https://mpp.dev/api/ping/paid is a public test endpoint that accepts any valid MPP payment. Use it to verify your setup before pointing at a real resource.

Putting it all together


Additional Resources

Last modified on April 9, 2026