Skip to content

Custom Drivers & Integrations

Payments discovers custom gateway drivers lazily so adding a regional bank or PSP module never slows down normal ProcessWire requests.

Payments ships four official, lazily loaded driver modules that integrate directly into Setup -> Payments -> Gateways:

Declare 'paymentsDriver' => true in your module’s getModuleInfo(), hook Payments::registerDrivers inside init(), and register a driver implementing PaymentGatewayInterface plus any applicable optional capability interfaces.

<?php namespace ProcessWire;
use Totoglu\Payments\Contracts\PaymentGatewayInterface;
use Totoglu\Payments\Domain\GatewayCapabilities;
class PaymentsDriverAegeanBank extends WireData implements Module
{
public static function getModuleInfo(): array
{
return [
'title' => 'Aegean Bank Payment Driver',
'version' => 100,
'autoload' => false,
'requires' => ['Payments'],
'paymentsDriver' => true,
];
}
public function init(): void
{
$this->addHookAfter('Payments::registerDrivers', function (HookEvent $event): void {
$registry = $event->arguments(0);
$registry->register('aegean-bank', new AegeanBankGateway($this->wire()));
});
}
}

Return a GatewayCapabilities object from capabilities() and implement only the optional interfaces your provider supports:

Interface Unlocks
SavedSourceGatewayInterface Vaulting and charging customer payment methods.
InstallmentGatewayInterface Regional card installment matrices.
SubscriptionGatewayInterface Recurring plan creation, cancellation, pause, and resume.
QuantitySubscriptionGatewayInterface Seat-based subscription quantity updates.
MeteredSubscriptionGatewayInterface Usage reporting (recordUsage()) and period summaries.
MarketplaceGatewayInterface Sub-merchant onboarding, platformFeeMinor, splits, and transfers.
WebhookGatewayInterface Inbound webhook signature verification and event normalization.
InvoiceGatewayInterface Customer invoice listing and PDF URL resolution.
TransactionStatusGatewayInterface Active status polling during payments:transactions:reconcile.

Use Payments’ WireHttpTransport inside custom drivers for consistent timeouts, TLS verification, and SSRF protection. See site/modules/Payments/examples/real-world/custom-gateway-driver.php for a complete driver blueprint.

Registered custom drivers automatically appear in Setup -> Payments -> Gateways with their declared capability badges.
  • Account: Automatically dispatches 7 transactional notification templates (payment-receipt, payment-refund, payment-failed, subscription-activated, subscription-invoice-paid, subscription-payment-failed, subscription-canceled) and powers /account/billing + GDPR privacy_export.
  • Headless: Exposes /api/v1/payments/* and /api/v1/subscriptions/* endpoints protected by payments:* and subscriptions:* token scopes.
  • Contacts & User Erasure (contactsParticipant => true, entriesUserDeleteListener => true): When a contact or ProcessWire user is erased under GDPR, Payments runs anonymizeForContact() and anonymizeForUser() to scrub customer names and emails while preserving financial ledger amounts and tax history.

Next steps