GATEX402

The Payment Gate for Agentic Economy

One-line payment integration for autonomous agents on Solana. Accept SOL, SPL tokens, and stablecoins — with x402 protocol-level settlement.

View GitHub
Protocol Active on Solana Mainnet
Quick Integration
// Install
npm install @gatex402/checkout

// 3 lines to accept payments
import { GateCheckout } from '@gatex402/checkout'

const gate = new GateCheckout({
  merchant: 'your-wallet-address',
  network: 'mainnet',
  accept: ['SOL', 'USDC', 'USDT']
})

gate.open({ amount: 5.0, currency: 'USDC' })
Built for Machines.
Usable by Humans.

One-Line Integration

Drop a single script tag or npm import. Payment modal handles wallet connection, token selection, and confirmation automatically.

🤖

Agent-Native Payments

Built for AI-to-AI commerce. Agents pay agents autonomously via x402 protocol headers — no human approval needed.

🔒

Risk Intelligence

Every transaction scored in real-time for anomalies, MEV exposure, and counterparty risk.

💸

Multi-Token Accept

SOL, USDC, USDT, and any SPL token. Auto-convert to merchant's preferred settlement currency on-chain.

📡

Webhook & Callbacks

Real-time payment notifications via webhooks. Trigger fulfillment, update databases, or notify agents on confirmed transactions.

🔗

Payment Links

No-code payment URLs. Share a link, get paid. Perfect for creators, freelancers, and quick commerce without deploying code.

Three Steps. Zero Friction.
01

Initialize Gateway

Install the SDK and configure with your wallet address. Supports Phantom, Solflare, and programmatic wallets for agents.

npm install @gatex402/checkout
02

Trigger Payment

Call gate.open() with amount and currency. The checkout modal handles wallet selection, approval, and signing — or use headless mode for agent-to-agent settlement.

gate.open({ amount: 10, currency: 'USDC', memo: 'order-4821' })
03

Receive & Verify

Webhook fires on confirmation. Transaction verified on-chain with risk score attached. Funds settle to your wallet instantly.

gate.on('confirmed', (tx) => { /* tx.signature, tx.riskScore */ })
Technical Architecture
Pure performance. Zero bloat. Built on battle-tested infrastructure.
Network
Solana
Protocol
x402
Engine
Pure C
Settlement
< 400ms
SDK
npm
Wallets
Phantom / Solflare
Tokens
SOL / SPL
What's Coming
Q1 2026
Foundation
GATEX402 SDK v1.0 · Checkout modal · Headless mode · Payment links · Webhook system
Completed
Q2 2026
Agent Economy
Agent-to-agent settlement · Escrow protocol · MicroStream pay-per-use · MOLTDMKT integration · ClawGenesis payment rails
In Progress
Q3 2026
Scale
Multi-token auto-convert · Merchant dashboard · Invoice generator · Risk scoring v2 · CLI tools
Q4 2026
Expansion
Cross-chain settlement · Yield on idle balances · BNPL protocol · KYB merchant onboarding · $GATEX token launch
Accept Payments.
One Line. Done.
Join the agentic economy. Integrate GATEX402 into your dApp, agent, or marketplace in under 60 seconds.
Follow @GATEX402_
Documentation

GATEX402

The payment gateway protocol for the agentic economy. GATEX402 provides one-line payment integration for Solana dApps, AI agents, and marketplaces.

Key Features

One-line checkout · Agent-to-agent settlement · Multi-token (SOL, USDC, SPL) · Risk scoring · Webhooks · Payment links · Escrow · Micropayments · <400ms settlement

Installation

Terminal
# npm
npm install @gatex402/checkout

# yarn
yarn add @gatex402/checkout

# CDN
<script src="https://cdn.gatex402.com/v1/checkout.min.js"></script>

Quick Start

Initialize the gateway with your wallet, then call open() to trigger a payment.

JavaScript
import { GateCheckout } from '@gatex402/checkout'

const gate = new GateCheckout({
  merchant: 'YOUR_WALLET_ADDRESS',
  network:  'mainnet',
  accept:   ['SOL', 'USDC', 'USDT'],
  theme:    'dark'
})

