Skip to main content
Need help? Join the Discord for the assistant and get latest updates.
Complete this guide to start accepting X402 payments on Finance District Prism.
Estimated time: 20 minutes

Prerequisites

Before you start, make sure you have:
1

Development environment

  • Node.js v18+ for TypeScript/JavaScript
  • Python 3.9+ for Python (coming Q1 2026)
  • Your preferred backend framework
2

Testnet wallet

  • Test X402 tokens on a supported network (e.g., Base Sepolia)
  • Enough native gas token for transactions
3

Prism API credentials

Get your API key from the Prism Management Console

Step 1: Choose Your Framework & Install SDK

Select your framework and follow the detailed integration guide:
Each framework guide includes complete code examples, configuration options, and best practices. You can also visit the SDKs documentation for direct integration.

Step 2: Protect Your First Endpoint

Add payment protection to your API endpoint. Here’s a minimal example:
// Configure middleware with your API key
app.use(prismPaymentMiddleware({
  apiKey: process.env.PRISM_API_KEY,
  baseUrl: 'https://prism-api.test.1stdigital.tech'
}, {
  '/api/premium': {
    price: 0.01,  // $0.01 USD
    description: 'Premium API access'
  }
}));

// Your protected route
app.get('/api/premium', (req, res) => {
  res.json({
    message: 'Premium content',
    payer: req.payer  // Wallet address that paid
  });
});
See complete examples for your framework:

Step 3: Configure Spectrum for Revenue Distribution

Step 3: Configure Spectrum for Revenue Distribution

Automate payment splits to multiple recipients:
1

Plan your revenue split

{
  recipients: [
    { address: '0xYourAddress', share: 85 },      // Seller: 85%
    { address: '0xPlatformAddress', share: 10 },   // Platform: 10%
    { address: '0xPartnerAddress', share: 5 }      // Partner: 5%
  ]
}
2

Register in Management Console

  1. Navigate to Prism Management Console
  2. Go to Spectrum Configuration
  3. Add recipients and percentages
  4. Deploy to testnet
  5. Copy the Configuration ID
3

Link to your payment endpoint

app.use(prismPaymentMiddleware({
  apiKey: process.env.PRISM_API_KEY,
  spectrumConfigId: 'spectrum-config-abc123'
}, routeConfig));

Step 4: Test End-to-End

1

Get testnet tokens

Visit the Prism Faucet to get test X402 tokens
2

Make a test request

curl http://localhost:3000/api/premium
Expect 402 response with payment details
3

Submit payment

npx @1stdigital/prism-cli pay \
  --endpoint http://localhost:3000/api/premium \
  --wallet $PRIVATE_KEY
Or use the Prism Test Wallet
4

Verify

  • ✅ Payment settled on-chain
  • ✅ API returns protected data (200 OK)
  • ✅ Spectrum distribution executed

Production Checklist

1

Security

  • Store API keys in environment variables
  • Enable rate limiting
  • Use HTTPS only
  • Implement authentication
2

Configuration

  • Verify Spectrum recipients
  • Test with small amounts first
  • Review access controls
3

Monitoring

  • Log payment requests
  • Set up failure alerts
  • Track settlement rates
  • Monitor Spectrum events
Start with testnet and migrate to mainnet gradually after thorough testing.

Framework-Specific Guides

Individual Framework Guides


Next Steps