Quickstart

Execute your first autonomous MPP payment in 10 minutes.

Prerequisites

  • Node.js 18+ or Python 3.10+

  • Solana wallet with USDC balance

  • OpenClaw installed (for Python integration)

  • Basic understanding of the Machine Payments Protocol

What you'll build

An OpenClaw agent that autonomously pays for premium API access using MPP with Solana settlement.

Option 1: TypeScript SDK

Install

npm install @moltmpp/sdk @solana/web3.js

Configure wallet

import { MoltMPPClient } from '@moltmpp/sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

// Load Solana wallet
const secretKey = JSON.parse(fs.readFileSync('~/.config/solana/id.json', 'utf8'))
const wallet = Keypair.fromSecretKey(new Uint8Array(secretKey))

// Initialize MoltMPP client
const mpp = new MoltMPPClient({
  solanaRpc: 'https://api.mainnet-beta.solana.com',
  wallet: wallet,
  policies: {
    maxPerTransaction: 100_000,  // 100 USDC (6 decimals)
    dailyLimit: 1_000_000         // 1000 USDC
  }
})

Make your first MPP payment

Verify settlement

Option 2: OpenClaw Integration (Python)

Install

Configure agent

Execute autonomous payment

Monitor transaction

Understanding the MPP flow

When your agent makes an MPP payment, here's what happens:

1. Resource request

Agent requests a paid resource:

2. Payment required (402)

Service responds with payment requirements:

3. Payment execution

MoltMPP constructs and submits Solana transaction:

4. Retry with credential

Agent retries with payment proof:

5. Resource delivery

Service verifies on-chain payment and delivers resource:

Approval policies

Control autonomous payment behavior with policies:

Use in your agent:

Testing on devnet

Use Solana devnet for testing without spending real funds:

Get devnet USDC:

Complete example

Run the example

What's next?

Now that you've executed your first MPP payment:

Troubleshooting

"Insufficient USDC balance"

Check wallet balance:

"MPP-Payment-Credential invalid"

Transaction may not be finalized. Wait for confirmation:

"Service does not support MPP"

Verify the service supports Machine Payments Protocol:

"Policy rejected payment"

Check your policies configuration:

Get help

Last updated

Was this helpful?