gate.open({ amount: 25, currency: 'USDC', memo: 'order-9281' })

gate.on('confirmed', (tx) => {
  console.log(tx.signature, tx.riskScore, tx.amount)
})

Configuration

Full options for the GateCheckout constructor.

ParameterTypeDefaultDescription
merchantstringYour Solana wallet address (required)
networkstring'mainnet''mainnet' or 'devnet'
acceptstring[]['SOL']Accepted tokens
themestring'dark''dark' | 'light' | 'auto'
rpcstringautoCustom RPC endpoint
webhookstringWebhook URL for notifications
riskThresholdnumber0.7Risk score threshold (0-1)
autoConvertstringAuto-convert to this token on settlement
escrowbooleanfalseEnable escrow mode

Checkout Modal

Default UI integration. Handles wallet detection, token selection, amount display, and signing.

JavaScript
gate.open({
  amount:      10.00,
  currency:    'USDC',
  memo:        'invoice-0042',
  metadata:    { orderId: 'abc123' },
  redirectUrl: 'https://yoursite.com/success',
  expiry:      300
})

Headless Mode

For agent-to-agent or server-side payments. No UI — transactions signed programmatically.

JavaScript
import { GateHeadless } from '@gatex402/checkout/headless'

const gate = new GateHeadless({
  merchant: 'MERCHANT_WALLET',
  network:  'mainnet',
  signer:   agentKeypair
})

const tx = await gate.pay({
  amount: 0.5, currency: 'SOL', memo: 'agent-task-7712'
})
⚠ Security

Headless mode requires a private key. Never expose keypairs in client-side code. Use env vars or secure key management.

No-code payment URLs. Share a link, get paid.

JavaScript
const link = gate.createLink({
  amount: 50, currency: 'USDC',
  label: 'Logo Design — Final', expiry: '24h'
})
// → https://pay.gatex402.com/p/x7k9m2
CLI
npx gatex402 link --amount 50 --currency USDC --label "Invoice #42"

API Reference

Constructor

NEWGateCheckout(config)

Creates a checkout instance. See Configuration for options.

NEWGateHeadless(config)

Creates a headless instance for programmatic payments. Requires signer keypair.

Methods

CALLgate.open(options)

Opens checkout modal.

ParamTypeDescription
amountnumberPayment amount (required)
currencystringToken symbol or SPL mint
memostringOn-chain memo
metadataobjectCustom metadata (sent to webhook)
redirectUrlstringPost-payment redirect
expirynumberExpiration in seconds
CALLgate.pay(options)

Headless payment. Returns Promise<Transaction>.

GETgate.createLink(options)

Generate payment link. Returns { url, id, expiry }.

GETgate.getTransaction(sig)

Fetch tx details + risk score by signature.

CALLgate.escrow.create(opts)

Create escrow. Funds locked until release() or refund().

CALLgate.close()

Close checkout modal programmatically.

Events

EVENTconfirmed

Payment confirmed on-chain.

Payload
{ signature, amount, currency, from, to, riskScore, memo, metadata, timestamp }
EVENTfailed

Payment failed (rejected, insufficient balance, network error).

EVENTcancelled

User closed checkout without paying.

EVENTrisk:flagged

Transaction exceeded riskThreshold. Still processed but flagged.

Types

TypeScript
interface GateConfig {
  merchant: string; network?: 'mainnet'|'devnet'
  accept?: string[]; theme?: 'dark'|'light'|'auto'
  rpc?: string; webhook?: string
  riskThreshold?: number; autoConvert?: string
  escrow?: boolean
}

interface PaymentOptions {
  amount: number; currency?: string
  memo?: string; metadata?: Record<string,any>
  redirectUrl?: string; expiry?: number
}

interface Transaction {
  signature: string; amount: number
  currency: string; from: string; to: string
  riskScore: number; memo: string
  metadata: Record<string,any>; timestamp: number
}

interface EscrowContract {
  id: string; amount: number; currency: string
  status: 'locked'|'released'|'refunded'|'disputed'
  parties: { payer: string; payee: string }
  expiry: number
  release(): Promise<Transaction>
  refund(): Promise<Transaction>
}

Agent Integration

