Runtime Execution (Per Call)

Consumer / Agent

  1. Sends USDC to Qwery escrow.

  2. Calls Qwery proxy with:

    • X-Qwery-Key

    • X-Qwery-Secret

    • X-Qwery-Payment = Solana tx signature

Qwery Gateway

  • Validates keys.

  • Hits Solana via Helius (fallback configured) and checks:

    • tx exists and confirmed

    • correct USDC mint

    • correct escrow recipient

    • sender matches registered wallet

    • amount >= required

    • tx within allowed time window

    • signature not previously used (Redis)

  • If valid:

    • proxies call to provider

    • triggers revenue split

    • logs event in MongoDB

    • returns provider response + Qwery metadata

  • If invalid:

    • responds with HTTP 402 and clear instructions

Target: 750–850 ms for full cycle in normal conditions.Every payment follows this pattern:typescript

// 1. Create payment request
const payment = await qwery.createPayment({
  amount: 0.01,
  token: 'SOL',
  recipient: 0.05, // 0.05 USDC per call
});

// 2. User signs + settle (handled by SDK)
const result = await qwery.signAndSettle(
  payment, 
  window.solana  // Wallet provider
);

// 3. Verify and grant access
if (result.success) {
  grantUserAccess();
}

Under the Hood:

  • createPayment() → POST /create-payment

  • signAndSettle() → User signs → POST /settle

  • Facilitator submits to Solana, pays ~0.00001 SOL fee

  • Returns transaction signature for verification

Last updated