PHPackages                             graigdev/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. graigdev/payment

ActiveLibrary[Payment Processing](/categories/payments)

graigdev/payment
================

A Laravel package that generates payment codes for subscriptions with wallet management

v1.0.2(1y ago)09MITPHPPHP ^8.0|^8.1|^8.2|^8.3

Since Apr 4Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (4)Used By (0)

Payment Package for Laravel
===========================

[](#payment-package-for-laravel)

A Laravel package that generates payment codes for subscriptions with wallet management.

Features
--------

[](#features)

- Wallet management system
- Payment code generation and redemption
- Transaction tracking
- Configurable settings

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

[](#installation)

You can install the package via composer:

```
composer require graigdev/payment
```

Then publish the config file:

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

### Optional: Publish Migrations and Models

[](#optional-publish-migrations-and-models)

You can publish the migrations to customize them before running:

```
php artisan vendor:publish --tag="payment-migrations"
```

#### Publishing Models

[](#publishing-models)

You have two options to publish the models:

**Option 1**: Using the vendor:publish command:

```
php artisan vendor:publish --tag="payment-models"
```

**Option 2**: Using the custom command (recommended):

```
php artisan payment:publish-models
```

The custom command automatically adjusts namespaces and references within the models. Use the `--force` flag to overwrite existing models:

```
php artisan payment:publish-models --force
```

If you publish the models, all references in your code should be updated from `GraigDev\Payment\Models` to `App\Models\Payment`.

Finally, run the migrations:

```
php artisan migrate
```

Usage
-----

[](#usage)

### Wallet Management

[](#wallet-management)

Each user has a wallet that can be used to manage their balance.

```
// Get a user's wallet
$wallet = \GraigDev\Payment\Models\Wallet::where('user_id', auth()->id())->first();

// If you published the models, use this instead:
// $wallet = \App\Models\Payment\Wallet::where('user_id', auth()->id())->first();

// Deposit funds
$wallet->deposit(100, 'Manual deposit');

// Withdraw funds
$wallet->withdraw(50, 'Manual withdrawal');
```

### Payment Codes

[](#payment-codes)

Generate and redeem payment codes:

```
// Generate a payment code
$paymentCode = \GraigDev\Payment\Models\PaymentCode::create([
    'code' => 'PAY-' . strtoupper(Str::random(10)),
    'amount' => 100,
    'description' => 'Subscription payment',
    'generated_by' => auth()->id(),
]);

// Redeem a payment code
$code = 'PAY-ABCDEFGHIJ';
$paymentCode = \GraigDev\Payment\Models\PaymentCode::where('code', $code)
    ->unused()
    ->valid()
    ->first();

if ($paymentCode) {
    $paymentCode->markAsUsed(auth()->id());
    $wallet->deposit($paymentCode->amount, 'Redeemed code: ' . $code);
}
```

### Transactions

[](#transactions)

View transaction history:

```
// Get all transactions for a wallet
$transactions = $wallet->transactions;

// Get transactions of a specific type
$deposits = $wallet->transactions()->ofType('DEPOSIT')->get();
```

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

[](#configuration)

You can configure the package by editing the `config/payment.php` file:

```
return [
    // Payment code settings
    'code_prefix' => 'PAY',
    'code_length' => 10,

    // Wallet settings
    'currency' => 'USD',
    'min_withdrawal' => 10,

    // Transaction types
    'transaction_types' => [
        'deposit' => 'DEPOSIT',
        'withdrawal' => 'WITHDRAWAL',
        'transfer' => 'TRANSFER',
        'payment' => 'PAYMENT',
        'refund' => 'REFUND',
    ],
];
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance46

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~0 days

Total

2

Last Release

409d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/984cea361bf26cefe67afd9e2fe77920d2aaede9a8c7bdb388b08d4807910cba?d=identicon)[graigdev](/maintainers/graigdev)

---

Top Contributors

[![graigdev](https://avatars.githubusercontent.com/u/52658403?v=4)](https://github.com/graigdev "graigdev (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[asciisd/knet

Knet package is provides an expressive, fluent interface to KNet's payment services.

141.1k](/packages/asciisd-knet)[dena-a/iran-payment

a Laravel package to handle Internet Payment Gateways for Iran Banking System

312.4k1](/packages/dena-a-iran-payment)

PHPackages © 2026

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