Payments, Subscriptions & Tax

Adding Custom Payment Gateways with Auto-Discovery (payment-processors/)

Published 2026-12-04 03:20:21

Zero-Core-Edit Payment Plugin Architecture

Site Store Pro supports stand-alone, auto-discovered payment plugins inside the payment-processors/ folder. You can integrate third-party gateways (such as Square, Authorize.Net, or Braintree) without modifying core controllers, routes, or config files.

Folder Structure

payment-processors/
  my-gateway/
    processor.json
    MyGatewayProcessor.php
    checkout.blade.php

1. Create processor.json

IDs 0–3 are strictly reserved for built-in gateways (Test, Stripe, Paddle, PayPal). Use IDs 100 and above for custom plugins:

{
  "processor_id": 100,
  "name": "My Gateway",
  "class": "PaymentProcessors\\MyGateway\\MyGatewayProcessor",
  "file": "MyGatewayProcessor.php",
  "default_production": 0
}

2. Implement PaymentPluginInterface

Your driver class implements App\Services\Payments\Contracts\PaymentPluginInterface (which extends PaymentProcessorInterface) with methods for charge(), refund(), getTypeSlug(), prepareCheckout(), buildChargePayload(), getCheckoutViewPath(), getCheckoutViewData(), matchesPayment(), and handleWebhook().

3. Register Checkout JS Hooks

Your checkout.blade.php partial renders automatically inside the Order Review Payment Method card and registers lifecycle hooks on window.PaymentProcessorPlugins[slug] (init, reboot, handlePlaceOrder, and handlePrepared).

Automatic Registration, Refunds & Webhooks

  • Auto-Discovery on Boot: PluginServiceProvider calls PaymentProcessorManager::syncDiscoveredProcessors(), automatically inserting your gateway into order_processors so it appears immediately in /admin/ecommerce/checkout/processors.
  • Automatic Admin Refunds: PaymentRefundService routes refunds to whichever plugin matches via matchesPayment($payment).
  • Automatic CSRF-Exempt Webhooks: Point your gateway to POST https://yourdomain.com/webhooks/payment/{slug} to dispatch directly into your plugin's handleWebhook() method.

Was this article helpful?

Let us know how we can improve our documentation.