Shared “Payment” Tab on the Order Detail Page

The single biggest reason payment-component was repackaged as oxid-esales/payment-base is the shared admin Payment tab on the OXID Order detail page. Before payment-base, every PSP module had to ship its own admin order-detail tab, with duplicated controllers, templates and action handlers. payment-base owns one tab; PSP modules only contribute panels.

Why this matters

  • One UI for the merchant. The “Zahlung” tab looks and behaves the same regardless of which PSP processed the order.

  • No per-PSP admin controllers. PSP modules stop shipping AdminDetailsController subclasses just to render order-detail UI.

  • Capture / refund / void route through one dispatcher. Admin actions emit events on the shared event bus — the same bus consumer modules already listen to.

  • Pluggable. A new PSP only ships a tagged panel-provider service; no payment-base code changes.

Where the tab lives

OXID’s admin navigation registers the tab under mxorders > mxdisplayorders in menu.xml:

<OXMENU id="NAVIGATION_ESHOPADMIN">
  <MAINMENU id="mxorders">
    <SUBMENU id="mxdisplayorders" cl="admin_order" list="order_list">
      <TAB id="PAYMENT_ADMIN_TAB" cl="PaymentAdmin" />
    </SUBMENU>
  </MAINMENU>
</OXMENU>

The cl="PaymentAdmin" lookup is resolved through the module’s metadata.php controllers map:

'controllers' => [
    'PaymentAdmin' => PaymentAdminController::class,
],

OXID’s admin frame instantiates the controller via oxNew when the merchant clicks the tab on any order detail page — so the controller has to be self-contained and must not assume constructor DI.

Components

The Admin layer in OxidEsales\PaymentBase\Admin consists of:

Class

Responsibility

PaymentAdminController

The single AdminDetailsController rendered inside the Order Detail page. Loads the order, resolves the contract, asks the registry for the matching panel, and renders the wrapper template around it.

PaymentPanelRegistry

Collects every service tagged oe.payment.admin_panel and returns the first one that supports() a given order context.

PaymentAdminActionDispatcher

Translates admin actions (capture, refund, void, …) emitted from the panel into the right dispatched event, including permission and CSRF checks.

PaymentPanelContext

Value object handed to panel providers. Carries the Order, the resolved PaymentContract (if any), and the admin request data.

PaymentPanelRenderable

The data + template pair that a panel provider returns. The wrapper template injects it into the shared chrome.

Resolution flow

admin opens Order Detail page
             │
             │ menu.xml → cl=PaymentAdmin → metadata.php controllers
             ▼
     PaymentAdminController::render()
             │
             │ load Order, resolve PaymentContract
             ▼
     PaymentPanelRegistry::resolveFor(PaymentPanelContext)
             │
             │ iterate tagged providers, first match wins
             ▼
     active PaymentPanelProvider (Stripe / PayPal / …)
             │
             │ returns PaymentPanelRenderable (template + view data)
             ▼
     wrapper template embeds the renderable

If no tagged provider claims the order — typical for legacy payment methods such as invoice, prepayment or cash-on-delivery — the wrapper renders the “order was not processed through a registered online payment provider” notice instead.

Plugging in a PSP panel

A PSP module registers a panel-provider service in its services.yaml:

services:
  YourCompany\Stripe\Admin\StripePanelProvider:
    tags:
      - { name: oe.payment.admin_panel, provider: stripe, priority: 100 }

The class implements OxidEsales\PaymentBase\Admin\Contract\PaymentPanelProviderInterface:

namespace YourCompany\Stripe\Admin;

use OxidEsales\PaymentBase\Admin\Contract\PaymentPanelProviderInterface;
use OxidEsales\PaymentBase\Admin\Panel\PaymentPanelContext;
use OxidEsales\PaymentBase\Admin\Panel\PaymentPanelRenderable;

final class StripePanelProvider implements PaymentPanelProviderInterface
{
    public function getProviderName(): string
    {
        return 'stripe';
    }

    public function supports(PaymentPanelContext $context): bool
    {
        return $context->getProvider() === 'stripe';
    }

    public function render(PaymentPanelContext $context): PaymentPanelRenderable
    {
        return new PaymentPanelRenderable(
            template: '@stripe/admin/payment_panel.html.twig',
            viewData: ['contract' => $context->getContract()],
        );
    }
}

The wrapper template iterates the registry and embeds the returned renderable — your panel ends up inside the shared admin chrome with no extra wiring.

Admin actions ride the same event bus

Buttons inside the panel (capture, refund, void, …) post back to PaymentAdminController, which hands the action to PaymentAdminActionDispatcher. The dispatcher emits a typed event on the shared bus; the active PSP’s handler executes it via the adapter and records a row in oe_payments_transaction.

The same event a webhook would have raised. The result: capture flows triggered by a merchant in the admin are indistinguishable downstream from capture flows triggered by a PSP webhook — both run the same listeners, produce the same audit trail, and update OXPAID through the same OrderPaymentCompletedHandler.

If the merchant performed the action outside of OXID (e.g. refunded directly in the Stripe Dashboard) the panel’s view layer reconciles OXPAID on render via reconcilePaymentState() — self-healing without relying on the webhook chain.

Resolution by provider name

For diagnostics and tests, PaymentPanelRegistry also exposes a direct lookup by provider name:

$provider = $registry->resolveByProviderName('stripe');

Useful when a CLI command or orchestration layer already knows which PSP it wants to talk to.