mppx/client library to handle the payment flow automatically.
Prerequisites
- A Crossmint EVM wallet with USDC. See the Wallets quickstart.
- The agent must be authorized as a signer on the wallet. See Authorize the Agent.
Install dependencies
Pay an MPP endpoint
mpp-payment.tsx
How the code works
Create a wallet client from the Crossmint wallet
The
EVMWallet.from(wallet) call wraps the Crossmint wallet into an EVM-compatible interface. A custom EIP-1193 request handler is created that delegates eth_sendTransaction calls to the Crossmint wallet, which sends transactions using the agent’s delegated permissions.Build a viem wallet client
A viem
walletClient is created with the custom transport, targeting the Tempo devnet chain. This client bridges the Crossmint wallet to standard EVM tooling.Initialize the MPPX client with Tempo
Mppx.create initializes the MPP client with the tempo payment method in push mode. The getClient callback provides the wallet client for signing and sending payment transactions.
