Merchant Onboarding Path
This guide walks you through deploying your own Accensa back-office, configuring it, and accepting your first x402 payment, timed end-to-end. We use the demo-merchant as our reference implementation.
1. Deploy the dashboard and provision the database
- Click Deploy to Vercel (or clone the repository).
- Provision a PostgreSQL database (e.g., using Vercel Postgres or Supabase).
- Set the
DATABASE_URLenvironment variable.
2. Configure the merchant address, asset(s) and RPC
- Set
MERCHANT_ADDRESSto your Stellar public key. - Set
ACCEPTED_ASSETSto a comma-separated list of Stellar assets you accept (e.g.,nativefor XLM). - Set
SOROBAN_RPC_URLto your preferred Stellar RPC endpoint.
3. Generate and configure the signing key
Generate an Ed25519 keypair for signing settlement reports.
- The private key is kept in your merchant server (
MERCHANT_PRIVATE_KEY). - The public key is given to Accensa (
MERCHANT_PUBLIC_KEY).
4. Install @accensa/sdk in your x402 resource server
In your resource server:
npm install @accensa/sdk
Mount the hook in your application:
import { attachAccensaHook } from '@accensa/sdk';
app.use(attachAccensaHook({
indexerUrl: process.env.ACCENSA_URL,
privateKeyHex: process.env.MERCHANT_PRIVATE_KEY
}));
[!WARNING] Middleware Ordering Pitfall: Ordinary authentication middleware must not be mounted globally, or it will reject the x402 handshake from an agent that by design has no account with you. The
attachAccensaHookmiddleware must be mounted after your x402 payment middleware so theX-PAYMENT-RESPONSEheader exists by the time the response finishes.
5. Verify the first payment appears
Send a request to your paywalled endpoint. Check your Accensa dashboard to see the payment appear with its route attributed.
6. Set up the sync schedule
Set up a cron job or external scheduler (e.g., GitHub Actions) to call POST /api/sync on your Accensa dashboard URL to index on-chain events.
7. Deploy the contracts and anchor your first batch
Use the Soroban CLI to deploy your ReceiptAnchor contract. Anchor a batch of payments to verify your revenue.
8. Verify a receipt
Use the SDK to verify the receipt. You can now hand an agent the same verification.