nxmad/larapay

This package is abandoned and no longer maintained. No replacement package was suggested.

Powerful multi-gateway payment processing library designed to make life easier in Laravel 5

1.0.0-rc.2 2019-06-04 22:24 UTC

This package is auto-updated.

Last update: 2021-03-31 15:39:05 UTC


README

Larapay.png

Larapay — a powerful Laravel extension with 2 core functionalities: 1) abstract interface for any payment gateway; 2) accounting system for your users.

Software License Scrutinizer Code Quality Build Status

Installation

This package can be installed as a Composer dependency.

$ composer require nxmad/larapay

If you don't use auto-discovery (or your Laravel version < 5.5), add the ServiceProvider to the providers array in config/app.php

Nxmad\Larapay\LarapayServiceProvider::class,

Publish default configuration file larapay.php

$ php artisan vendor:publish

Usage example

// Setup transaction for user
// Actually, you can use any Entity (Model) instead of User
// Transaction can have positive and negative amount
$transaction = $request->user()->setup(- $amount, $description);

// Check if the user can afford this order
if ($transaction->affordable() || $request->user()->canAfford($transaction)) {
    // do some logic...
    
    // and then save the transaction as sucessfull
    // this way:
    $transaction->makeSuccessful();
    
    // or this way:
    $transaction(Transaction::STATE_SUCCESSFUL);
} else {
    // Otherwise redirect user to the payment gateway (for .e.g)
    $gateway = payments('paypal');
    
    // There are 3 ways of interact with payment gateway:
    // Redirect (GET), POST form and any custom behavior you can define by yourself
    return $gateway->interact($transaction);
}

Please see Wiki for more examples.

Supported gateways

You can add your gateway implementation to this list by creating an issue.

Gateway Composer package Maintainer
Unitpay nxmad/larapay-unitpay Alex Balatsky
WebMoney nxmad/larapay-webmoney Alex Balatsky
Qiwi.com P2P nxmad/larapay-qiwi-p2p Alex Balatsky
Yandex.Money P2P nxmad/larapay-yandex-money-p2p Alex Balatsky

Testing

Since 1.0

$ composer test

Credits

License

The MIT License (MIT). Please see License File for more information.