PHPackages                             laravelpay/foundation - 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. laravelpay/foundation

ActiveLibrary[Payment Processing](/categories/payments)

laravelpay/foundation
=====================

LaraPay is a payment gateway package for Laravel

016PHP

Since Feb 12Pushed 1y agoCompare

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

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Laravel Pay
===========

[](#laravel-pay)

Laravel Pay is a lightweight package for Laravel that allows you to easily integrate payment gateways into your application.

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 11.0 or higher

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

[](#supported-gateways)

GatewayInstall Command[PayPal](https://github.com/laravelpay/gateway-paypal)php artisan gateway:install laravelpay/gateway-paypal[PayPal IPN](https://github.com/laravelpay/gateway-paypal-ipn)php artisan gateway:install laravelpay/gateway-paypal-ipn[Stripe](https://github.com/laravelpay/gateway-stripe)php artisan gateway:install laravelpay/gateway-stripe[Mollie](https://github.com/laravelpay/gateway-mollie)php artisan gateway:install laravelpay/gateway-mollie[Tebex](https://github.com/laravelpay/gateway-tebex)php artisan gateway:install laravelpay/gateway-tebex[BitPave](https://github.com/laravelpay/gateway-bitpave)php artisan gateway:install laravelpay/gateway-bitpave[PayByLink](https://github.com/laravelpay/gateway-bitpave)php artisan gateway:install laravelpay/gateway-paybylinkSubscription Gateways
---------------------

[](#subscription-gateways)

GatewayInstall Command[PayPal Subscriptions](https://github.com/laravelpay/subscriptions-paypal)php artisan gateway:install laravelpay/subscriptions-paypal[Stripe Subscriptions](https://github.com/laravelpay/subscriptions-stripe)php artisan gateway:install laravelpay/subscriptions-stripeInstallation
------------

[](#installation)

To install the package, use Composer:

```
composer require laravelpay/foundation dev-main
```

Installing Gateways
-------------------

[](#installing-gateways)

Laravel Pay allows you to install gateways based on your needs. The command below allows you to install one of our default gateways.

```
php artisan gateway:install
```

To install custom gateways, you may pass it in the argument and the GitHub owner/repo i.e `php artisan gateway:install laravelpay/gateway-paypal-ipn`

Setting up Gateways
-------------------

[](#setting-up-gateways)

You can create multiple configurations for each gateway. Below is an example of how you might set up the PayPal gateway.

```
php artisan gateway:setup
```

Usage
-----

[](#usage)

Below is an example of how you might use the package in your Laravel application.

```
use LaraPay\Framework\Payment;

Route::get('/macbook/purchase', function () {
    $payment = Payment::create([
        'amount' => 2000,
        'currency' => 'USD',
        'description' => 'Macbook Pro',
    ]);

    return $payment->payWith('paypal');
}
```

In the payWith() method, pass the id or alias of the gateway.

Creating temporary payment links
--------------------------------

[](#creating-temporary-payment-links)

This package comes with a built-in method that allows you to generate temporary links that redirect the user to make the payment.

```
use LaraPay\Framework\Payment;

$payment = Payment::create([
    'amount' => 2000,
    'currency' => 'USD',
    'description' => 'Macbook Pro',
]);

// laravel-pay generates a temporary payment link for the gateway
$link = $payment->generateLinkForGateway('paypal'); // http://laravel.app/payments/pay/awFlSUrsmKsoVtLHQBzLziFFnqoSsXt6

return redirect($link);
```

Executing code when payment is completed
----------------------------------------

[](#executing-code-when-payment-is-completed)

After a user completes a payment, you may want to execute some code to fulfill the users order. This can be done using Payment Handlers.

1. First create a new php file in app/PaymentHandlers, in our case the file will be called MacbookPaymentHandler.php

```
namespace App\PaymentHandlers;

LaraPay\Framework\Interfaces\PaymentHandler;

class MacbookPaymentHandler extends PaymentHandler
{
    public function onPaymentCompleted($payment)
    {
        // execute code when payment is completed
    }
}
```

2. Generate the payment and pass the handler class

```
use LaraPay\Framework\Payment;
use App\PaymentHandlers\MacbookPaymentHandler;

$payment = Payment::create([
    'user_id' => 1,
    'amount' => 2000,
    'currency' => 'USD',
    'description' => 'Macbook Pro',
    'handler' => MacbookPaymentHandler::class,
]);
```

Payments for users
------------------

[](#payments-for-users)

You may want to attach specific payments to specific users. You can do so by passing the user id when the payment is created

```
use LaraPay\Framework\Payment;

$payment = Payment::create([
    'user_id' => 1,
    'amount' => 2000,
    'currency' => 'USD',
    'description' => 'Macbook Pro',
]);
```

The user can be retrieved later when the payment is completed using `$payment->user`

Passing custom data
-------------------

[](#passing-custom-data)

Custom data can be passed when the payment is being created

```
use LaraPay\Framework\Payment;

$payment = Payment::create([
    'amount' => 2000,
    'currency' => 'USD',
    'description' => 'Macbook Pro',
    'data' => [
        'order_id' => 1,
    ],
]);
```

Custom success and cancel urls
------------------------------

[](#custom-success-and-cancel-urls)

Define the URL where the user should be redirected to in the event that the payment gets cancelled or is successfully completed.

```
use LaraPay\Framework\Payment;

$payment = Payment::create([
    'amount' => 2000,
    'currency' => 'USD',
    'description' => 'Macbook Pro',
    'success_url' => route('your-success-route'),
    'cancel_url' => route('your-cancel-route'),
]);
```

Subscriptions
-------------

[](#subscriptions)

This package includes support for some subscription based gateways. This system works similarly to normal payments.

```
use LaraPay\Framework\Subscription;

Route::get('/plans/basic/subscribe', function () {
    $subscription = Subscription::create([
        'name' => 'Basic Plan',
        'amount' => 2000,
        'currency' => 'USD',
        'frequency' => 30, // The frequency (in days) on which the subscription will be charged. 7 is weekly, 30 monthly, 365 yearly
    ]);

    return $subscription->subscribeWith('paypal');
}
```

Support
-------

[](#support)

If you have any questions or issues, please create a new issue in the project repository on GitHub.

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](https://github.com/laravelpay/framework/blob/main/LICENSE) file for details.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/757e4adaaa3ba2da90444650ec245df703fa2aa528f46a20f09c11ecb06b331b?d=identicon)[Mubeen\_](/maintainers/Mubeen_)

---

Top Contributors

[![Mubeen142](https://avatars.githubusercontent.com/u/58806240?v=4)](https://github.com/Mubeen142 "Mubeen142 (54 commits)")

### Embed Badge

![Health badge](/badges/laravelpay-foundation/health.svg)

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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