Overview
Webhooks allow Modulus Labs to notify your application in real-time when QR Ph transactions are completed. Instead of repeatedly polling the API to check transaction status, webhooks push updates directly to your server the moment an event occurs.Setup Guide
API Reference
Receiving Webhooks
Payload Structure
API Endpoint
All Webhook API requests should be made to the sandbox environment:API Philosophy
The Webhooks API is designed for reliability and security:REST Architecture
JSON Format
HTTPS Only
HTTP Basic Auth
JWE Encryption
Automatic Retries
PCI DSS 4.1 Certified
How Webhooks Work
Configure Webhook Endpoint
Customer Completes Payment
Modulus Labs Sends Notification
Your Server Processes Webhook
Automatic Retries
Why Webhooks Are Required
Can I skip webhooks and just poll the API?
Can I skip webhooks and just poll the API?
- You won’t know when payments succeed or fail
- Customers may complete payment but never receive their order
- Your system cannot verify transaction authenticity
- You risk order fulfillment errors and revenue loss
Real-Time Order Fulfillment
Real-Time Order Fulfillment
Security and Fraud Prevention
Security and Fraud Prevention
Reliability with Automatic Retries
Reliability with Automatic Retries
- Immediately upon transaction completion
- After 15 minutes (retry 1)
- After 30 minutes (retry 2)
- After 45 minutes (retry 3)
Multi-Merchant Support
Multi-Merchant Support
activation-code header to identify which merchant account the webhook belongs to, enabling centralized webhook handling.Webhook Events
Modulus Labs sends webhooks for these QR Ph transaction events:Authentication
The Webhook API uses HTTP Basic Authentication, identical to the QR API.Use Your Secret Key
Format the Authorization Header
:) after your secret key before base64 encoding.Send with Every Request
Authentication Guide
Webhook Payload Security
All webhook payloads are encrypted using JWE (JSON Web Encryption) to protect sensitive transaction data.Encryption Details
- Content Encryption Algorithm:
A256CBC-HS512(AES-256-CBC with HMAC SHA-512) - Key Encryption Algorithm:
A256KW(AES-256 Key Wrap) - Format: JSON Web Encryption Compact Serialization
Payload Structure
Webhook Management
The Webhook API provides full CRUD (Create, Read, Update, Delete) operations for managing webhook endpoints.Create Webhook
List Webhooks
Update Webhook
Delete Webhook
Webhook Status
Each webhook can have one of two statuses:Testing Webhooks
The Webhook API includes a Simulate endpoint for testing your webhook integration in the sandbox environment without generating real transactions.Register Your Webhook
Call the Simulate API
Verify Your Handler
Test Error Scenarios
Simulate Webhook
Integration Checklist
Use this checklist to ensure your webhook integration is complete:Implement Webhook Endpoint
- Create POST endpoint that accepts webhook notifications
- Implement JWE decryption for webhook payloads
- Return
200 OKstatus code within 10 seconds - Handle webhook retries idempotently (same webhook may arrive multiple times)
Register Webhook with Modulus Labs
- Call Create Webhook API with your endpoint URL
- Specify which actions to receive (
QRPH_SUCCESS,QRPH_DECLINED, or both) - Verify webhook status is
ENABLED
Test in Sandbox
- Use Simulate API to send test webhooks
- Verify SUCCESS webhook handling
- Verify DECLINED webhook handling
- Test retry mechanism by returning 5xx errors
Security Validation
- Verify JWE signature to confirm webhook authenticity
- Decrypt payload using your secret key
- Validate referenceNumber matches your QR creation request
- Implement request signature verification (if required)
Error Handling
- Log all webhook receipts for debugging
- Implement retry logic for transient errors
- Alert monitoring systems for webhook failures
- Handle duplicate webhook deliveries gracefully
Use Cases
E-commerce Order Fulfillment
E-commerce Order Fulfillment
Point of Sale (POS)
Point of Sale (POS)
Digital Content Delivery
Digital Content Delivery
Best Practices
Idempotency
referenceNumber to prevent duplicate processing.Fast Response
200 OK quickly (within 10 seconds). Process webhooks asynchronously using background jobs to avoid timeouts.