Tipalti.IPN.Router (tipalti v0.10.0) View Source

A router builder for handling incoming Tipalti Instant Payment Notifications (IPN).

Usage

defmodule MyApp.Tipalti.IPNRouter do
  use Tipalti.IPN.Router, scope: "/events"

  on "bill_updated", MyApp.Tipalti.OnBillUpdated
end

Link to this section Summary

Functions

Adds a listening route for incoming POST events.

Link to this section Functions

Link to this macro

on(event, module)

View Source (macro)

Adds a listening route for incoming POST events.

The route is built from the :scope option given to the router, and the event name.

Example

defmodule MyApp.Tipalti.IPNRouter do
  use Tipalti.IPN.Router, scope: "/events"

  on "bill_updated", MyApp.Tipalti.OnBillUpdated
end

The above would create a new route responding to POST requests at /events/bill_updated. The module given must define a call event that receives the event as a map of string key value pairs, and return :ok to signal it successfully processed the event.