Skip to main content

Documentation

Everything you need to know about Blink402, Solana Blinks, and the x402 protocol.

Overview

Blink402 turns any HTTP endpoint into a pay-per-call Blink (Solana Action) that can be shared on X/Discord/web.

Users click, approve micro-payments in USDC on Solana, and our proxy executes the API call—no accounts, API keys, or custom smart contracts needed.

Key Benefits

  • Zero accounts or API keys for buyers
  • Near-instant settlement in USDC on Solana
  • No custom on-chain programs required
  • Shareable links that unfurl beautifully

How It Works

For Creators

1

Paste your endpoint & set price

Configure your API URL, method, and pricing in seconds.

2

Get shareable link & QR code

Receive a Blink URL and Solana Pay QR that unfurls beautifully on social media.

3

Earn instantly

Every time someone runs your Blink, you get paid directly to your wallet.

For Buyers (Human)

1

Click the Blink

Find a Blink on X, Discord, or the catalog.

2

Wallet popup

Approve the USDC payment on-chain (typically $0.01-$0.10).

3

Get instant result

API executes automatically after payment verification, result shown immediately.

Try It Live

Test the Full Flow

Experience the complete Blink402 flow right here in the docs. Connect your wallet, pay just $0.01 USDC, and see AI enhance your tweet in real-time. This is a real transaction on Solana mainnet using the ONCHAIN x402 protocol.

  • Real USDC payment ($0.01) on Solana mainnet
  • Instant settlement via ONCHAIN x402 (sub-2s)
  • AI-powered tweet enhancement by GPT-4
  • See transaction on Solscan after execution

Loading demo...

💡 Don't have USDC? You can get some on Jupiter Exchange or Raydium in seconds.

x402 Protocol

Blink402 implements the x402 Payment Required HTTP standard, allowing both humans and agents/bots to pay for API access programmatically.

How x402 Works

  1. 1. Client makes request to POST /bazaar/:slug
  2. 2. Server responds with 402 Payment Required and payment details
  3. 3. Client pays on Solana using provided details
  4. 4. Client retries request with signature header
  5. 5. Server verifies payment on-chain and proxies API call

Example 402 Response

{
  "status": 402,
  "price": "0.03",
  "currency": "USDC",
  "recipient": "9xQe...xyz789",
  "reference": "8cdbb0e6-6c3e-4a8d-9b9a-0a7b31b0a2a1",
  "action_url": "https://blink402-production.up.railway.app/actions/colorize",
  "expires_at": 1730582400
}

Agent Integration

Bots and AI agents can use Blink402 APIs programmatically by following the x402 payment flow.

TypeScript Example

import { Connection, Keypair, Transaction } from '@solana/web3.js'
import { getAssociatedTokenAddress, createTransferInstruction } from '@solana/spl-token'

async function callBlink402(slug: string, payload: any) {
  // 1. Initial request
  const res = await fetch(`https://blink402-production.up.railway.app/bazaar/${slug}`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(payload)
  })

  if (res.status !== 402) {
    return res.json() // Already paid or error
  }

  // 2. Parse payment details
  const { price, recipient, reference, action_url } = await res.json()

  // 3. Build & sign payment transaction
  const connection = new Connection('https://api.mainnet-beta.solana.com')
  const payer = Keypair.fromSecretKey(/* your key */)
  
  // ... build USDC transfer with reference ...

  const signature = await connection.sendTransaction(tx, [payer])
  await connection.confirmTransaction(signature)

  // 4. Retry with signature
  const finalRes = await fetch(`https://blink402-production.up.railway.app/bazaar/${slug}`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Signature': signature
    },
    body: JSON.stringify(payload)
  })

  return finalRes.json()
}

💡 Tip: Use Solana Pay's validateTransfer standard for building transactions.

Refunds & Credits

When are refunds issued?

Refunds or credits are only issued for upstream API failures—cases where the endpoint returned a 5xx error or timed out. Payment verification failures or invalid requests are not eligible.

Refund process

  • Automatic credit issuance for eligible failures
  • Credits appear in your dashboard within 1 hour
  • Use credits on future runs or request withdrawal

Not eligible for refunds

  • Invalid payment signatures
  • Wrong recipient or amount
  • Upstream API returned 4xx (client error)
  • Rate limit exceeded

Security

Payment Verification

All payments are verified on-chain using Solana Pay's validateTransfer:

  • Correct recipient wallet
  • Exact USDC amount
  • Valid reference UUID
  • Transaction confirmed on-chain

Idempotency

Each payment reference can only be used once. Attempting to reuse a reference returns 409 Conflict.

Rate Limiting

Rate limits are enforced per wallet/IP and per individual Blink to prevent abuse:

  • Per wallet: 100 requests/hour across all Blinks
  • Per Blink: 1000 requests/hour total
  • Exceeded limits return 429 Too Many Requests

Upstream Protection

  • Allowlist of permitted upstream domains
  • Content-type validation
  • Response size caps (5-10MB)
  • Timeout limits per Blink
  • CORS restrictions prevent third-party redirects

Ready to get started?

Create your first Blink in under a minute or explore the catalog to see what's possible.