Webhook Setup Primer
Minimum webhook configuration before integration testing.
Webhooks notify your server when payments succeed, fail, or are refunded. Configure them early in technical onboarding so you can validate the complete payment flow in Test Mode before switching to Live Mode.
Why Webhooks Matter
| Approach | Limitation |
|---|---|
Redirect to successUrl only | The customer may close the browser before the redirect. A redirect is not proof of payment. |
| Polling the status API | Works, but may be slower and can miss asynchronous updates between polling requests. |
| Webhooks | Provide server-to-server notifications when supported transaction events occur. |
A webhook is a notification, not proof of payment. Always confirm the final payment status with the Payment Status API before fulfilling an order. Never rely on
successUrlor a webhook payload alone.
Minimum Requirements
| Requirement | Detail |
|---|---|
| HTTPS URL | Use a publicly reachable HTTPS endpoint with a valid TLS certificate. |
| POST handler | Accept incoming POST requests with an application/json body. |
| Idempotency | The same event may be delivered more than once. Handle duplicate events safely and deduplicate using a suitable transaction or event identifier. |
| Fast response | Return an HTTP 200 response within 5 seconds whenever possible. Process intensive tasks asynchronously. |
| Logging | Log the received event, transaction reference, processing result, and any errors for troubleshooting. |
| Mode separation | Use separate webhook URLs or paths for Test Mode and Live Mode. |
Conceptual Webhook Flow
sequenceDiagram
participant Gateway as DigetPay Gateway
participant Webhook as Merchant Webhook Endpoint
participant Server as Merchant Backend
participant API as DigetPay Status API
participant Database as Merchant Database
Gateway-->>Webhook: Send transaction event (notification)
Webhook->>Webhook: Parse payload
Webhook-->>Gateway: HTTP 200 acknowledgment
Webhook->>Server: Process event asynchronously
Server->>API: Verify transaction status
API-->>Server: Final transaction status
Server->>Database: Update transaction/order status
Server->>Database: Ignore duplicate event if already processed
The diagram shows the recommended processing pattern. The exact event fields and status values depend on the webhook payload documented in the webhook event guide.
Setup Steps
-
Choose a webhook URL for each mode
Use a separate URL (or path) for Test Mode and for Live Mode.
Examples:
https://yourstore.com/webhooks/digetpay-testhttps://yourstore.com/webhooks/digetpay -
Implement the webhook handler
Review Handle Webhooks and the examples in Hosted Checkout.
-
Register the Test webhook in the Merchant Dashboard
Sign in to the Merchant Dashboard at pay.digetpay.com, open Settings → Webhooks, and add your endpoint in the Test Webhook Configuration.
-
Test the endpoint in Test Mode
Complete a test payment with your Test API Key and a Test Card, then verify that:
- The webhook request reaches your server.
- Your endpoint returns HTTP
200. - Your server confirms the payment with the Status API, and the transaction and order status are updated correctly.
- Duplicate deliveries do not create duplicate orders, refunds, or other side effects.
-
Configure Live Mode
After successful Test Mode validation, register your Live webhook URL in the Live Webhook Configuration in the same dashboard and test it according to your go-live process.
Full Guides
Register and manage Test and Live webhook endpoints through the Dashboard and Portal API.
Review how to treat and verify webhook notifications.
Review payload fields, transaction references, and status mapping.
Implement the server-side webhook receiver and process incoming events.
Test Mode vs Live Mode
Both modes use the same Merchant Dashboard. Webhook settings are configured separately for each mode.
| Mode | Recommended Configuration |
|---|---|
| Test Mode | Use your Test API Key, your Test webhook URL, and test transactions only. |
| Live Mode | Use your Live API Key, your Live webhook URL, and live transaction processing. |
Keep Test and Live webhook URLs separate to prevent test events from updating live orders or records.
Troubleshooting Checklist
If your webhook is not received or processed correctly, verify the following:
- The URL is publicly reachable from the internet.
- The endpoint uses HTTPS and has a valid TLS certificate.
- The server accepts
POSTrequests. - The endpoint accepts
application/json. - The request is not blocked by a firewall, WAF, or IP restriction.
- The endpoint returns HTTP
200within the expected response time. - The transaction reference is logged correctly.
- Duplicate events are handled safely.
- The webhook is registered in the correct mode configuration (Test or Live) and matches the API key you used for the payment.
- The endpoint is configured under the correct merchant account.
Important
A webhook is an asynchronous notification and should be processed safely. Treat it as a signal that a transaction changed, and confirm the result with the Payment Status API before fulfilling orders, issuing refunds, or taking other financial actions.
Updated about 2 months ago

