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 on Fin staging before moving to production.


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.
❗️

Always confirm the final payment status using the Payment Status API or a webhook. Never rely on successUrl 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.
Environment separationUse separate webhook URLs or paths for Fin staging and production.

Conceptual Webhook Flow

sequenceDiagram
    participant Gateway as DigetPay Gateway
    participant Webhook as Merchant Webhook Endpoint
    participant Server as Merchant Backend
    participant Database as Merchant Database

    Gateway-->>Webhook: Send transaction event
    Webhook->>Webhook: Validate request and parse payload
    Webhook-->>Gateway: HTTP 200 acknowledgment
    Webhook->>Server: Process event asynchronously
    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

    Example:

    https://yourstore.com/webhooks/digetpay

  2. Implement the webhook handler

    Review Handle Webhooks and the PHP examples in Hosted Checkout.

  3. Register the webhook in the dashboard

    Open Settings → Webhooks and add the endpoint.

    For Fin staging, use the staging dashboard:

    https://fin-admin.digetpay.com

  4. Test the endpoint on Fin staging

    Complete a test payment and verify that:

    • The webhook request reaches your server.
    • Your endpoint returns HTTP 200.
    • The transaction and order status are updated correctly.
    • Duplicate deliveries do not create duplicate orders, refunds, or other side effects.
  5. Configure production

    After successful staging validation, register the production webhook URL and test it with production credentials according to your go-live process.


Full Guides


Staging vs Production

EnvironmentRecommended Configuration
Fin stagingUse staging API keys, staging webhook URLs, and test transactions only.
ProductionUse production API keys, production webhook URLs, and live transaction processing.

Keep staging and production configurations 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 environment.
  • The endpoint is configured under the correct merchant account.

Important

A webhook is an asynchronous notification and should be processed safely. For critical order fulfillment, refunds, or other financial actions, follow the documented transaction verification process and use the Payment Status API when additional confirmation is required.


Did this page help you?