Simulate Webhook
Test your webhook integration by triggering simulated transaction notifications in sandbox
Overview
The Simulate Webhook endpoint allows you to test your webhook integration without creating real QR codes or processing actual transactions. It sends encrypted webhook notifications to your registered endpoint, just like real transaction webhooks.Endpoint
Authentication
This endpoint requires HTTP Basic Authentication using your Secret Key.Request
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Basic {base64(secret_key:)} | Yes |
Content-Type | application/json | Yes |
Body Parameters (Encrypted Payload)
Token field. See the Encryption Guide for details on creating JWE tokens.| Field | Type | Required | Description |
|---|---|---|---|
qrBody | string | Yes | Raw QRPH payload used to simulate a transaction |
useCase | string | Yes | Transaction event type: SUCCESS, MISSING_DESTINATION_ACCOUNT, MISSING_PARTNER_REVENUE_ACCOUNT, or UNSUPPORTED_TRANSFER_TYPE |
qrBody
qrBody
- Example:
"00020101021228820011ph.ppmi.p2m0111CUOBPHM2XXX03258eff02de-e172-4b0d-bc5b-3041288500100000705033015204601653036085406100.005802PH5912MAIN ACCOUNT6006MANILA630412C0"
useCase
useCase
SUCCESS- Simulates a successful paymentMISSING_DESTINATION_ACCOUNT- Simulates a declined payment (missing destination account)MISSING_PARTNER_REVENUE_ACCOUNT- Simulates a declined payment (missing partner revenue account)UNSUPPORTED_TRANSFER_TYPE- Simulates a declined payment (unsupported transfer type)
"SUCCESS"Example Payloads (Before Encryption)
Response
Success Response
Status Code:200 OK
Returns confirmation that the simulated webhook was sent to your registered endpoint.
id returned from the Create Dynamic QR Ph response).Example: "a78efd32-de3b-4854-b599-11ae9f98f97e"Response Example
Error Responses
400 Bad Request
400 Bad Request
400Causes:- Missing
useCasefield - Invalid
useCasevalue
- Ensure
useCaseis one of:SUCCESS,MISSING_DESTINATION_ACCOUNT,MISSING_PARTNER_REVENUE_ACCOUNT, orUNSUPPORTED_TRANSFER_TYPE - Check spelling and capitalization
401 Unauthorized
401 Unauthorized
404 Not Found
404 Not Found
404Cause: No enabled webhooks configuredResponse Example:- Create at least one webhook using Create Webhook API
- Ensure webhook status is
ENABLED - Verify webhook actions include the simulated event type
500 Internal Server Error
500 Internal Server Error
500Cause: Unexpected server errorSolution:- Retry the request
- If the issue persists, contact Modulus Labs support
Testing Workflow
Simulate Success Event
Simulate Declined Event
Test Error Scenarios
- Return 5xx status to trigger retries
- Delay response beyond 10 seconds to test timeouts
- Verify idempotency by sending duplicate webhooks
Use Cases
Initial Integration Testing
Initial Integration Testing
CI/CD Automated Testing
CI/CD Automated Testing
Verify Decryption Implementation
Verify Decryption Implementation
Test Error Handling
Test Error Handling
Demo and Presentations
Demo and Presentations
Testing Checklist
Setup
- Webhook endpoint is accessible
- Webhook is registered and enabled
- Webhook actions include
QRPH_SUCCESSandQRPH_DECLINED
Test Successful Payment
- Simulate SUCCESS webhook
- Webhook received at endpoint
- JWE payload decrypted successfully
- Order marked as paid
- Confirmation email sent
Test Declined Payment
- Simulate declined webhook (e.g.,
MISSING_DESTINATION_ACCOUNT) - Webhook received at endpoint
- Decline reason parsed correctly
- Order marked as failed
- Customer notified
Test Error Handling
- Duplicate webhooks ignored (idempotency)
- Invalid webhooks rejected
- Timeout scenarios handled
- Retry mechanism tested
Best Practices
Test Both Scenarios
Use in CI/CD
Monitor Test Results
Test with Delays
Differences from Real Webhooks
| Aspect | Simulate API | Real Webhooks |
|---|---|---|
| Trigger | Manual API call | Actual QR Ph transaction |
| Reference Number | SIM-REF-* prefix | Real reference from QR creation |
| Transaction Data | Test data | Real customer payment data |
| Timing | Immediate | Depends on payment processing |
| Retries | Same as real | Up to 4 attempts (0, 15, 30, 45 min) |
| Encryption | JWE encrypted | JWE encrypted |
| Availability | Sandbox only | Sandbox and production |
Troubleshooting
404: No Enabled Webhooks Found
404: No Enabled Webhooks Found
- No webhooks registered
- All webhooks are disabled
- Webhook actions don’t include the simulated event
Webhook Not Received
Webhook Not Received
- Webhook URL not accessible
- Firewall blocking requests
- Endpoint not listening
- Test webhook URL accessibility externally
- Check server logs for incoming requests
- Verify endpoint is running and listening
- Test with ngrok or similar during development
Decryption Fails
Decryption Fails
- Wrong secret key
- JWE library issue
- Incorrect algorithm configuration
Multiple Webhooks Sent
Multiple Webhooks Sent
Next Steps
Create Webhook
Receiving Webhooks
Payload Structure
Setup Guide
Authorizations
HTTP Basic Authentication using your Secret Key as the username and an empty password
Body
Response
Webhook simulation sent successfully
The unique identifier of the original transaction (i.e., the id returned from the Create Dynamic QR Ph response).