Start
Quickstart
Open a remit, make one paid call from an agent, and read the payment in the statement.
This page goes from a wallet to a first settled payment. You open a remit in the app, an agent script pays for one API call with it, and the payment shows up in your statement.
You need a Solana wallet holding some USDC and a little SOL, Node 20.6 or later, and the URL of an API behind a Remit gate. Pick one from the directory, or put your own behind a gate.
1. Open a remit
Set up a private balance
Open the app. Press Connect and pick your wallet, press Sign to derive the keys, then Register.
Deposit
On Balance, enter an amount of USDC and press Deposit.
Open the remit
On Open a remit:
- press Generate a key, then Copy the env line
- enter the Amount, the Cap per payment and the Cap per day
- tick the payee you are going to call, or choose Any payee
- press Review, then Open the remit
Press Go to the remit and leave the page open.
2. Make a paid call
Install the SDK
Shell mkdir remit-agent && cd remit-agent npm init -y && npm pkg set type=module npm install @remit/sdkSet the environment
.env REMIT_AGENT_KEY=<the line you copied> REMIT_ENGINE_URL=<the engine's URL> REMIT_API_URL=<the API's URL>The API's URL is
not set yet. The engine's URL is theengineUrlin the answer ofGET /v1/configon it.Write the agent
agent.js import { createRemit } from '@remit/sdk' const remit = createRemit() const response = await remit.fetch('https://api.example.com/quote') console.log('status', response.status) console.log('receipt', response.headers.get('x-remit-receipt')) console.log(await response.text())Replace the URL with the gated API's.
Run it
Shell node --env-file=.env agent.jsIt prints the API's status, the signature of the payment, and the response body.
Between the two requests the SDK read the price from the API's 402, proved that it fits the remit's terms, and paid it into a hold for the payee.
3. Read the statement
Go back to the remit's page and reload. The payment is in the Statement with its payee, the request, the amount and the status held. Once the payee settles, which follows its response by seconds, the status reads settled and Remaining is down by the price.
Press Disclose on the row to copy a link that shows this one payment to whoever opens it.
Try a refusal
Set the script's URL to an API that is not on the remit's payee list, or one whose price is over the cap per payment, and run it again. The SDK throws before anything is sent:
import { createRemit, RemitError } from '@remit/sdk'
const remit = createRemit()
try {
await remit.fetch('https://api.example.com/jobs')
} catch (error) {
if (error instanceof RemitError) console.log(error.name, error.code)
}It prints the name of the term that refused, such as PayeeNotAllowed PAYEE_NOT_ALLOWED. The statement shows no new row and the remit holds what it held.