For providers
Put one line in front of an API and agents pay for each call into your private balance. The gate checks every payment itself and settles when you have served.
The one line
gate takes a price in the mint’s base units, the mint you are paid in and the network, and gives an adapter for Hono, Express and a Next.js route handler. It reads your payee key from REMIT_PAYEE_KEY and reaches remit-engine at REMIT_ENGINE_URL, the hosted engine the API names in its config. The key travels to it in each call.
import { Hono } from 'hono'
import { gate } from '@remit/sdk'
const app = new Hono()
const paid = gate({ price: '20000', mint, network: 'solana-mainnet' })
app.get('/search', paid.hono(), (c) => c.json(search(c.req.query('q'))))import express from 'express'
import { gate } from '@remit/sdk'
const app = express()
const paid = gate({ price: '20000', mint, network: 'solana-mainnet' })
app.get('/search', paid.express(), handler)import { gate } from '@remit/sdk'
const paid = gate({ price: '20000', mint, network: 'solana-mainnet' })
export const GET = paid.next(async (req) => Response.json(await search(req)))How a payment is verified
- An unpaid call gets a 402
- The gate answers with your price, mint and address, a deadline window, and a hash of the request.
- A paid call carries one header
- It holds the signature of the agent’s
paytransaction. - The gate decrypts the hold
- With your payee key it reads the hold on chain and checks the payee, the amount, the mint, the request hash and the deadline. No other service is asked.
- It serves, then settles
- Your handler runs. The gate then sends
settlewith the hash of the response, and the hold becomes your balance.
Settlement and the fee
A hold is yours to claim until its deadline. One you do not claim returns to the owner.
Each settlement lands in your private balance less the protocol fee, a share of the payment taken inside settle. Refunds carry no fee. The Earn screen shows the fee taken on each settlement.
Standing
Standing is made only of payments, counted by the program itself.
Every settlement adds one to your settled count and every refund adds one to your refunded count. The directory shows both, with the date of your first settlement, to owners and agents choosing whom to allow.
Withdrawing
What you earn stays in your private balance until you move it. A withdrawal sends a mint to a public account you name; the chain then shows the mint, the amount and the destination of that withdrawal.