Skip to main content
Some agents never open a checkout page. They call APIs — and more and more APIs can answer with “payment required” in a machine-readable way. That is where the Machine Payments Protocol (MPP) shines, and where @ovra/mpp plugs Ovra in as the wallet on the agent side (or the verifier on the service side).

What is MPP?

The Machine Payments Protocol is an open standard for machine-to-machine payments. When a service wants to be paid before it returns data, it can respond with HTTP 402 Payment Required and a structured challenge (amount, currency, recipient, supported methods, and so on). Your agent does not need to hand-parse every header by hand: an MPP client (built with mppx) retries the request, satisfies the challenge with a credential, and continues once the service is satisfied. Ovra’s charge method is one such payment method — but the protocol is bigger than any single provider.

How Ovra + MPP work together

Here is the happy path when a service accepts Ovra and returns a 402: The agent code stays high level: fetch the URL. The stack turns 402 responses into intents, credentials, and settled transactions behind the scenes.

Quick start (agent / client)

Install @ovra/mpp and the mppx peer dependency, then wrap fetch with an MPP-aware client:
import { Mppx } from "@ovra/mpp/client";
import { charge } from "@ovra/mpp/client";

const client = Mppx.init({
  methods: [
    charge({
      apiKey: "sk_test_...",
      agentId: "ag_xxx",
    }),
  ],
});

// Just make normal API calls — MPP handles 402 automatically
const response = await client.fetch("https://api.example.com/data");
Under the hood, when the service issues an Ovra-shaped challenge, the client creates an intent for the requested amount, approves it when your policy allows, and sends back a credential the service can verify.

For service providers

If you operate the API and want to accept Ovra over MPP, use the server entry point. You still configure the Ovra charge method, but verification and settlement run on your side when a client presents a credential:
import { Mppx, Expires } from "@ovra/mpp/server";
import { charge } from "@ovra/mpp/server";

const mpp = Mppx.init({
  methods: [
    charge({
      apiKey: "sk_test_...",
    }),
  ],
});

// In your request handler:
// Return 402 with an MPP challenge, then verify incoming credentials with `mpp`
Exact handler wiring depends on your framework; the important idea is challenge on unpaid access, verify credential, then return your real response.

Open ecosystem

MPP is vendor-neutral. Ovra is one payment method; others can coexist in the same challenge. For the full protocol details, examples, and community resources, see mpp.dev.