Skip to main content
The OwnPay engine is built upon a fully decoupled, event-driven architecture orchestrated by the OwnPay\Event\EventManager service. Action and Filter hooks allow developers to alter core system pathways without introducing hardcoded overrides inside core files.

Architectural invariants

  1. Strict Error Isolation: Every action callback is wrapped within a standalone try-catch. A plugin failure will never crash a critical transaction flow.
  2. HTML Output Trust Contract: Template-level hook points render whatever the hook callbacks emit as trusted HTML. The core hook() renderer strips dangerous elements as defense-in-depth.
  3. Deterministic Priority Chains: Hooks execute in ascending numerical priority. Lower number = runs earlier.
  4. Execution Context Identification: The EventManager maintains an internal execution context stack (ownerStack).
  5. Scoped Execution Filters: Filter hooks respect active merchant_id scopes.

System lifecycle hooks

Action hooks

Filter hooks

Payment engine hooks

Action hooks

Filter hooks

Checkout and theme hooks

Action hooks

Filter hooks

Communication hooks

Domain hooks

Auto-updater hooks

Guidelines and constraints

  • Register hooks in register() only
  • Never modify $this state in a filter
  • Use BCMath for all financial values
  • Do not post to the ledger from hooks
  • Escape all echoed HTML
  • No eval() or OS commands
  • Respect filter return type
  • Hooks fire only when plugin is active
Last modified on July 15, 2026