Webhook
Swapper Finance Deposits Webhook
Swapper Finance Deposits provides real-time webhook notifications to keep your application informed about completed deposit transactions.
Quick Start
1. Add Webhook URL
Include the webhookUrl parameter when integrating Swapper Finance Deposits:
import { SwapperIframe } from '@swapper-finance/deposit-sdk';
const swapper = new SwapperIframe({
container: '#swapper-container',
integratorId: 'your-integrator-id',
dstChainId: '8453',
dstTokenAddr: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
depositWalletAddress: '0x2A018F2506acaEEE2C10632514Fc5DCa9eE2c28A',
webhookUrl: "https://domain/com/api/webhook" // <--- here
});2. Handle Notifications
Create an endpoint to receive webhook notifications:
app.post('/webhooks/deposit', (req, res) => {
const { eventId, eventType, data } = req.body;
if (eventType === 'transaction.completed') {
console.log('Swap completed:', data.txHash);
// Update your database, notify users, etc.
}
res.json({ received: true });
});3. Requirements
HTTPS endpoint
Public accessibility from the internet
Fast response - Return HTTP 200 within 10 seconds
Event Payload
Webhooks are sent as POST requests with JSON payloads:
Field Descriptions
eventId
string
Unique identifier for idempotency
eventType
string
Event type (transaction.completed)
timestamp
string
ISO 8601 timestamp of the event
data.jobId
string
Delegation job identifier
data.executionId
string
Specific execution identifier
data.smartWalletAddress
string
Smart wallet that executed the transaction
data.chainId
string
Source blockchain ID
data.txHash
string
Transaction hash on the blockchain
data.tokenAddress
string
Token contract address that was swapped
data.amount
string
Amount swapped (in smallest unit)
data.destinationChainId
string
Destination blockchain ID
data.destinationAddress
string
Where funds are being sent
data.targetToken
string
Target token on destination chain
data.integratorId
string
Your integrator identifier
Webhook Signature Verification
All webhook requests include an X-Webhook-Signature header for security verification. This header contains an HMAC-SHA256 signature of the request payload using your integrator's secret key.
How to Verify Signatures
Getting Your Secret Key
Contact Swapper support to receive your webhook secret key. This key should be:
Stored securely (never in version control)
Used only for webhook signature verification
Rotated periodically for security
Signature Details
Algorithm: HMAC-SHA256
Encoding: Base64
Header:
X-Webhook-SignaturePayload: Raw JSON string of the request body
Troubleshooting
Common Issues
Not receiving webhooks
Verify endpoint is publicly accessible and returns 200
Duplicate events
Check eventId for idempotency
Slow responses
Ensure 200 response within 10 seconds
SSL certificate errors
Use valid HTTPS certificates
Invalid signatures
Verify secret key and signature calculation
Missing signature header
Contact support if X-Webhook-Signature header is absent
Support
If you encounter issues:
Check this documentation
Review your implementation against the examples
Contact support with:
Your
integratorIdExample
eventId(if applicable)Recent log entries
Your webhook endpoint URL
Signature verification issues (include received signature and payload)
Last updated