Webhooks — Python
Receive and process DigetPay payment notifications in Python.
DigetPay sends HTTP POST notifications to your configured webhook URL when payment events occur. This stub shows the minimum Python 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 OKwithin a few seconds. Slow handlers cause retries and duplicate processing.
Flow
sequenceDiagram participant DigetPay as DigetPay participant Shop as Your Python Server DigetPay->>Shop: POST JSON payload Shop-->>DigetPay: 200 OK Note over Shop: Process async — mark order paid
Handler stub
Flask example:
# routes/webhooks.py
from flask import Blueprint, request
webhooks_bp = Blueprint("webhooks", __name__)
@webhooks_bp.route("/webhooks/digetpay", methods=["POST"])
def digetpay_webhook():
payload = request.get_json(force=True)
transaction_id = payload.get("transactionId")
order_id = payload.get("orderId")
status = payload.get("status")
event_type = payload.get("type")
# TODO: Idempotent update — skip if already processed
return "OK", 200Example 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
Updated about 1 month ago
Did this page help you?
