API Reference
This reference shows how to authenticate, create a payment session (get a link), and check payment status via the REST API. It also includes SDK usage patterns for Node.js and Python MCP servers.
Authentication
Send your secret key in the Authorization header on every request.
Headers
Authorization: Bearer <YOUR_SECRET_KEY>
Content-Type: application/json
Base URL
https://api.walleot.com/v1
Keep your secret key on the server side only. Do not embed in client apps.
Create a payment session
Creates a payment session and returns a session ID and checkout URL.
Endpoint
POST /sessions
Request body
amount(integer, required) – amount in centscurrency(string, required) – ISO 4217 currency code (e.g., "usd")description(string, optional) – human-readable purpose
- Node.js
- Python
- cURL
const response = await fetch('https://api.walleot.com/v1/sessions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.WALLEOT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 200,
currency: 'usd',
description: 'Pro feature unlock'
})
});
const session = await response.json();
console.log(session.sessionId, session.url);
import requests
import os
response = requests.post(
'https://api.walleot.com/v1/sessions',
headers={
'Authorization': f'Bearer {os.getenv("WALLEOT_API_KEY")}',
'Content-Type': 'application/json',
},
json={
'amount': 200,
'currency': 'usd',
'description': 'Pro feature unlock'
}
)
session = response.json()
print(session['sessionId'], session['url'])
curl -X POST "https://api.walleot.com/v1/sessions" \
-H "Authorization: Bearer $WALLEOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 200,
"currency": "usd",
"description": "Pro feature unlock"
}'
Response
{
"sessionId": "sess_123",
"url": "https://pay.walleot.com/checkout/sess_123"
}
Notes
- The server expects amount in cents. (SDKs accept dollars and convert to cents for you.)
- currency is lowercase in the underlying request.
Check payment status
Retrieve the current status of a payment session.
Endpoint
GET /sessions/{sessionId}
- cURL
- Node.js
- Python
curl "https://api.walleot.com/v1/sessions/sess_123" \
-H "Authorization: Bearer $WALLEOT_API_KEY"
const response = await fetch('https://api.walleot.com/v1/sessions/sess_123', {
headers: {
'Authorization': `Bearer ${process.env.WALLEOT_API_KEY}`
}
});
const status = await response.json();
console.log(status.status); // "paid", "pending", etc.
import requests
import os
response = requests.get(
'https://api.walleot.com/v1/sessions/sess_123',
headers={
'Authorization': f'Bearer {os.getenv("WALLEOT_API_KEY")}'
}
)
status = response.json()
print(status['status']) # "paid", "pending", etc.
Response
{
"status": "paid"
}
Complete payment flow example
Here's how to create a session, get a payment link, and check status:
- Node.js
- Python
// 1. Create a payment session
const session = await fetch('https://api.walleot.com/v1/sessions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.WALLEOT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 200, // $2.00 in cents
currency: 'usd',
description: 'Premium feature unlock'
})
});
const { sessionId, url } = await session.json();
// 2. Redirect user to payment link
console.log('Send user to:', url);
// 3. Check payment status (poll)
const checkStatus = async (sessionId) => {
const response = await fetch(`https://api.walleot.com/v1/sessions/${sessionId}`, {
headers: { 'Authorization': `Bearer ${process.env.WALLEOT_API_KEY}` }
});
const { status } = await response.json();
return status; // "paid", "pending", "failed", etc.
};
// Poll for completion
const status = await checkStatus(sessionId);
if (status === 'paid') {
console.log('Payment successful! Enable premium feature.');
}
import requests
import os
import time
api_key = os.getenv('WALLEOT_API_KEY')
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
# 1. Create a payment session
session_response = requests.post(
'https://api.walleot.com/v1/sessions',
headers=headers,
json={
'amount': 200, # $2.00 in cents
'currency': 'usd',
'description': 'Premium feature unlock'
}
)
session_data = session_response.json()
session_id = session_data['sessionId']
payment_url = session_data['url']
# 2. Direct user to payment link
print(f'Send user to: {payment_url}')
# 3. Check payment status
def check_status(session_id):
response = requests.get(
f'https://api.walleot.com/v1/sessions/{session_id}',
headers={'Authorization': f'Bearer {api_key}'}
)
return response.json()['status']
# Poll for completion
status = check_status(session_id)
if status == 'paid':
print('Payment successful! Enable premium feature.')
SDK usage with MCP (automatic per-call pricing)
For MCP servers, use the SDKs for automatic per-call charging:
- Node.js
- Python
import { Server } from "@modelcontextprotocol/sdk/server";
import { installWalleot, Mode } from "walleot";
import { z } from "zod";
const server = new Server({ name: "my-server", version: "0.0.1" });
installWalleot(server, {
apiKey: process.env.WALLEOT_API_KEY!,
mode: Mode.TWO_STEP, /* Alternatively, you can use mode.ELICITATION if MCP Client supports it */
});
server.registerTool(
"premium_analysis",
{
title: "Premium Analysis",
description: "Advanced data analysis with AI.",
inputSchema: { data: z.string() },
price: { amount: 0.50, currency: "USD" }, // $0.50 per call
},
async ({ data }, extra) => {
const result = await performAnalysis(data);
return { content: [{ type: "text", text: result }] };
}
);
from mcp.server.fastmcp import FastMCP, Context
from walleot import Walleot, Mode
import os
mcp = FastMCP("Analysis Server")
Walleot(
mcp,
apiKey=os.getenv("WALLEOT_API_KEY"),
mode=Mode.TWO_STEP # Alternatively, you can use Mode.ELICITATION if MCP Client supports it
)
@Walleot.price(0.50, currency="USD") # $0.50 per call
@mcp.tool()
def premium_analysis(data: str, ctx: Context) -> dict:
"""Advanced data analysis with AI."""
result = perform_analysis(data)
return {"analysis": result, "confidence": 0.95}
Error Handling
All API endpoints return standard HTTP status codes. Handle errors appropriately:
- Node.js
- Python
try {
const response = await fetch('https://api.walleot.com/v1/sessions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.WALLEOT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
amount: 200,
currency: 'usd',
description: 'Pro feature unlock'
})
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const session = await response.json();
console.log(session.sessionId, session.url);
} catch (error) {
console.error('Error creating session:', error);
}
import requests
import os
try:
response = requests.post(
'https://api.walleot.com/v1/sessions',
headers={
'Authorization': f'Bearer {os.getenv("WALLEOT_API_KEY")}',
'Content-Type': 'application/json',
},
json={
'amount': 200,
'currency': 'usd',
'description': 'Pro feature unlock'
}
)
response.raise_for_status() # Raises an HTTPError for bad responses
session = response.json()
print(session['sessionId'], session['url'])
except requests.exceptions.RequestException as e:
print(f'Error creating session: {e}')
Types & enums
- Mode:
TWO_STEP(default),RESUBMIT,ELICITATION,PROGRESS,DYNAMIC_TOOLS - Node price shape:
{ amount: number, currency: string }(amount in USD dollars, converted under the hood) - Python decorator:
@walleot.price(amount: float, currency: str)(dollars)
Payment Status Values
Common status values returned by the API:
pending- Payment session created, awaiting paymentpaid- Payment completed successfullyfailed- Payment failed or was declinedexpired- Payment session expiredcancelled- Payment was cancelled by user
Behavior
- New user: 2-click registration
- Under threshold: auto-approved
- Above threshold: one-tap 2FA prompt
Rate Limits
API requests are rate limited. Current limits:
- Sessions: 100 requests per minute per API key
- Status checks: 1000 requests per minute per API key
Rate limit headers are included in responses:
X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Requests remaining in current windowX-RateLimit-Reset: Time when the rate limit resets
Next Steps
- Quickstart Guide - Get up and running quickly
- Python SDK - Detailed Python SDK documentation
- TypeScript SDK - Detailed TypeScript SDK documentation
- MCP Integration Guide - Complete MCP server tutorial