PHPackages                             juzaweb/payment - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. juzaweb/payment

ActiveJuzaweb-module[Payment Processing](/categories/payments)

juzaweb/payment
===============

Payment Module

1.0.0(2mo ago)1504↑71.2%GPL-2.0PHPCI passing

Since Mar 5Pushed 2mo agoCompare

[ Source](https://github.com/juzaweb/payment)[ Packagist](https://packagist.org/packages/juzaweb/payment)[ RSS](/packages/juzaweb-payment/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

A flexible Payment Module for the Juzaweb CMS. This module provides a unified interface for handling multiple payment gateways (PayPal, Stripe) and allows other modules to integrate payment functionalities easily.

Features
--------

[](#features)

- **Multiple Payment Gateways:** Support for PayPal, Stripe, and Custom payments.
- **Module Integration:** Extensible system allowing other modules (e.g., Shop, Membership) to register themselves as payment handlers.
- **Event Driven:** Dispatches events for payment success, failure, and cancellation.
- **Admin Management:** Configure payment methods and view payment history via the Juzaweb Admin Panel.

Installation
------------

[](#installation)

1. **Install the module:**

    ```
    php artisan module:install juzaweb/payment
    ```
2. **Publish the configuration and assets (optional):**

    ```
    php artisan vendor:publish --tag="payment-config"
    php artisan vendor:publish --tag="payment-module-views"
    ```

Configuration
-------------

[](#configuration)

Payment methods are configured directly in the Juzaweb Admin Panel. Navigate to **Settings &gt; Payment Methods** to enable and configure gateways like PayPal (Client ID, Secret) and Stripe (Publishable Key, Secret Key).

Usage
-----

[](#usage)

### 1. Implement `Paymentable` Contract

[](#1-implement-paymentable-contract)

Your order model (the entity being paid for) must implement the `Juzaweb\Modules\Payment\Contracts\Paymentable` interface.

```
use Juzaweb\Modules\Payment\Contracts\Paymentable;
use Illuminate\Database\Eloquent\Model;

class Order extends Model implements Paymentable
{
    public function getTotalAmount(): float
    {
        return $this->total_price;
    }

    public function getCurrency(): string
    {
        return 'USD';
    }

    public function getPaymentDescription(): string
    {
        return "Payment for Order #{$this->code}";
    }

    public function getCode(): string
    {
        return $this->code;
    }
}
```

### 2. Create a Module Handler

[](#2-create-a-module-handler)

Create a class that implements `Juzaweb\Modules\Payment\Contracts\ModuleHandlerInterface`. This handler manages the business logic after a payment transaction.

```
use Juzaweb\Modules\Payment\Contracts\ModuleHandlerInterface;
use Juzaweb\Modules\Payment\Contracts\Paymentable;

class MyShopModuleHandler implements ModuleHandlerInterface
{
    public function createOrder(array $params): Paymentable
    {
        // Logic to create an order if needed, or return an existing one
        return Order::find($params['order_id']);
    }

    public function success(Paymentable $paymentable, array $params): void
    {
        // Handle successful payment (e.g., update order status to 'completed', send email)
        $paymentable->update(['status' => 'completed']);
    }

    public function fail(Paymentable $paymentable, array $params): void
    {
        // Handle failed payment
        $paymentable->update(['status' => 'failed']);
    }

    public function cancel(Paymentable $paymentable, array $params): void
    {
        // Handle cancelled payment
        $paymentable->update(['status' => 'cancelled']);
    }

    public function getReturnUrl(): string
    {
        return url('/shop/checkout/completed');
    }
}
```

### 3. Register the Module Handler

[](#3-register-the-module-handler)

Register your module handler in your module's `ServiceProvider` using the `PaymentManager`.

```
use Juzaweb\Modules\Payment\Contracts\PaymentManager;

public function boot()
{
    $this->app[PaymentManager::class]->registerModule(
        'my_shop_module',
        new MyShopModuleHandler()
    );
}
```

### 4. Initiate a Payment

[](#4-initiate-a-payment)

Use the `PaymentManager` to create a payment transaction.

```
use Juzaweb\Modules\Payment\Contracts\PaymentManager;

public function checkout(Request $request)
{
    $user = $request->user();
    $paymentMethod = $request->input('payment_method'); // e.g., 'paypal'
    $orderId = $request->input('order_id');

    // Additional params passed to the gateway and handler
    $params = [
        'return_url' => route('payment.return'),
        'cancel_url' => route('payment.cancel'),
    ];

    try {
        $response = app(PaymentManager::class)->create(
            $user,
            'my_shop_module',
            $paymentMethod,
            $orderId,
            $params
        );

        // Redirect user to the payment gateway
        if ($response->isRedirect()) {
            return $response->redirect();
        }

        return $response->getMessage();

    } catch (\Exception $e) {
        return redirect()->back()->withErrors($e->getMessage());
    }
}
```

Supported Gateways
------------------

[](#supported-gateways)

- **PayPal:** Configure Client ID and Secret in Admin Panel.
- **Stripe:** Configure Publishable and Secret Keys in Admin Panel.
- **Custom:** Extend functionality with custom payment drivers.

### Registering a Custom Driver

[](#registering-a-custom-driver)

You can register a custom payment driver in your `ServiceProvider`:

```
use Juzaweb\Modules\Payment\Contracts\PaymentManager;
use Juzaweb\Modules\Payment\Services\PaymentDriverAdapter;

$this->app[PaymentManager::class]->registerDriver(
    'MyGateway',
    fn() => new PaymentDriverAdapter(
        MyGatewayImplementation::class,
        ['api_key' => 'Config Label']
    )
);
```

Events
------

[](#events)

The module fires the following events during the payment process:

- `Juzaweb\Modules\Payment\Events\PaymentSuccess`
- `Juzaweb\Modules\Payment\Events\PaymentFail`
- `Juzaweb\Modules\Payment\Events\PaymentCancel`

Listen to these events in your `EventServiceProvider` to perform additional actions.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance87

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 86.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

74d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3169e8a8781068840e9300a57785089da521287dbe0279fc9cc7e8de1c1d95a9?d=identicon)[juzaweb](/maintainers/juzaweb)

---

Top Contributors

[![juzaweb](https://avatars.githubusercontent.com/u/47020363?v=4)](https://github.com/juzaweb "juzaweb (62 commits)")[![google-labs-jules[bot]](https://avatars.githubusercontent.com/in/842251?v=4)](https://github.com/google-labs-jules[bot] "google-labs-jules[bot] (10 commits)")

---

Tags

juzawebjuzaweb-cmsjuzaweb-modulelaravel-paymentspaymentpayment-geteway

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/juzaweb-payment/health.svg)

```
[![Health](https://phpackages.com/badges/juzaweb-payment/health.svg)](https://phpackages.com/packages/juzaweb-payment)
```

###  Alternatives

[offline/oc-mall-plugin

E-commerce solution for October CMS

1744.6k2](/packages/offline-oc-mall-plugin)[duncanmcclean/simple-commerce

A simple, yet powerful e-commerce addon for Statamic.

16313.2k2](/packages/duncanmcclean-simple-commerce)[flux-se/sylius-stripe-plugin

Sylius Stripe plugin using Payment Request

1029.3k](/packages/flux-se-sylius-stripe-plugin)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

322.8k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
