Back to DirectoryTry in Playground

Comments API

0.043 USDC / call

It generates random comments use /{number} to get unique comments

Demo Only

This API is provided for demonstration purposes only on the Stellar testnet. Do not use real funds or expect production-level uptime from this endpoint.

How to Use
Make a POST request to this endpoint with a valid x402 payment signature.

Endpoint

POST https://paygate-stellar-swart.vercel.app/api/x/comments

Using @x402/fetch

The easiest way to call this API programmatically in TypeScript/JavaScript is by using the official @x402/fetch package. It automatically intercepts 402 Payment Required responses, signs the required transaction on the Stellar testnet using your wallet, and retries the request seamlessly.

import { x402Client } from "@x402/core";
import { ExactStellarScheme, createEd25519Signer } from "@x402/stellar";
import { wrapFetchWithPayment } from "@x402/fetch";

// 1. Initialize your wallet signer (Testnet)
const signer = createEd25519Signer("YOUR_STELLAR_SECRET_KEY", "stellar:testnet");
const scheme = new ExactStellarScheme([signer]);

// 2. Wrap your standard fetch client
const client = new x402Client({ schemes: [scheme] });
const payFetch = wrapFetchWithPayment(fetch, client);

// 3. Make the request — payment is handled automatically!
const response = await payFetch("https://paygate-stellar-swart.vercel.app/api/x/comments", {
  method: "POST",
  body: JSON.stringify({ query: "example" })
});

const data = await response.json();
console.log(data);