Skip to main content

1. Create an account

Go to monkepay.xyz and sign up. You can use email, Google, or a web3 wallet (MetaMask, Coinbase Wallet).

2. Get your API keys

In the dashboard, go to API KeysCreate Key. You’ll see your key ID and secret once — copy both now and store them somewhere safe. The secret cannot be retrieved again.
MONKEPAY_API_KEY_ID=mk_live_...
MONKEPAY_API_KEY_SECRET=...
Add these to your .env file. Never commit them.

3. Install the SDK

npm install @monkepay/sdk

4. Gate an endpoint

Pick your framework:
import { Hono } from 'hono'
import { MonkePayHono } from '@monkepay/sdk'

const app = new Hono()

const monkePay = MonkePayHono({
  apiKeyId: process.env.MONKEPAY_API_KEY_ID!,
  apiKeySecret: process.env.MONKEPAY_API_KEY_SECRET!,
  price: '0.001', // $0.001 USDC per request
})

app.use('/api/*', monkePay())

app.get('/api/data', (c) => c.json({ result: 'paid content' }))

5. Set your payout address

In the dashboard, go to SettingsPayout Address. Enter your EVM wallet address and select your network. This is where your USDC will be sent when you request a payout. It’s separate from your MonkePay wallet — your MonkePay wallet is managed by MonkePay and receives payments from agents. Your payout address is your personal wallet where you withdraw to.
If you signed up with MetaMask or Coinbase Wallet, your payout address is auto-filled from your connected wallet.

6. Test it

The easiest way to test is with x402-fetch. Install it and run a quick test:
npm install x402-fetch
import { wrapFetchWithPayment } from 'x402-fetch'
import { createSigner } from 'x402/types'

// Load a test wallet with USDC on Base Sepolia
// Get testnet USDC from https://faucet.circle.com
const walletClient = await createSigner('base-sepolia', process.env.AGENT_PRIVATE_KEY as `0x${string}`)
const fetch402 = wrapFetchWithPayment(fetch, walletClient)

const response = await fetch402('http://localhost:3000/api/data')
const data = await response.json()
console.log(data) // { result: 'paid content' }
If the request succeeds, you’ll see the payment appear in your dashboard under Transactions.

Next steps