AirtelMoney.WebhookPlug (airtel_money v0.1.1)

Copy Markdown View Source

Plug for handling Airtel Money webhooks in Phoenix applications.

Usage

Add to your router:

pipeline :webhooks do

plug AirtelMoney.WebhookPlug

end

scope "/webhooks" do

pipe_through :webhooks
post "/airtel", WebhookController, :handle

end

The plug will:

  1. Verify the webhook signature (if webhook_secret is configured)
  2. Parse the JSON payload
  3. Assign the parsed data to conn.assigns[:airtel_webhook]
  4. Call the next plug if verification succeeds or if authentication is disabled
  5. Return 401 if verification fails (when authentication is enabled)

Options

  • :require_auth - Set to false to skip signature verification (default: true)