# `MishkaPay.Ash.Customer.Listener`
[🔗](https://github.com/mishka-group/mishka_pay/blob/v0.0.1/lib/mishka_pay/ash/__customer/listener.ex#L6)

Makes a module the `mishka_pay:event:process` listener that syncs the customer an event is
about (`customer.created`, `customer.updated`, `customer.deleted` on Stripe, the
`setup_intent.*` and `payment_method.*` events of the customer's saved cards, and
`customer.tax_id.*` for one of its tax ids) into a customer resource (the `:customer` kind of
`MishkaPay.Ash.Resource`):

    defmodule MyApp.Pay.CustomerSync do
      use MishkaPay.Ash.Customer.Listener, resource: MyApp.Pay.Customer
    end

`MishkaPay.Ash.Resource` makes one for each resource that listens (`listen? true`), as
`<Resource>.MishkaPayListener`; write one by hand with `listen? false`, such as to give it
another `:priority`. Supervise it like any plugin. An event about anything else is left
alone; a customer the provider cannot give fails the event, so the inbox tries it again
later. At Stripe a customer made on Accounts v2 sends the same account events as a seller's
account (`v2.core.account.updated`, `.closed`, `[identity].updated`), each naming the
account as its customer: an account the read finds is no customer (`resource_missing`) is
left alone, and its event is done.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
