Back to Merchant Hub
Merchant Hub // Developer Documents

Merchant Integration
SDK v2.5.0 Suite

Join the decentralized AI economy in minutes. Our unified SDK handles security, protocol handshakes, and body unwrapping for you.

1. Deploy Merchant Gateway

Implement a POST endpoint on your server to receive signed requests from the PayNode Market Proxy.

2. Register API & Get Secret

List your API on the Market to obtain a unique Shared Secret (HMAC Key) for your gateway.

3. Verify Signature

Use the Shared Secret to perform HMAC-SHA256 validation on incoming headers to ensure trust.

📦 Recommended: PayNode Merchant SDK

The Minimal-Code Path

The @paynodelabs/sdk-js provides a dead-simple way to secure your APIs. It handles strict signature verification and body unwrapping so you can focus on building your service.

Express.js / Node.js
import { PayNodeMerchant } from '@paynodelabs/sdk-js';
import express from 'express';

const merchant = new PayNodeMerchant({
  sharedSecret: process.env.PAYNODE_SECRET // 1. Single secret from Market
});

const app = express();
app.use(express.json());

// 2. Add the all-in-one middleware
app.post('/api/action', merchant.middleware({
  manifest: { slug: 'my-api', price_per_call: '0.01' }
}), (req, res) => {
  // 3. Transparent Access: SDK unwraps Market Proxy data into req.body
  const { query } = req.body;
  res.json({ result: "Success: verified by PayNode Market" });
});
Strict HMAC Protection Enabled
Automatic Payload Unwrapping
Zero Wallet-Address Lock-in
Self-Describing API Discovery

Protocol Interaction (x402-v2 Hook)

PayNode act as a security barrier between AI Agents and your backend. The proxy ensures transaction validity via HMAC-SHA256 signed handshakes, preventing unauthorized access.

1

Agent Initial Request

Proxy intercepts request and returns 402 Payment Required. This is transparent to you.

2

Payment Success & Forwarding

Once paid, the Proxy forwards the original request with signature headers to your Gateway.

3

Verification & Delivery

You verify the HMAC signature. If valid, return your business JSON normally.

Authentication Specification

HTTP HEADER VALIDATION
Header KeyDescription
X-PayNode-SignatureThe HMAC-SHA256 signature generated by Proxy.
X-PayNode-Request-IdUnique Order ID. Recommended for idempotency.
X-PayNode-TimestampUnix timestamp in milliseconds.
X-PayNode-DiscoverySet to true by the Market to request the API Manifest (Schema Sync).
Node.js (Next.js)
const crypto = require('crypto');

// Load the Unique Shared Secret from your env
const secret = process.env.PLATFORM_HMAC_SECRET as string;

// Reconstruct signed message
const orderId = req.headers.get('X-PayNode-Request-Id');
const timestamp = req.headers.get('X-PayNode-Timestamp');
const signature = req.headers.get('X-PayNode-Signature');

const message = `${orderId}${timestamp}`;
const expectedSig = crypto
  .createHmac('sha256', secret)
  .update(message)
  .digest('hex');

if (signature !== expectedSig) {
  return Response.json({ error: "Unauthorized" }, { status: 401 });
}

🚀 One-Interface Discovery (Auto-Sync)

Say goodbye to manually editing JSON schemas. Our platform features Self-Healing Discovery: when an API is accessed, the Market automatically performs a background sync to capture new fields like Sample Responses and Headers.

Protocol Response (SDK Managed)
{
  "status": "DISCOVERED",
  "version": "2.5.0",
  "manifest": {
    "slug": "image-gen-v1",
    "name": "Neural Image Render",
    "price_per_call": "0.05",
    "sample_response": { "status": "success", "image_url": "https://..." },
    "headers_template": { "Content-Type": "application/json" },
    "input_schema": {
      "type": "object",
      "properties": {
        "prompt": { "type": "string", "description": "Visual description" }
      },
      "required": ["prompt"]
    }
  }
}

Instant Marketplace Sync

Once your SDK is configured with a manifest, click "Refresh / Sync Manifest" in your Merchant Dashboard. The Market will instantly update the public documentation and parameters.

Unified Security

Discovery requests carry the same HMAC signatures as paid requests. Your sensitive metadata is only exposed to the official PayNode Platform.

Ready to Launch?

Deploy your gateway and list your first API. We recommend Sandbox testing before using Mainnet resources.

Register Your API Entry