Skip to navigation

Build agents that can pay

Let the AI agent you are building make payments on behalf of its user using an Agent Wallet.
View as Markdown

Give the AI agent you are building the ability to complete payments as part of a larger task. When the agent reaches a point where payment is required, it receives a payment URL and passes that URL to Mitu’s pay tool. Mitu handles the payment using an Agent Wallet belonging to the connected customer.

The agent does not need to implement payment protocols, hold wallet keys or manage funds directly. Once the payment is complete, the agent can continue the task it was performing.

The customer owns the money

An Agent Wallet belongs to the customer. Their AI agent can use the wallet for permitted payments, but it cannot withdraw funds, change spending controls or take ownership of the wallet.

Before you begin

The customer needs a funded Agent Wallet that can be used for the payment, and the AI client needs to be connected as that customer. If you have not set this up yet, start with Give your customers Agent Wallets.

1

Connect the customer

Mitu needs to know which customer the AI agent is acting for before the agent can access that customer’s Agent Wallets. Customers can connect using a customer key or your existing OAuth sign in flow.

With a customer key, the AI client connects using the customer’s mcpk_... credential. With OAuth, the customer signs in using the account they already have with your product. Once connected, the customer’s wallet capabilities become available to their AI agent.

Learn more in Connect customer accounts.

2

Make wallet capabilities available

The connected agent can use wallet tools to work with the Agent Wallets available to the customer. These capabilities let the agent check available wallets, read balances, retrieve funding information and make supported payments.

The agent cannot create wallets, change spending controls, withdraw funds or use wallets that do not belong to the connected customer.

Learn more about Wallet tools.

3

Receive a payment URL

During a task, the agent may reach a point where another product or service requires payment. The payment URL might come from a booking flow, invoice, checkout, API response, another tool or another agent.

For example:

https://api.example.com/pay/pay_abc123

How the agent obtained the URL does not change the payment flow. Once it has a supported payment URL, it can pass that URL to the pay tool without needing to parse the underlying payment requirement or implement the payment protocol itself.

4

Pay with an Agent Wallet

Pass the payment URL to the pay tool to complete the payment using an Agent Wallet available to the connected customer. If the customer has several wallets, the appropriate wallet can be selected for the payment.

For example, a customer might ask:

Book the hotel and pay from my Travel wallet.

The agent can complete the booking flow, receive the payment URL and use the customer’s Travel wallet when payment is required.

See Wallet tools for the current pay tool schema and supported arguments.

5

Let Mitu apply the wallet controls

Before a payment completes, Mitu applies the controls configured for the customer’s Agent Wallet. This includes confirming that the wallet belongs to the connected customer, that sufficient funds are available and that the payment is permitted by the wallet’s configured controls.

These checks happen outside the agent, so the agent cannot bypass them or change the wallet configuration to make a payment succeed. If customer approval is required, the payment waits for that approval rather than giving the agent unrestricted authority to proceed.

Learn more about Limits and controls.

6

Continue the task

Once the payment completes, the pay tool returns the result and the agent can continue the workflow that required the payment. Payment is usually only one part of the customer’s request, so the agent should use the result to continue the original task and report the final outcome.

If the customer asked the agent to book a hotel, for example, the useful outcome is the completed booking rather than simply reporting that a payment succeeded.

7

Handle payments that need attention

Not every payment will complete immediately. A wallet may not have enough funds, the payment may require customer approval or the selected wallet may not be available to the connected customer.

The agent should treat these as states that require an appropriate next action rather than repeatedly attempting the same payment. For example, when customer approval is required, tell the customer that the payment is waiting for their approval and pause the workflow until the payment can continue.

Learn more about Limits and controls and Wallet tools.

8

Track wallet activity

Use webhooks to keep your backend updated when wallet activity occurs. Wallet events can help you track when funds are added or spent and keep your own customer records and experiences in sync with activity on their Agent Wallets.

Learn more about Webhooks and Events.

Payments are part of the workflow

An agent does not need to become a wallet or payment system to make purchases on behalf of its user. It receives a payment URL when payment is required, passes that URL to Mitu and continues the original task once the payment is complete.

The customer keeps ownership of the funds, and the controls configured on their Agent Wallet continue to apply whenever their agent attempts to spend. This gives the agent the ability to complete paid actions without giving it unrestricted control over the customer’s money.

Continue building