GATEX402 is agent-first. AI agents send and receive payments autonomously via x402 protocol.

Agent-to-Agent Payments

JavaScript — Agent Payer
import { GateHeadless } from '@gatex402/checkout/headless'
import { Keypair } from '@solana/web3.js'

const agent = new GateHeadless({
  merchant: 'TARGET_AGENT_WALLET',
  network:  'mainnet',
  signer:   Keypair.fromSecretKey(agentSecret)
})

const tx = await agent.pay({
  amount: 2.5, currency: 'USDC',
  memo: 'moltdmkt:skill:sentiment-v3',
  metadata: { protocol: 'x402', agent_id: 'agent-alpha-9' }
})

Escrow Protocol

Lock funds for task-based work. Release on completion, auto-refund on expiry.

JavaScript — Escrow
const escrow = await gate.escrow.create({
  amount: 100, currency: 'USDC',
  payee: 'WORKER_WALLET',
  expiry: 86400,
  memo: 'code-review-441'
})

// On task complete
await escrow.release()

// Or refund
await escrow.refund()

Micropayments

Pay-per-use for API calls and AI inference. Batched settlements to reduce fees.

JavaScript — MicroStream
import { MicroStream } from '@gatex402/checkout/micro'

const stream = new MicroStream({
  merchant: 'API_PROVIDER_WALLET',
  signer: agentKeypair,
  ratePerCall: 0.001,
  settleEvery: 100,
  currency: 'USDC'
})

await stream.tick()  // +0.001 USDC
await stream.tick()  // +0.001 USDC
// auto-settles every 100 ticks

await stream.settle() // force settle

Webhooks

Real-time HTTP POST notifications on payment events.

JSON — Webhook Payload
{
  "event": "payment.confirmed",
  "tx": {
    "signature": "5Uh7x...",
    "amount": 25.00,
    "currency": "USDC",
    "from": "7xKp...",
    "to": "9mRq...",
    "riskScore": 0.08,
    "memo": "order-9281"
  },
  "timestamp": 1711532400
}

Event Types

EventDescription
payment.confirmedPayment confirmed on-chain
payment.failedPayment failed
payment.risk_flaggedPayment exceeded risk threshold
escrow.createdEscrow created and funded
escrow.releasedEscrow released to payee
escrow.refundedEscrow refunded to payer
link.paidPayment link used
Verification

Webhooks include X-Gate-Signature header. Verify with HMAC using your merchant secret.

Risk Scoring

Every transaction scored by the built-in risk engine in real-time.

ScoreLevelAction
0.00–0.30🟢 LowAuto-approve
0.31–0.60🟡 MediumMonitor
0.61–0.85🟠 HighFlagged + webhook alert
0.86–1.00🔴 CriticalBlocked if threshold set

Supported Tokens

TokenSymbolType
SolanaSOLNative
USD CoinUSDCSPL
TetherUSDTSPL
CustomAny mintSPL
JavaScript — Custom Token
const gate = new GateCheckout({
  merchant: 'YOUR_WALLET',
  accept: ['SOL', 'USDC', 'G8e2v6t4LfsJChH1LiF7xTiVVNR4u4R98VTmU6QWpump']
})

Error Codes

CodeNameDescription
GATE_001WALLET_NOT_FOUNDNo compatible wallet detected
GATE_002INSUFFICIENT_BALANCEInsufficient token balance
GATE_003TX_REJECTEDUser rejected transaction
GATE_004NETWORK_ERRORRPC/network failure
GATE_005RISK_BLOCKEDBlocked by risk threshold
GATE_006CHECKOUT_EXPIREDSession expired
GATE_007INVALID_TOKENToken not in accept list
GATE_008ESCROW_EXPIREDEscrow auto-refunded
GATE_009WEBHOOK_FAILEDWebhook delivery failed
GATE_010SIGNER_INVALIDInvalid headless keypair

Changelog

v1.0.0 — March 2026

  • Initial release
  • Checkout modal (dark/light/auto)
  • Headless mode for agent payments
  • Payment links (SDK + CLI)
  • Escrow protocol
  • MicroStream pay-per-use
  • Built-in risk scoring
  • Webhook notifications
  • SOL, USDC, USDT, custom SPL support