Stay informed about transaction status changes in real-time with our webhook system. Webhooks enable your application to receive instant notifications when transactions are processed, updated, or completed on our platform.
Overview
Webhooks are HTTP POST requests automatically sent to your specified endpoint URL when transaction events occur. This eliminates the need for constant polling and ensures your application stays synchronized with the latest transaction statuses.
Key Benefits:
- Real-time transaction updates
- Reduced API calls and improved efficiency
- Immediate notification of status changes
- Reliable event delivery with retry logic
Supported Events
We send webhooks for the following transaction events:
OnchainTransaction Events
Triggered when blockchain transactions change status:
- Deposits - Incoming asset deposits to user wallets
- Withdrawals - Outgoing asset withdrawals from user wallets
- Status Updates - Transaction confirmations, failures, or other state changes
InternalTransaction Events
Triggered when internal platform transfers occur:
- Wallet-to-Wallet Off- chain Transfers - Instant transfers off-chain on Knova ledger free of network fees
- Status Changes - Transfer completions, failures, or processing updates
Webhook Payload
Every webhook request contains a WebhookNotification object with the following structure:
{
"id": "webhook_abc123",
"event_type": "OnchainTransaction",
"payload": {
"OnchainTransaction": {
"id": "txn_def456",
"user_id": "user_789",
"asset_code": "USDC_ETH",
"tx_hash": "0x1234567890abcdef...",
"amount": "0.001",
"status": "Confirmed",
"created": "2023-06-15T10:30:00Z",
"updated": "2023-06-15T10:35:00Z"
}
},
"created": "2023-06-15T10:35:00Z"
}Implementation Guide
1. Configure Webhook Endpoint
Set up an HTTPS endpoint that can receive POST requests. Your endpoint should:
- Accept JSON payloads
- Respond with HTTP 200-299 status codes
- Process requests within 30 seconds
2. Handle Webhook Events
Parse the incoming webhook and process based on event_type:
app.post('/webhooks', (req, res) => {
const webhook = req.body;
switch (webhook.event_type) {
case 'OnchainTransaction':
handleOnchainTransaction(webhook.payload.OnchainTransaction);
break;
case 'InternalTransaction':
handleInternalTransaction(webhook.payload.InternalTransaction);
break;
}
res.status(200).send('OK');
});3. Process Transaction Updates
Update your application state based on the transaction status:
function handleOnchainTransaction(transaction) {
const { id, user_id, status, amount, asset_code } = transaction;
if (status === 'Confirmed') {
// Credit user account, send confirmation email
creditUserAccount(user_id, amount, asset_code);
sendConfirmationEmail(user_id, transaction);
} else if (status === 'Failed') {
// Handle failed transaction, notify user
handleFailedTransaction(user_id, transaction);
}
}Security & Best Practices
Webhook Security
Verify Webhook Authenticity
- Validate webhook signatures (Implementation details provided in integration docs)
- Only accept webhooks from known IP ranges
- Use HTTPS endpoints exclusively
Handle Duplicates
- Use the
idfield to detect and ignore duplicate webhooks - Implement idempotent processing logic
Error Handling
- Return appropriate HTTP status codes
- Log webhook processing errors for debugging
- Implement graceful failure handling
Reliability & Delivery
Delivery Guarantees
- Webhooks are delivered at least once
- Failed deliveries are retried with exponential backoff
- Maximum retry attempts: 5 over 24 hours
Monitoring
- Monitor webhook endpoint availability
- Set up alerts for processing failures
- Track webhook delivery success rates
Timeout Handling
- Respond within 30 seconds to avoid timeouts
- Queue heavy processing for background jobs
- Return 200 status immediately after validation
Common Use Cases
Account Reconciliation
Update user account balances immediately when deposits are confirmed or withdrawals are processed.
User Notifications
Send push notifications, emails, or SMS alerts when transaction statuses change.
Compliance Reporting
Generate real-time compliance reports and audit trails based on transaction events.
Risk Management
Trigger risk assessments or fraud detection workflows when suspicious transactions occur.
Testing Webhooks
Use our sandbox environment to test webhook integration:
- Configure Test Endpoint - Set up a webhook URL in sandbox mode
- Generate Test Transactions - Create test deposits/withdrawals to trigger webhooks
- Verify Payload Processing - Ensure your application handles all event types correctly
- Test Error Scenarios - Simulate failures to verify error handling
Next Steps
Ready to implement webhooks?
- Set up your webhook endpoint URL
- Configure webhook settings in your dashboard
- Test with sandbox transactions
- Go live and monitor webhook delivery
For technical support or questions about webhook implementation, contact our developer support team.
