Common issues and solutions when using Shade402.
Payment Not Detected
Problem: Server doesn't detect payment authorization.
Solutions:
Check that X-Payment-Authorization header is included
Verify header is base64-encoded JSON
Check that payment authorization format is correct
Ensure middleware is processing the header
// Debug: Log headers
app.use((req, res, next) => {
console.log('Headers:', req.headers);
next();
});
Payment Verification Fails
Problem: Payment verification fails even though transaction exists.
Solutions:
Check RPC endpoint is correct and accessible
Verify network matches (devnet vs mainnet)
Ensure transaction is confirmed on blockchain
Check transaction signature is valid
Verify payment addresses match
Payment Expired
Problem: Payment request expires before payment is made.
Solutions:
Check system clock synchronization
Use shorter expiration for automated flows
Insufficient Funds
Problem: Wallet doesn't have enough tokens.
Solutions:
Ensure correct token mint address
Verify token account exists
Cannot Connect to RPC
Problem: Client cannot connect to Solana RPC endpoint.
Solutions:
Verify network connectivity
Try different RPC endpoint
Check rate limits on RPC provider
Transaction Broadcast Fails
Problem: Transaction fails to broadcast.
Solutions:
Ensure sufficient SOL for fees
URL Validation Errors
Problem: Client rejects localhost URLs.
Solutions:
Enable allowLocal for development
Use production URLs in production
Check URL format is correct
402 Response Not Sent
Problem: Server doesn't send 402 response when payment required.
Solutions:
Check middleware is applied correctly
Verify payment authorization header is missing
Ensure error middleware is after routes
Payment Authorization Not Parsed
Problem: Server cannot parse payment authorization.
Solutions:
Check header format is correct
Validate all required fields
Resource Encryption Fails
Problem: Resource encryption/decryption fails.
Solutions:
Verify RSA keys are correct format
Check keys are PEM format
Ensure public/private key pair matches
Verify encryption algorithm compatibility
Configuration Issues
Configuration Not Initialized
Problem: Error that X402 is not initialized.
Solutions:
Call initX402() before using middleware
Ensure initialization happens once at startup
Check configuration values are set
Environment Variables Not Loaded
Problem: Configuration values are undefined.
Solutions:
Verify environment variables are loaded
Use dotenv package if needed
Check variable names match
Problem: Using wrong Solana network.
Solutions:
Check network configuration matches
Ensure RPC endpoint matches network
Check token mint matches network
RPC Rate Limiting
Problem: RPC endpoint rate limits exceeded.
Solutions:
Use different RPC provider
Add retry logic with backoff
TypeScript Issues
Problem: TypeScript compilation errors.
Solutions:
Use correct type annotations
Enable Verbose Logging
Check Transaction Status
Test Payment Flow Manually
If you're still experiencing issues:
Open an issue on GitHub with:
Configuration (without secrets)
Network and environment details
Last updated