API Documentation
Complete guide to integrate Synapse Merchant token-based payment system
Quick Start
Get started in 3 simple steps
Purchase Service
Create payment request and pay via PayAI
Get Token
Verify payment and receive access token
Make Requests
Use token to access RPC and transaction services
Base URL
https://merchant.synapse.networkPayment Flow
Purchase services and receive access tokens
/api/payments/createCreate a payment request for a specific service
{
"sessionId": "sess_abc123",
"serviceType": "rpc_call",
"tier": "basic",
"clientPublicKey": "YourSolanaPublicKey..."
}{
"success": true,
"paymentUrl": "https://facilitator.payai.network/pay/req_xyz",
"amountSOL": 0.002,
"expiresAt": "2024-01-15T12:00:00Z"
}Open the paymentUrl and complete the on-chain payment
/api/payments/verifyVerify the payment was completed successfully
{
"sessionId": "sess_abc123",
"signature": "5k2n8m..."
}{
"success": true,
"receipt": {
"receiptId": "rcpt_def456",
"servicePurchased": "rpc_call",
"quantityPurchased": 100,
"verified": true
}
}/api/tokens/createGenerate access token from verified receipt
{
"receiptId": "rcpt_def456",
"label": "MyAIAgent - RPC Access"
}{
"success": true,
"token": {
"token": "mt_live_48a8b3c9d1e2f3g4h5i6j7k8l9m0n1o2",
"remainingLamports": 2000000,
"remainingRequests": 100,
"rpsLimit": 10,
"active": true
}
}Using Tokens
Make authenticated requests with your access token
/api/ai/rpcExecute Solana RPC method calls
Authorization: Bearer mt_live_48a8b3c9d1e2f3g4h5i6j7k8l9m0n1o2
{
"method": "getAccountInfo",
"params": ["YourAccountPublicKey..."]
}{
"success": true,
"result": {
"lamports": 1000000,
"owner": "11111111111111111111111111111111"
},
"cost": 20000,
"remaining": {
"lamports": 1980000,
"requests": 99
}
}/api/ai/transactionSend Solana transactions with priority
{
"transaction": "base64-encoded-transaction",
"options": {
"skipPreflight": false
}
}{
"success": true,
"signature": "5k2n8m...",
"cost": 1000000,
"remaining": {
"lamports": 980000,
"requests": 98
}
}Token Management
Manage your access tokens
/api/tokens/infoGet current token balance and rate limits
{
"success": true,
"token": {
"remainingLamports": 1980000,
"remainingRequests": 99,
"rpsLimit": 10,
"rpmLimit": 600,
"active": true
}
}/api/tokens/refillTop-up existing token with additional balance
{
"token": "mt_live_48a8b3c9d1e2f3g4h5i6j7k8l9m0n1o2",
"receiptId": "rcpt_ghi789"
}/api/tokens/revokePermanently disable a token
{
"token": "mt_live_48a8b3c9d1e2f3g4h5i6j7k8l9m0n1o2"
}Pricing
Instance-based pricing with volume discounts
RPC Calls
Basic tier
- 10 RPS limit
- 100% markup
Priority TX
Premium tier
- Fast confirmation
- 100% markup
AI Analysis
Enterprise tier
- Advanced AI
- 900% markup
Volume Discounts
Error Handling
{
"success": false,
"error": "Missing or invalid authorization header"
}{
"success": false,
"error": "Insufficient balance",
"remaining": {
"lamports": 5000,
"required": 20000
}
}{
"success": false,
"error": "Rate limit exceeded",
"retryAfter": 1000
}Code Examples
Integration examples in popular languages
import axios from 'axios';
const client = axios.create({
baseURL: 'https://merchant.synapse.network',
headers: {
'Authorization': 'Bearer mt_live_48a8b3c9d1e2f3g4h5i6j7k8l9m0n1o2'
}
});
// Make RPC call
const { data } = await client.post('/api/ai/rpc', {
method: 'getAccountInfo',
params: ['YourPublicKey...']
});
console.log('Result:', data.result);
console.log('Remaining:', data.remaining);import requests
client = requests.Session()
client.headers.update({
'Authorization': 'Bearer mt_live_48a8b3c9d1e2f3g4h5i6j7k8l9m0n1o2'
})
# Make RPC call
response = client.post(
'https://merchant.synapse.network/api/ai/rpc',
json={
'method': 'getAccountInfo',
'params': ['YourPublicKey...']
}
)
data = response.json()
print('Result:', data['result'])
print('Remaining:', data['remaining'])Need Help?
For technical support, questions, or feedback:
