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

ApproachLimitation
Redirect to successUrl onlyThe customer may close the browser before the redirect. A redirect is not proof of payment.
Polling the status APIWorks, but may be slower and can miss asynchronous updates between polling requests.
WebhooksProvide 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 successUrl or a webhook payload alone.


Minimum Requirements

RequirementDetail
HTTPS URLUse a publicly reachable HTTPS endpoint with a valid TLS certificate.
POST handlerAccept incoming POST requests with an application/json body.
IdempotencyThe same event may be delivered more than once. Handle duplicate events safely and deduplicate using a suitable transaction or event identifier.
Fast responseReturn an HTTP 200 response within 5 seconds whenever possible. Process intensive tasks asynchronously.
LoggingLog the received event, transaction reference, processing result, and any errors for troubleshooting.
Mode separationUse 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

  1. 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-test

    https://yourstore.com/webhooks/digetpay

  2. Implement the webhook handler

    Review Handle Webhooks and the examples in Hosted Checkout.

  3. 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.

  4. 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.
  5. 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


Test Mode vs Live Mode

Both modes use the same Merchant Dashboard. Webhook settings are configured separately for each mode.

ModeRecommended Configuration
Test ModeUse your Test API Key, your Test webhook URL, and test transactions only.
Live ModeUse 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 POST requests.
  • The endpoint accepts application/json.
  • The request is not blocked by a firewall, WAF, or IP restriction.
  • The endpoint returns HTTP 200 within 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.


Did this page help you?