CLI docs

Pay and earnPay with MPP

Pay and earn

Pay with MPP

How Visa CLI agents pay for APIs over MPP on Tempo: the 402, the charge, the paid retry and the receipt, for owners, merchants and app builders.

Markdownllms.txt
On this page

MPP, the Machine Payments Protocol, lets an API charge per request over plain HTTP, with no account, API key or checkout page. When a request costs money, the API answers 402 Payment Required with a price, the client pays and sends the same request again with proof of payment, and the API delivers. Stripe and Tempo wrote it as an open standard, and the specification is public.

MPP works with several payment methods. Visa CLI agents use one of them: they pay from the owner's wallet in OUSD on Tempo, the blockchain Visa CLI's payments run on.

MPP and TAP do different jobs on the same request. MPP moves the money. A TAP signature, covered in What is TAP?, tells the merchant which verified agent sent it. A merchant can take MPP payments without checking TAP, and check TAP without charging.

This page explains the exchange from the start, then covers what each reader needs:

How an MPP payment works

An MPP payment is four HTTP steps between a client and a merchant. Nothing about it is specific to Visa: any MPP client can pay any MPP merchant.

  1. The request. The client calls the merchant's URL as usual.
  2. The challenge. The merchant answers 402 with a WWW-Authenticate: Payment header. Each Payment value is one offer: the payment method (tempo), the intent (charge, a single payment), and a request that names the amount, the token and the recipient. A merchant can make several offers in one header.
  3. The credential. The client picks an offer it can pay, builds the payment, and repeats the original request with an Authorization: Payment header that carries it.
  4. The answer. The merchant checks the credential, settles the payment, and answers with the result. It may add a Payment-Receipt header that names the transaction.
Illustrative: the merchant's 402
HTTP/1.1 402 Payment Required
WWW-Authenticate: Payment id="ch_01J…", realm="api.example.com", method="tempo", intent="charge", request="eyJhbW91bnQiOiI2MDAwIiwiY3VycmVuY3kiOiIweDIwYzAuLi4iLCJyZWNpcGllbnQiOiIweC4uLiJ9"

The request value is base64url JSON. Decoded, it reads like this, with the amount in millionths of the token:

Illustrative: the decoded charge
{
  "amount": "6000",
  "currency": "0x20c0000000000000000000006a37da5c996874be",
  "recipient": "0xMERCHANT_ADDRESS",
  "methodDetails": { "chainId": 4217 }
}
Illustrative: the paid retry
POST /v1/forecast HTTP/1.1
Host: api.example.com
Authorization: Payment eyJjaGFsbGVuZ2UiOnsi…
Content-Type: application/json
Signature-Input: sig2=("@method" "@authority" "@path" "authorization" "content-digest");…;tag="agent-payer-auth"
Signature: sig2=:…:
Content-Digest: sha-256=:…:

{"city":"Denver"}

These values are placeholders. MPP's wire format is defined by the protocol, and mppx is the open-source TypeScript implementation Visa CLI uses to read challenges and write credentials.

What Visa CLI pays

Visa pays one kind of offer: a Tempo charge in OUSD, on the network the agent is connected to. Tempo mainnet is chain 4217, and Tempo testnet is 42431. When a merchant makes several offers, Visa takes the first OUSD charge. A merchant that only offers USDC.e on mainnet can still be paid when conversion is available for the wallet: Visa converts OUSD inside the same transaction, and the approval card shows the conversion cost.

Visa refuses these, and nothing is paid:

The merchant offersWhat happens
No Tempo charge at all, such as a card-only or x402-only 402Refused as no_ousd_charge. Visa CLI retired x402, and paying by card isn't available yet
A Tempo intent other than charge, such as a sessionRefused. Visa makes single payments only
A $0 charge, MPP's sign-to-identify flowRefused. To prove identity without paying, use attest_http_request
A token other than OUSD or USDC.eRefused
A charge on another chain, or split between several recipientsNot offered to the agent as payable
A job to collect later, such as 202 with a job idRefused as async_result. Visa can't collect asynchronous results yet

The merchant's URL must be https on a public address. Visa sends GET or POST, never follows a redirect, and pays at most once per call: if the merchant answers 402 again after a credential, Visa doesn't pay a second time.

For owners and their agents

Your agent pays with the pay tool. It gives the URL, a max (the price you agreed), and a new UUID as its idempotency_key. Visa reads the merchant's 402, checks the charge is within max, and asks for your approval when your spending settings say to. The approval card shows the merchant, the price, the network fee and any conversion, and the most the whole payment can cost. Nothing is spent until you approve.

Before paying, an agent can call discover to find paid services and see their prices. A price from discover is a guide: pay always reads the merchant's live 402 and pays that, never the listed price.

After the payment, Visa reads the result from the chain. A merchant's answer alone isn't treated as proof that money moved. Every payment appears in Activity in the Console.

If a call is interrupted, the agent repeats it with the same idempotency_key and the same arguments, and the purchase continues instead of starting again. If a payment went through but the result didn't come back, the agent tells you so instead of paying again. Troubleshooting covers what to check.

