Skip to main content
Corbits is a hosted facilitator service that streamlines x402 payment processing. By using Corbits’ endpoints, you can offload payment verification and settlement without needing to operate your own facilitator infrastructure.

Prerequisites

  • Node.js and npm installed
  • A SKALE Chain endpoint
  • Basic understanding of x402 protocol

Configuration

Environment Variables

Create a .env file with Corbits configuration:
# Receiver address for the x402 payment
RECEIVING_ADDRESS=0xAddress_Receiving_Payment

# please don't share your private key with anyone
PRIVATE_KEY=0xyour_pk

SDK import

Please install the following Viem and Farmeter SDKs created by the Corbits team:
npm install viem
npm install @faremeter/info
npm install @faremeter/middleware

Integration with Corbits

import { serve } from "@hono/node-server";
import { Hono } from "hono";
import { hono as middleware } from "@faremeter/middleware";
import { evm } from "@faremeter/info";
import "dotenv/config";

const app = new Hono();

const receiver_address = process.env.RECEIVING_ADDRESS || "0xsome_default_address";
const facilitator = "https://facilitator.corbits.dev";

const paywalledMiddleware = await middleware.createMiddleware({
  facilitatorURL: facilitator,
  accepts: [
    evm.x402Exact({
      network: "eip155:324705682",
      asset: "USDC",
      amount: "1000", // $0.0001 in USDC base units
      payTo: receiver_address,
    }),
  ],
});

app.get("/api/free", (c) => {
  return c.json({
    type: "free",
    message: "This is free data that does not require payment",
    timestamp: new Date().toISOString(),
    data: {
      temperature: 72,
      humidity: 45,
      conditions: "Sunny",
    },
  });
});

// Premium endpoint with payment required
app.get("/api/premium", paywalledMiddleware, (c) => {
    return c.json({
    type: "paid",
    message: "This is is a paid data that does require x402 payment",
    timestamp: new Date().toISOString(),
    data: {
      temperature: 72,
      humidity: 45,
      conditions: "Sunny",
    },
  });
});

serve(app, (info) => {
  console.log(`Listening on http://localhost:${info.port}`);
});

Troubleshooting

Connection Issues

If you cannot connect to Corbits:
  1. Verify the facilitator URL is correct
  2. Check network connectivity
  3. Ensure API credentials are valid
  4. Review firewall settings

Payment Failures

Common causes and solutions:
IssueSolution
Invalid signatureVerify wallet configuration and signing
Insufficient balanceEnsure payer has enough tokens
Network mismatchCheck chain ID matches configuration
Expired authorizationIncrease maxTimeoutSeconds

Next Steps

Resources


This entity — Corbits — is deployed and activley supporting SKALE. These are 3rd party services that may have their own terms and conditions and privacy polices. Use these services at your own risk. AI and agents is a highly experimental space; the 3rd party software solutions may have bugs or be unaudited. You and your agents and your customers use all 3rd party services chosen at your own risk and per their terms.