Testing Guide
This guide covers how to test your TxnCheck API integration effectively before deploying to production.Test Environment
TxnCheck provides a test environment for development and testing. Contact your account manager to obtain test API credentials.
Test vs Production
| Aspect | Test | Production |
|---|---|---|
| API Endpoint | Same (api.txncheck.in) | Same |
| API Keys | Test keys provided | Production keys |
| Data | Simulated responses | Real verification data |
| Billing | No charges | Per-request billing |
| Webhooks | Delivered normally | Delivered normally |
Integration Checklist
Before going live, verify your integration handles these scenarios:API Authentication
API Authentication
- API key is stored securely (environment variables)
- Requests include
X-API-Keyheader - Request signing works (if enabled)
- Handle
401 Unauthorizederrors gracefully
Request Submission
Request Submission
- Submit UPI by Mobile requests successfully
- Submit KYC by Mobile requests successfully
- Submit VPA Chargeback Check requests successfully
- Submit Full Check requests successfully
- Handle validation errors (400 Bad Request)
- Store request IDs for tracking
Result Retrieval
Result Retrieval
- Poll request status correctly
- Handle all status types (QUEUED, PROCESSING, COMPLETED, FAILED, PARTIAL)
- Parse result data correctly
- Handle error responses
Webhooks
Webhooks
- Webhook endpoint is HTTPS and publicly accessible
- Verify webhook signatures
- Handle
request.completedevents - Handle
request.failedevents - Handle
request.partialevents - Process events idempotently (handle duplicates)
- Return 2xx response quickly
Error Handling
Error Handling
- Handle network timeouts gracefully
- Implement retry logic with backoff
- Handle rate limit errors (429)
- Handle insufficient balance errors (402)
- Log errors for debugging
Testing Request Flow
1. Submit a Verification Request
2. Poll for Results
3. Verify Webhook Receipt
Check that your webhook endpoint received the notification:Testing Error Scenarios
Invalid Mobile Number
Invalid API Key
Method Not Allowed
Testing Webhooks Locally
Using ngrok
- Install ngrok:
npm install -g ngrok - Start your local server on port 3000
- Create a tunnel:
ngrok http 3000 - Use the ngrok URL as your webhook endpoint
Using Webhook.site
For quick testing, use webhook.site:- Visit webhook.site and copy your unique URL
- Configure this URL as your webhook endpoint (contact support)
- Submit a verification request
- View the webhook payload on webhook.site
Polling Best Practices
When polling for results, implement exponential backoff:Going Live
1
Complete Testing
Ensure all checklist items pass in test mode
2
Request Production Keys
Contact your account manager to request production API credentials
3
Update Configuration
Replace test API key with production key in your production environment
4
Verify Webhook URL
Ensure your webhook endpoint points to your production server
5
Top Up Balance
Ensure your merchant account has sufficient balance for API calls
6
Monitor
Watch the dashboard for your first live verifications
Common Testing Mistakes
Hardcoding API Keys
Always use environment variables for API credentials
Skipping Webhook Verification
Always verify signatures, even in test mode
Not Testing Errors
Test error scenarios, not just happy paths
Ignoring Timeouts
Implement proper timeout handling and retries
Need Help?
Developer Support
Contact our support team if you have questions about testing
