Skip to main content

H2H Notifications

Host-to-Host API provides real-time payment status notifications through webhooks, enabling automatic updates when payment statuses change. This guide covers webhook setup, handling, and security best practices.

Webhook Overview

Notification System

  • Real-time Updates: Automatic payment status notifications via webhooks
  • HTTP POST: Notifications sent as HTTP POST requests
  • Content Type: application/x-www-form-urlencoded
  • Requirement: Notifications only sent if notify URL is configured

Configuration

  • Dashboard Setup: Set notify URL in dashboard profile page
  • Per-Request Override: Override notify URL in individual payment requests
  • Multiple Endpoints: Configure different URLs for different notification types

Notification Fields

Example Notification

Webhook Handler Implementation

Basic Webhook Handler

Advanced Webhook Handler

Notification Verification

Signature Verification

Verify notification authenticity using HMAC SHA512 signature:

Verification Process

  1. Header Check: Check X-Signature header in notification request
  2. Algorithm: HMAC SHA512 hash in Base64 format
  3. Key: Use your API key from the control panel

Status Processing

Payment Status Mapping

Business Logic Processing

Error Handling

Duplicate Prevention

Retry Logic

Security Best Practices

Webhook Security

  1. Signature Verification: Always verify webhook signatures
  2. HTTPS Only: Use HTTPS endpoints for webhook URLs
  3. IP Whitelisting: Restrict webhook sources to known IPs
  4. Rate Limiting: Implement rate limiting on webhook endpoints

Data Protection

  1. Sensitive Data: Never log sensitive payment information
  2. PCI Compliance: Follow PCI DSS guidelines for payment data
  3. Access Control: Restrict access to webhook processing systems
  4. Audit Logging: Maintain audit logs of all webhook processing

Error Handling

  1. Graceful Failures: Handle errors gracefully without exposing system details
  2. Monitoring: Monitor webhook processing success rates
  3. Alerting: Set up alerts for webhook processing failures
  4. Backup Processing: Implement backup processing for failed webhooks

Testing and Validation

Webhook Testing

Best Practices

Implementation

  1. Idempotency: Handle duplicate notifications gracefully
  2. Fast Response: Respond quickly to webhook requests (< 30 seconds)
  3. Async Processing: Process notifications asynchronously when possible
  4. Status Codes: Return appropriate HTTP status codes

Monitoring

  1. Success Rates: Monitor webhook processing success rates
  2. Response Times: Track webhook processing response times
  3. Error Patterns: Analyze error patterns and common failures
  4. Alert Thresholds: Set up appropriate alerting thresholds

Reliability

  1. Retry Mechanisms: Implement retry logic for failed processing
  2. Dead Letter Queue: Use dead letter queues for failed notifications
  3. Backup Processing: Implement backup processing mechanisms
  4. Health Checks: Regular health checks on webhook endpoints

Next Steps

Request Structure

Learn about H2H API request format and parameters

Response Structure

Understand H2H API response handling

Payment Methods

Explore available payment methods and implementations