PHPackages                             unusualify/payable - 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. unusualify/payable

ActiveLibrary[Payment Processing](/categories/payments)

unusualify/payable
==================

v0.12.2(3mo ago)33.4k1[1 PRs](https://github.com/unusualify/payable/pulls)2MITPHPCI passing

Since Jun 13Pushed 3mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (41)Used By (2)

Laravel Payment Package Documentation
=====================================

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

Overview
--------

[](#overview)

This Laravel package provides a flexible and extensible solution for integrating various payment gateways into your Laravel application. It offers a unified interface for handling different payment services, making it easier to manage multiple payment providers within your project.

Key Features
------------

[](#key-features)

- Easy integration with multiple payment gateways
- Unified interface for common payment operations (pay, cancel, refund)
- Customizable configuration for each payment service
- Built-in model for storing payment records
- Extensible architecture for adding new payment services

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

[](#installation)

To install the package, run the following command in your Laravel project:

```
composer require unusualify/payable
```

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

[](#configuration)

After installation, publish the configuration file:

```
php artisan vendor:publish --provider="Unusualify\Payable\LaravelServiceProvider"
```

This will create a `payable.php` configuration file in your `config` directory.

In the `payable.php` configuration file, you need to specify a route name for return\_url. In default it is set as `payment.response`. You should create a GET &amp; POST routes for the same url and specify a a route name.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

To use a payment service:

```
use Unusualify\Payable\Payable;

$payable = new Payable('gateway_slug');
$result = $payable->pay($params);
```

Replace `'gateway_slug'` with the slug of your desired payment gateway (e.g., 'stripe', 'paypal').

### Available Methods

[](#available-methods)

- `pay($params)`: Process a payment
- `cancel($params)`: Cancel a payment
- `refund($params)`: Refund a payment
- `formatPrice($price)`: Format the price according to the gateway's requirements
- `formatAmount($amount)`: Format the amount according to the gateway's requirements

### Storing Payment Records

[](#storing-payment-records)

The package includes a `Payment` model for storing payment records. You can access it like any other Eloquent model:

```
use Unusualify\Payable\Models\Payment;

$payment = Payment::create([
    'payment_gateway' => 'paypal',
    'order_id' => '12345',
    'amount' => 1000,
    'currency_id' => 'USD',
    'status' => 'pending',
    'email' => 'customer@example.com',
    // ... other fields
]);
```

### Payment Payload Guide

[](#payment-payload-guide)

When using the `pay()` method, you need to provide a properly structured payload. Here's an example of a complete payment payload:

```
$payload = [
    // Required fields
    'amount' => 1000,                           // Amount in the smallest currency unit (e.g., cents)
    'currency' => 'USD',                        // Currency code in ISO 4217 format
    'order_id' => uniqid(''),                // Unique order identifier

    // Locale and payment details
    'locale' => 'en',                           // User's locale
    'installment' => '1',                       // Number of installments (if supported)
    'payment_group' => 'PRODUCT',               // Payment category

    // Card information
    'card_name' => 'John Doe',                  // Cardholder name
    'card_no' => '4111111111111111',            // Card number (no spaces)
    'card_month' => '12',                       // Expiration month
    'card_year' => '2025',                      // Expiration year
    'card_cvv' => '123',                        // Security code

    // User information
    'user_name' => 'John',                      // User's first name
    'user_surname' => 'Doe',                    // User's last name
    'user_gsm' => '+1234567890',                // User's phone number
    'user_email' => 'john.doe@example.com',     // User's email
    'user_ip' => '127.0.0.1',                   // User's IP address

    // Billing/shipping information
    'company_name' => 'Example Corp',           // Company name
    'user_address' => '123 Main St',            // Street address
    'user_city' => 'New York',                  // City
    'user_country' => 'US',                     // Country
    'user_zip_code' => '10001',                 // Postal/ZIP code

    // Basket information
    'basket_id' => uniqid(),                    // Unique basket identifier
    'items' => [
        [
            'id' => '1',                        // Product ID
            'name' => 'Product Name',           // Product name
            'category1' => 'Category',          // Primary category
            'category2' => 'Subcategory',       // Secondary category
            'price' => 1000,                    // Product price
            'type' => 'VIRTUAL',                // Product type
        ],
        // Add more items as needed
    ],

    // Custom data (optional)
    'custom_data' => [
        'reference_id' => 'REF123',
        'notes' => 'Special instructions'
    ],
];

// Optional payment record attributes
$paymentPayload = [
    'price_id' => 1,                            // Reference to your price model
    'payment_service_id' => 2,                  // Payment service ID
    'currency_id' => 3,                         // Currency ID in your system
];

$payable = new Payable('gateway_slug');
$result = $payable->pay($payload, $paymentPayload);
```

Notes:

- The `amount` should be provided in the smallest currency unit (e.g., cents for USD/EUR, pence for GBP)
- Different payment gateways may require different fields. Check your specific gateway's documentation
- The `paymentPayload` parameter is optional and used to store additional data in the payment record

Troubleshooting
---------------

[](#troubleshooting)

\[This section would typically include common issues and their solutions.\]

Contributing
------------

[](#contributing)

\[Contribution guidelines would go here.\]

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance82

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~33 days

Recently: every ~70 days

Total

18

Last Release

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fa916ca166587c9e375b92a136aa8072964dd0fc2d585b45b77319902e1cc850?d=identicon)[unusualify](/maintainers/unusualify)

---

Top Contributors

[![gunesbizim](https://avatars.githubusercontent.com/u/37237628?v=4)](https://github.com/gunesbizim "gunesbizim (62 commits)")[![unusual-enterprise](https://avatars.githubusercontent.com/u/146723232?v=4)](https://github.com/unusual-enterprise "unusual-enterprise (36 commits)")[![oguzhanbukcuoglu](https://avatars.githubusercontent.com/u/47870922?v=4)](https://github.com/oguzhanbukcuoglu "oguzhanbukcuoglu (20 commits)")[![ramazanayyildiz](https://avatars.githubusercontent.com/u/48105049?v=4)](https://github.com/ramazanayyildiz "ramazanayyildiz (8 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/unusualify-payable/health.svg)

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

###  Alternatives

[lemonsqueezy/laravel

A package to easily integrate your Laravel application with Lemon Squeezy.

58596.1k](/packages/lemonsqueezy-laravel)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[tsaiyihua/laravel-linepay

linepay library for laravel

102.9k](/packages/tsaiyihua-laravel-linepay)[digikraaft/laravel-paystack-webhooks

Handle Paystack webhooks in a Laravel application

177.5k1](/packages/digikraaft-laravel-paystack-webhooks)[wandesnet/mercadopago-laravel

PHP SDK for integration with Mercado Pago

252.4k](/packages/wandesnet-mercadopago-laravel)

PHPackages © 2026

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