Webhooks — Java

Receive and process DigetPay payment notifications in Java.

DigetPay sends HTTP POST notifications to your configured webhook URL when payment events occur. This stub shows the minimum Java handler pattern.

Full guide: Handle Webhooks. Configure URLs via Webhook Configuration.

DigetPay may deliver the same event more than once. Always deduplicate by transactionId + type.

Critical: Return 200 OK within a few seconds. Slow handlers cause retries and duplicate processing.


Flow

sequenceDiagram
  participant DigetPay as DigetPay
  participant Shop as Your Java Server

  DigetPay->>Shop: POST JSON payload
  Shop-->>DigetPay: 200 OK
  Note over Shop: Process async — mark order paid

Handler stub

Spring Boot example:

@RestController
@RequestMapping("/webhooks")
public class DigetPayWebhookController {

    @PostMapping("/digetpay")
    public ResponseEntity<String> handleWebhook(@RequestBody Map<String, Object> payload) {
        String transactionId = (String) payload.get("transactionId");
        String orderId = (String) payload.get("orderId");
        String status = (String) payload.get("status");
        String type = (String) payload.get("type");
        // TODO: Idempotent update — skip if already processed
        return ResponseEntity.ok("OK");
    }
}

Example payload

{
  "transactionId": "2232e99b-0257-47d5-bbfd-022c8951767f",
  "orderId": "PAY-1781872369616",
  "amount": 0.2,
  "currencyCode": "682",
  "status": "Approved",
  "type": "Sale",
  "cardScheme": "Mada",
  "channel": "Payment Gateway"
}

See Webhook Events and Webhook Security for signature verification.


Next steps


Did this page help you?