A provider's webhook message after its signature was checked, as MishkaPay.Webhook hands it
to the mishka_pay:webhook:received listeners. A guarded_struct the provider fills in.
:provider,:tenant: whose message, with whose keys it was checked.:id: the provider's event id (evt_...at Stripe). A provider may send one event more than once: a listener keeps what it did by this id.:type: the provider's own name for what happened, such as"checkout.session.completed".:object_id,:object_type: what it is about ("pi_...","payment_intent"); an entitlement summary has no id of its own.:payment_id: the payment it concerns, when it concerns one: the object itself for a payment, or the payment a checkout, charge, refund or dispute belongs to. The idMishkaPay.fetch_payment/3takes.:subscription_id: the subscription it concerns, when it concerns one: the object itself for a subscription, or the subscription an invoice belongs to. The idMishkaPay.fetch_subscription/3takes.:dispute_id: the dispute it concerns, for acharge.dispute.*event (MishkaPay.fetch_dispute/3).:customer_id: the customer it changes: the customer itself, or the one a tax id, a saved payment method, a setup or an entitlement summary belongs to (customer.*,customer.tax_id.*,payment_method.*,setup_intent.*,entitlements.active_entitlement_summary.updatedon Stripe). The idMishkaPay.fetch_customer/3takes.:livemode: whether it came from live or test mode.:account: the connected account it is for, when the provider has those.:created_at: when the provider made it.
Only the ids matter: a listener reads the object again from the provider
(MishkaPay.fetch_payment/3), which stays the source of truth, and never trusts the order
events arrive in.
Summary
Functions
A sample %MishkaPay.Event{} populated from defaults + type-based fallbacks.
Types
@type t() :: %MishkaPay.Event{ account: String.t() | nil, created_at: DateTime.t() | nil, customer_id: String.t() | nil, dispute_id: String.t() | nil, id: String.t(), livemode: boolean() | nil, object_id: String.t() | nil, object_type: String.t() | nil, payment_id: String.t() | nil, provider: String.t(), subscription_id: String.t() | nil, tenant: term() | nil, type: String.t() }
The struct that builder/1 returns.
| Field | Type | Required | Default | Description | Derives |
|---|---|---|---|---|---|
:provider | String.t() | yes | validate(not_nil_value, string) | ||
:tenant | term() | nil | no | |||
:id | String.t() | yes | validate(not_nil_value, string, not_empty) | ||
:type | String.t() | yes | validate(not_nil_value, string, not_empty) | ||
:object_id | String.t() | nil | no | validate(string) | ||
:object_type | String.t() | nil | no | validate(string) | ||
:payment_id | String.t() | nil | no | validate(string) | ||
:subscription_id | String.t() | nil | no | validate(string) | ||
:dispute_id | String.t() | nil | no | validate(string) | ||
:customer_id | String.t() | nil | no | validate(string) | ||
:livemode | boolean() | nil | no | false | validate(boolean) | |
:account | String.t() | nil | no | validate(string) | ||
:created_at | DateTime.t() | nil | no | validate(struct) |