Skip to main content

What is the Perftest API?

Performance Tester is deployed at:
https://perftest.api.corbits.dev
The Perftest API, short for Performance Test, is an internal testing tool (not a partner API) that provides simple endpoints for validating your x402 payment integration. It offers two endpoints:
  • /free - Returns immediately without requiring payment (useful for connectivity tests)
  • /protected - Requires x402 payment before returning a response (useful for testing payment flows)
Both endpoints return a random dictionary word (no newline) as plain text. Unlike partner APIs (Helius, Jupiter, etc.), the Perftest API has no real functionality beyond responding to requests. It exists solely to help you validate your setup.

Pricing

  • /free - Free, no payment required
  • /protected - 0.002 USDC per request (paid via x402 protocol)

When to Use This

Use the Perftest API when you need to:
  • Validate your wallet and payment handler configuration before production
  • Debug payment flow issues in a controlled environment
  • Test x402 payment integration in a simple, predictable environment
  • Verify your payment setup works correctly before connecting to partner APIs

Quick Start: Testing Connectivity with /free

Before testing payments, verify basic connectivity:
const response = await fetch("https://perftest.api.corbits.dev/free");
console.log(await response.text());
// Expected: 200 OK with a random dictionary word (e.g., "forest")
This confirms you can reach the API. Now let’s test the payment flow.

Prerequisites

Install the required packages:
pnpm add @faremeter/rides dotenv
Create a .env file with your wallet private key:
# For Solana (base64 or JSON-encoded keypair)
SOLANA_PRIVATE_KEY="your-solana-private-key-here"

# Optional: For EVM chains
EVM_PRIVATE_KEY="0x..."

Full Example

Test your payment setup with the /protected endpoint:
import "dotenv/config";
import { payer } from "@faremeter/rides";

async function testPaymentFlow() {
  await payer.addLocalWallet(process.env.SOLANA_PRIVATE_KEY);

  console.log("Testing /free endpoint...");
  const freeResponse = await fetch("https://perftest.api.corbits.dev/free");
  console.log("Free response:", await freeResponse.text());

  console.log("\nTesting /protected endpoint...");
  const response = await payer.fetch("https://perftest.api.corbits.dev/protected");

  console.log("Response status:", response.status);

  if (response.ok) {
    const text = await response.text();
    console.log("Success! Response:", text);
  } else {
    console.error("Payment failed:", response.status, await response.text());
  }
}

testPaymentFlow().catch(console.error);
Expected output:
Testing /free endpoint...
Free response: forest

Testing /protected endpoint...
Response status: 200
Success! Response: mountain
That’s it! Just 3 lines of setup code and @faremeter/rides handles the rest:
  • Automatic network detection
  • Token selection
  • Payment processing
  • Transaction submission