Paying for an API, step by step

  1. Add money. Press Receive on the Wallet page and send OUSD on Tempo to your wallet's address. Your agent can't add money itself. See Wallet and OUSD.
  2. Ask your agent. For example: “find a weather API you can pay for” runs discover, and “get tomorrow's forecast for Denver from it, up to $0.05” runs pay with that max.
  3. Approve. Your agent shows the approval link in its reply. Open it, check the merchant, the price and the most it can cost, and approve. Then tell your agent to carry on; it repeats the same call and the payment goes through.

New agents ask before every payment and start at Visa's default spending limit. Visa may also cap what all your agents spend in a day. Limits and approvals covers both.

Example: posting a task on Taskmarket

Posting a paid task on Taskmarket is an MPP payment. The agent's post goes to Taskmarket, which answers 402 with a Tempo charge for the reward, paid into Taskmarket's escrow. Visa pays it the same way it pays any API, you approve the reward once, and the task goes live. Tasks and earning walks through the rest.

For merchants

To take payments from Visa CLI agents, run an MPP server that offers a Tempo charge in OUSD. A stock mppx Tempo server works. Make these choices so Visa can pay you:

  • Offer OUSD (0x20c0000000000000000000006a37da5c996874be) on Tempo mainnet, chain 4217, to a single recipient. You can add other offers beside it.
  • Accept a signed transaction as the credential. Visa sends the signed Tempo transaction, and your server broadcasts it. If your server fails before broadcasting, nothing is charged. You can sponsor the network fee by marking the charge feePayer, and the owner's approval card then shows the fee as paid by you.
  • Deliver in the same response. Return the paid result in the answer to the credential, and add Payment-Receipt with the transaction hash as its reference if you can. Visa confirms the payment on the chain either way. Visa sends each credential once and never again, even when your answer is lost, so a failure after the payment settles is yours to refund.
  • Publish your prices in /openapi.json at your origin, with x-payment-info (intent, method, amount, currency) on each paid operation. discover reads it to price your endpoints without calling them, so a POST is never sent just to learn its price.

A Visa CLI agent's paid request carries two things. The Authorization: Payment credential is the payment, and you verify it through your MPP server before you deliver anything. Every paid request also carries the agent's RFC 9421 signature, tagged agent-payer-auth, which covers authorization, so it binds the agent's identity to that exact payment. How this differs from Visa's published TAP lists its components and lifetime.

Each paid request also carries an Idempotency-Key header. It's the purchase's own reference, the same value on the first request and on its paid retry, so you can use it to recognise a retry of the same purchase. If the agent's headers already carry one, that one is kept. A price discover reads from your /openapi.json sends you no request at all.

The signature tells you which verified agent paid. It doesn't prove the payment: only your MPP server and the chain do that. If the agent can't sign, Visa doesn't pay, so a payment from a Visa CLI agent never arrives unsigned. The example verifier on these pages checks identity requests only and refuses a paid signature as tap_malformed. To check a paid signature, follow the paid rows in that component table.

mppx has its own TAP verifier, but it doesn't accept Visa CLI's signatures today, because it can't rebuild some of the components they cover. How this differs from Visa's published TAP has the details.

Headers your API needs, such as an API key, come from the agent's headers argument. Visa refuses reserved names, including Authorization, Cookie, Host, the payment headers and anything starting x-payment or x-visa, and sends the rest exactly as given.

Publishing a price

discover reads x-payment-info on each paid operation in your /openapi.json. The amount is in millionths of the token, as in the charge, and the currency is the token's address:

Illustrative: one paid operation in /openapi.json
{
  "paths": {
    "/v1/forecast": {
      "post": {
        "x-payment-info": {
          "intent": "charge",
          "method": "tempo",
          "amount": "6000",
          "currency": "0x20c0000000000000000000006a37da5c996874be"
        }
      }
    }
  }
}

The price is a guide. pay always pays what your live 402 asks.

Which agent paid

To record which agent paid, read the keyid from the paid request's Signature-Input, look it up in Visa CLI's registry with GET https://auth.visacli.sh/v1/tap/registry/keys/{keyid}, and store the id of the agent document it returns beside the payment and its Idempotency-Key. A real lookup shows that document. Check the signature against the paid rows in the component table first. The example verifier on these pages checks identity requests only.

When something fails

What failedWhat happened to the moneyWhat to do
Your server fails before it broadcasts the signed transactionNothing was chargedAnswer with an error. The agent's purchase ends unpaid
The transaction settled, then your service failedThe payment standsRefund the agent yourself. Visa never sends the credential again, so a retry won't reach you
Your answer was lost after settlementThe payment standsNothing to do: Visa reads the payment from the chain, and the agent's owner sees it in Activity

For app builders

pay takes one of two shapes, depending on where the agent runs.

Where the agent runsWhat it sendsApproval
Local, through the CLItarget (the URL), max, idempotency_key, and method, body and headers when the call needs them. Visa calls the merchant itself to read the 402Follows the owner's spending settings
Hosted, such as Grok BottempoChallenge (the merchant's WWW-Authenticate: Payment value, unchanged), resource (the URL that answered 402), max, idempotency_key, request unless it's a plain GET, and narrative when known. Visa pays at most that charge, to that recipient onlyThe owner approves every payment

Either way, a new purchase needs a new UUID idempotency_key, and the same key with the same arguments resumes it. Read Payment recovery before you handle timeouts: a timeout doesn't prove nothing was paid, and the fix is always a status read with the original key, never a new purchase.

Updated 18 Nov 2026