For API builders
Wrap the API you already have.
Define one fair promotional policy, paste the middleware into your existing endpoint, and let Alive402 handle World eligibility and Hedera continuation.
npm install @nikhilraikwar/alive402-sdkYour World and Hedera secrets stay in server environment variables.
Create a trial policy
The public demo generates configuration only. Secrets stay in your server environment.
World action
alive402-acme-ai-trial-v1 TypeScript
import { withAlive402 } from "@nikhilraikwar/alive402-sdk";
import { store, resolveEnrollment } from "./alive402-server.js";
export const POST = withAlive402(existingHandler, {
providerId: "acme-ai",
world: { action: "alive402-acme-ai-trial-v1", resolveEnrollment },
trial: { freeCalls: 1, store },
payment: {
network: "hedera:testnet",
facilitatorUrl: "https://api.testnet.blocky402.com",
asset: "0.0.429274",
amount: "1000",
payTo: "0.0.1234567"
},
resource: { url: "/v1/research", description: "Acme AI research API", serviceName: "Acme AI" }
});
Fair enrollment
World nullifiers scope one promotional entitlement to each provider campaign.
Protocol-native revenue
The same HTTP endpoint advertises and accepts canonical x402 payments.
Auditable outcomes
Every access decision and settlement creates a sanitized execution receipt.