Skip to main content
Payment methods represent the ways customers can pay for their orders. Shopper provides a flexible system to manage multiple payment providers, each with its own logo, description, and customer-facing instructions.

Model

The model used is Shopper\Core\Models\PaymentMethod. It implements Shopper\Core\Models\Contracts\PaymentMethod and uses the HasSlug and HasZones traits. The model is not configurable via config/shopper/models.php.

Database Schema

PaymentMethod Table

Contract

The PaymentMethod contract defines the interface that all payment method models must implement:
Payment methods use zones to control availability by geographic region. A payment method can be assigned to multiple zones, and a zone can have multiple payment methods.
The driver column connects a payment method to a registered payment driver (stripe, manual, paypal, etc.). When the PaymentProcessingService processes a payment, it uses this value to resolve the correct driver. See Payments for driver registration and the full payment lifecycle.

Relationships

Zones

Payment methods can be scoped to specific geographic zones using the HasZones trait:

Orders

Orders reference payment methods via the payment_method_id foreign key:

Query Scopes

Logo Handling

Payment method logos use Spatie Media Library. The logoUrl() method returns the first media URL from the thumbnail collection, with a fallback to the payment driver’s logo:

Creating Payment Methods

Basic Payment Method

Cash on Delivery

Bank Transfer

Zone-Scoped Payment Method

Retrieving Payment Methods

Find by slug:
Payment methods available in a specific zone:
Payment methods with no zone restriction (available everywhere):

Working with Orders

When creating an order, associate it with the selected payment method:

Storefront Example

Checkout Payment Selection

Payment methods without any zone assignment are considered globally available and will be shown to all customers regardless of their location.

Use Cases