The AgenticPay Sandbox provides a complete testing environment for API development without requiring real transactions on the blockchain.
bash scripts/setup-sandbox.shThis will:
- Create sandbox directories
- Copy environment template
- Install dependencies
- Generate API documentation
Edit .env.sandbox:
cp .env.sandbox.example .env.sandboxKey settings:
SANDBOX_MODE=true- Enable sandbox featuresFAKE_PAYMENTS_ENABLED=true- Use mock payment processingTEST_DATA_SEEDING_ENABLED=true- Generate test dataMOCK_WEBHOOKS_ENABLED=true- Simulate webhook delivery
Backend:
cd backend
npm run devFrontend (in another terminal):
cd frontend
npm run devAPI is now available at: http://localhost:3000/api/v1
Process payments without Stellar transactions:
curl -X POST http://localhost:3000/api/v1/sandbox/payments/process \
-H "Content-Type: application/json" \
-d '{
"projectId": "proj-123",
"clientAddress": "GCLIENT...",
"freelancerAddress": "GFREELANCER...",
"amount": 100,
"currency": "XLM",
"delay": 1000
}'Response:
{
"success": true,
"payment": {
"transactionId": "mock_1234567890_abc123",
"status": "success",
"timestamp": 1234567890
}
}Seed realistic test data:
curl -X POST http://localhost:3000/api/v1/sandbox/testdata/seed \
-H "Content-Type: application/json" \
-d '{
"users": 10,
"projects": 20,
"payments": 50,
"invoices": 30
}'Response:
{
"success": true,
"seeded": {
"userCount": 10,
"projectCount": 20,
"paymentCount": 50,
"invoiceCount": 30
}
}Create test wallets without funding:
curl -X POST http://localhost:3000/api/v1/sandbox/wallets/generateResponse:
{
"wallet": {
"address": "GXXXXXXXXX...",
"seed": "SXXXXXXXXX...",
"publicKey": "GXXXXXXXXX...",
"privateKey": "SXXXXXXXXX..."
},
"environment": "testnet",
"fundingUrl": "https://friendbot.stellar.org/?addr=GXXXXXXXXX..."
}Simulate webhook delivery:
curl -X POST http://localhost:3000/api/v1/sandbox/webhooks/simulate \
-H "Content-Type: application/json" \
-d '{
"event": "payment.completed",
"data": {
"projectId": "proj-123",
"amount": 100,
"status": "success"
},
"webhookUrl": "https://your-webhook-url.com/hook"
}'List generated test data:
# Get all users
curl http://localhost:3000/api/v1/sandbox/testdata/users
# Get all projects
curl http://localhost:3000/api/v1/sandbox/testdata/projects
# Get statistics
curl http://localhost:3000/api/v1/sandbox/testdata/statistics
# Clear all sandbox data
curl -X DELETE http://localhost:3000/api/v1/sandbox/testdata/clearInteractive API explorer available at:
- Swagger UI: http://localhost:3000/docs
- OpenAPI Spec: http://localhost:3000/docs/openapi.json
Try API endpoints directly in the browser without writing code!
# Enable sandbox mode
SANDBOX_MODE=true
# Features
FAKE_PAYMENTS_ENABLED=true
MOCK_WEBHOOKS_ENABLED=true
TEST_DATA_SEEDING_ENABLED=true
# Logging
SANDBOX_LOG_WEBHOOKS=true
LOG_LEVEL=debug
# Rate limiting (relaxed in sandbox)
RATE_LIMIT_ENABLED=falseSTELLAR_NETWORK=testnet
STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org- Seed test data:
curl -X POST http://localhost:3000/api/v1/sandbox/testdata/seed \
-H "Content-Type: application/json" \
-d '{"projects": 5}'- Generate invoice:
curl -X POST http://localhost:3000/api/v1/invoice/generate \
-H "Authorization: Bearer your-token" \
-H "Content-Type: application/json" \
-d '{
"projectId": "proj-id",
"workDescription": "Development work",
"hoursWorked": 10,
"hourlyRate": 50
}'- Generate testnet wallet:
curl -X POST http://localhost:3000/api/v1/sandbox/wallets/generate- Process mock payment:
curl -X POST http://localhost:3000/api/v1/sandbox/payments/process \
-H "Content-Type: application/json" \
-d '{
"projectId": "proj-123",
"clientAddress": "GCLIENT...",
"freelancerAddress": "GFREELANCER...",
"amount": 100
}'- Check payment status:
curl http://localhost:3000/api/v1/sandbox/payments/mock_1234567890_abc123- Seed test data
- Batch verify submissions:
curl -X POST http://localhost:3000/api/v1/verification/verify/batch \
-H "Authorization: Bearer your-token" \
-H "Content-Type: application/json" \
-d '{
"verifications": [
{"projectId": "proj-1", "status": "approved"},
{"projectId": "proj-2", "status": "rejected"}
]
}'Check environment variables:
curl http://localhost:3000/api/v1/sandbox/statusIf you get 403, sandbox is disabled. Update .env.sandbox:
SANDBOX_MODE=trueSandbox data is in-memory by default. It will clear on server restart.
To persist test data, configure a local database:
DATABASE_URL=postgresql://user:password@localhost:5432/agenticpay_sandboxEnable mock webhooks in .env.sandbox:
MOCK_WEBHOOKS_ENABLED=true
SANDBOX_LOG_WEBHOOKS=true- Isolation: Always use sandbox for development
- Data: Seed fresh test data between test runs
- Cleanup: Clear sandbox data when done (
DELETE /sandbox/testdata/clear) - Logging: Enable webhook logging for debugging (
SANDBOX_LOG_WEBHOOKS=true) - Documentation: Keep
.env.sandbox.exampleup to date
- Explore API endpoints in Swagger UI
- Review auto-generated SDKs in
backend/docs/api/sdks/ - Check OpenAPI specification:
backend/docs/api/openapi/openapi.json - Read full API docs:
backend/docs/api/INDEX.md
- 📖 Full documentation: https://docs.agenticpay.com
- 🐛 Issue tracker: https://github.com/Smartdevs17/agenticpay/issues
- 💬 Discussion: https://github.com/Smartdevs17/agenticpay/discussions