Available Events

All events are dispatched via a PSR-14 compatible EventDispatcher. Each event class lives under OxidEsales\PaymentBase\EventSystem\Event\ and has a matching …Interface companion so listeners can bind against either the concrete class or the interface.

Contract lifecycle events

These events track the payment contract through its lifecycle (see Smart-Contract Lifecycle):

Event

When fired

Typical use case

ContractCreatedEvent

Customer initiates checkout, contract enters DRAFT.

Reserve inventory, write audit log.

ContractDraftCompletedEvent

All draft-phase setup is done; contract is about to transition.

Final validation hooks before the PSP is contacted.

ContractTransitionedToPendingEvent

Payment process started; contract enters PENDING.

Lock basket items, start session timers.

ContractConditionFulfilledEvent

A single condition (e.g. payment_authorized) was satisfied.

Per-condition side effects, observability metrics.

ContractReadyToCommitEvent

All conditions met; contract enters READY_TO_COMMIT.

Create the OXID order from the basket snapshot.

ContractCommittedEvent

Order created, contract carries OXORDERID.

Export order to ERP, notify downstream systems.

ContractFulfilledEvent

Payment captured; contract enters FULFILLED.

Trigger fulfillment / shipping.

ContractCancelledEvent

Contract cancelled before fulfillment.

Release inventory, refund any captured amount.

ContractExpiredEvent

OXEXPIRESAT reached without all conditions fulfilled.

Cleanup reservations, log abandonment.

ContractFailedEvent

A condition failed permanently (e.g. fraud rejected).

Notify the customer, alert the merchant.

Payment events

These events track payment-specific actions, independent of the contract state machine:

Event

When fired

Typical use case

PaymentInitiatedEvent

Customer starts the payment flow.

Analytics tracking, funnel measurement.

PaymentAuthorizedEvent

PSP confirms funds are reserved.

Fraud check, payment_authorized condition fulfillment.

PaymentCapturedEvent

Funds transferred to the merchant account.

Ship order, sync to ERP.

PaymentRefundedEvent

Refund processed by the PSP.

Update CRM, restore stock.

PaymentFailedEvent

Payment declined or errored.

Alert, retry logic, fail the contract.

OrderCreatedEvent

Shop order created from the contract.

Sync to external order management.

OrderCompletedEvent

Order finalized (delivered, invoice issued).

Send confirmation, close the loop.

WebhookReceivedEvent

Any webhook from a PSP arrived.

Generic webhook auditing.

EventContext data reference

The legacy EventContext array (used by the original payment-component EventHandlerInterface) exposes the following keys:

Key

Type

Available in

orderId

string

All order / payment events

contractId

string

All contract events

userId

string

All events

amount

float

Payment events

currency

string

Payment events

refundAmount

float

Refund events

basketItems

array

Contract events

failureReason

string

Failed events

eventId

string

Webhook-sourced events (used for idempotency)

Listeners bound through Symfony’s tagged-listener mechanism receive the typed event object instead. Use $event->getContract() / $event->getOrder() and the event-specific accessors documented on each class — they are stricter and don’t require array lookups.

Listener binding

Two ways to listen for events:

Tagged service (recommended for module developers):

services:
  YourCompany\Erp\OrderCreationListener:
    tags:
      - name: kernel.event_listener
        event: OxidEsales\PaymentBase\EventSystem\Event\Contract\ContractCommittedEvent
        method: onContractCommitted

Symfony’s EventDispatcher resolves listeners by the exact dispatched class name, not by interface walk. If you want to listen to an interface (e.g. ContractTerminatedEventInterface which is implemented by ContractCancelledEvent, ContractExpiredEvent and ContractFailedEvent), bind one listener per concrete event class.

Subscriber class (when one consumer handles multiple events):

use OxidEsales\PaymentBase\EventSystem\Event\Contract\ContractReadyToCommitEvent;
use OxidEsales\PaymentBase\EventSystem\SubscriberInterface;

class OrderCreationSubscriber implements SubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            ContractReadyToCommitEvent::class => 'onContractReady',
        ];
    }

    public function onContractReady(ContractReadyToCommitEvent $event): void
    {
        $contract = $event->getContract();
        $order    = $this->orderService->createFromContract($contract);
        $contract->commit($order->getId());
        $this->contractRepository->save($contract);
    }
}