Skip to main content

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

Integration Checklist

Before going live, verify your integration handles these scenarios:
  • API key is stored securely (environment variables)
  • Requests include X-API-Key header
  • Request signing works (if enabled)
  • Handle 401 Unauthorized errors gracefully
  • 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
  • Poll request status correctly
  • Handle all status types (QUEUED, PROCESSING, COMPLETED, FAILED, PARTIAL)
  • Parse result data correctly
  • Handle error responses
  • Webhook endpoint is HTTPS and publicly accessible
  • Verify webhook signatures
  • Handle request.completed events
  • Handle request.failed events
  • Handle request.partial events
  • Process events idempotently (handle duplicates)
  • Return 2xx response quickly
  • 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

Expected response:

2. Poll for Results

Expected response (processing):
Expected response (completed):

3. Verify Webhook Receipt

Check that your webhook endpoint received the notification:

Testing Error Scenarios

Invalid Mobile Number

Expected error:

Invalid API Key

Expected error:

Method Not Allowed

Expected error (if method not enabled):

Testing Webhooks Locally

Using ngrok

  1. Install ngrok: npm install -g ngrok
  2. Start your local server on port 3000
  3. Create a tunnel: ngrok http 3000
  4. Use the ngrok URL as your webhook endpoint

Using Webhook.site

For quick testing, use webhook.site:
  1. Visit webhook.site and copy your unique URL
  2. Configure this URL as your webhook endpoint (contact support)
  3. Submit a verification request
  4. 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
Never use production API keys in development or testing environments. Always keep test and production credentials separate.

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