Muin is in private beta.Watch the public release announcement —talk to us.
Falaah Falaah AI

Payment Webhooks

Receive real-time notifications when payments are created, completed, refunded, or fail. Configure webhook endpoints and verify event signatures.

Muin sends webhook events to your server when payment-related events occur. Use webhooks to trigger fulfillment, update your own systems, or sync records in real time.

Setting Up a Webhook

  1. Go to Settings → Integrations → Webhooks
  2. Click Add Endpoint
  3. Enter your endpoint URL (must be publicly accessible HTTPS)
  4. Select the event types you want to receive
  5. Click Save — Muin immediately sends a test ping to verify the endpoint is reachable

Payment Event Types

EventFires when
payment.createdA new payment record is created
payment.completedPayment is fully settled
payment.failedPayment attempt fails (card declined, insufficient funds, etc.)
payment.refundedA full or partial refund is issued
payment.disputedA chargeback or dispute is opened
payment_page.viewedA payment page receives a visit
donation.receivedA new donation is processed
pledge.fulfilledA pledge payment completes
subscription.createdA recurring subscription is set up
subscription.renewedA recurring billing cycle succeeds
subscription.cancelledA subscription is cancelled
subscription.payment_failedA recurring billing cycle fails

Webhook Payload

Each event is delivered as an HTTPS POST with a JSON body:

{
  "event": "payment.completed",
  "id": "evt_01HXK2...",
  "created_at": "2026-06-08T14:23:11Z",
  "tenant_id": "ten_01HXK...",
  "data": {
    "payment_id": "pay_01HXK...",
    "amount_cents": 5000,
    "currency": "USD",
    "method": "card",
    "status": "completed",
    "contact_id": "con_01HXK...",
    "invoice_id": "inv_01HXK...",
    "metadata": {}
  }
}

Verifying Webhook Signatures

Every webhook delivery includes a Muin-Signature header. Verify it to confirm the request came from Muin and hasn’t been tampered with:

  1. Get your endpoint’s Signing Secret from Settings → Integrations → Webhooks → [your endpoint] → Signing Secret
  2. Compute HMAC-SHA256(raw_body, signing_secret)
  3. Compare to the value in Muin-Signature header

Python example:

import hmac, hashlib

def verify(payload_bytes, signature_header, secret):
    expected = hmac.new(secret.encode(), payload_bytes, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature_header)

Reject any delivery where verification fails.


Retries

If your endpoint returns a non-2xx response (or times out after 10 seconds), Muin retries delivery:

AttemptDelay
1Immediate
25 minutes
330 minutes
42 hours
56 hours

After 5 failed attempts, the delivery is marked Failed in the webhook log. Failed events can be manually replayed from the endpoint detail view.


Webhook Logs

Every delivery attempt is logged in Settings → Integrations → Webhooks → [endpoint] → Logs:

  • Request payload
  • Response status and body
  • Delivery timestamp
  • Success / failure status

Use the log to debug integrations without waiting for events to recur.


Next Steps