PHPackages                             susheelbhai/larapay - 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. susheelbhai/larapay

ActiveLibrary[Payment Processing](/categories/payments)

susheelbhai/larapay
===================

Multiple payment gateway for Laravel Application

v4.0.0(4d ago)0493↓71.4%MITPHP

Since Apr 7Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/susheelbhai/larapay)[ Packagist](https://packagist.org/packages/susheelbhai/larapay)[ RSS](/packages/susheelbhai-larapay/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependencies (6)Versions (33)Used By (0)

Larapay | Multiple Payment Gateway for Laravel Application
==========================================================

[](#larapay--multiple-payment-gateway-for-laravel-application)

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

[](#installation)

### Laravel

[](#laravel)

Require this package in your composer.json and update composer. This will download the package and install Larapay package.

```
composer require susheelbhai/larapay

```

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

[](#configuration)

### Vendor Publish

[](#vendor-publish)

Publish all the required files using the following command

```
php artisan vendor:publish --tag="larapay"

```

### Add credientials in .env file

[](#add-credientials-in-env-file)

```
php artisan larapay:initial_settings

```

### Migrate database

[](#migrate-database)

Migrate databse tables and seed with the following commands

```
php artisan migrate

```

Complete step in single action
------------------------------

[](#complete-step-in-single-action)

```
composer require susheelbhai/larapay
php artisan vendor:publish --tag="larapay"
php artisan larapay:initial_settings
php artisan migrate

```

Uses
----

[](#uses)

### Add a form inside your view file

[](#add-a-form-inside-your-view-file)

```

@csrf

```

.env variables
--------------

[](#env-variables)

ENABLE\_PAYMENT\_RESPONSE -&gt; 0 or 1 0 it will wait for webhook to respond 1 it will directly respond if callback responce received

PAYMENT\_TEMPLATE -&gt; blade or react bassed on the starter kit you are using

Setting up webhook
------------------

[](#setting-up-webhook)

#### Razorpay

[](#razorpay)

Rooturl/webhook/2

#### Phonepe V1

[](#phonepe-v1)

webhook url will be sent with payment request autometically, no action needed.

#### Phonepe V2

[](#phonepe-v2)

Rooturl/webhook/6

#### Cashfree

[](#cashfree)

Rooturl/webhook/7

#### PayU

[](#payu)

Rooturl/webhook/8

Allow callback url work without csrf token
------------------------------------------

[](#allow-callback-url-work-without-csrf-token)

Add the callback\_url in validateCsrfTokens except so that it can work even if this page is redirected by payment gateway

bootstrap/app.php

```
->withMiddleware(function (Middleware $middleware) {
        //------
        $middleware->validateCsrfTokens(except: [
            'callback_url',
            'payout/webhook/*',
        ]);
        //------
    })

```

Refund Payment
--------------

[](#refund-payment)

Add the callback\_url in validateCsrfTokens except so that it can work even if this page is redirected by payment gateway

```
use Susheelbhai\Larapay\Http\Controllers\PaymentController;

$Larapay = new PaymentController();
$response = $Larapay->refundPayment($payment_id, $amount, $speed);

```

Refend data is stored in $response and you can use it according to your need.

variablevaluedescription$payment\_idintthis is the primary key of payment table$amount`full` or custom amount'full' for full refund and the custom value for partial refund$speed`normal` or `instant`'normal' for standard refund and 'instant' for instant refundPayout (Money Out)
------------------

[](#payout-money-out)

The payout feature allows you to send money TO beneficiaries (users, dealers, partners) via Razorpay X, Cashfree Payouts, or PayU Payouts.

### Payout .env Variables

[](#payout-env-variables)

```
# Default payout gateway
PAYOUT_GATEWAY=razorpay

# Razorpay X Payouts
RAZORPAY_PAYOUT_KEY_ID=
RAZORPAY_PAYOUT_KEY_SECRET=
RAZORPAY_PAYOUT_ACCOUNT_NUMBER=
RAZORPAY_PAYOUT_WEBHOOK_SECRET=

# Cashfree Payouts
CASHFREE_PAYOUT_CLIENT_ID=
CASHFREE_PAYOUT_CLIENT_SECRET=
CASHFREE_PAYOUT_WEBHOOK_SECRET=

# PayU Payouts
PAYU_PAYOUT_MERCHANT_ID=
PAYU_PAYOUT_MERCHANT_SALT=
PAYU_PAYOUT_CLIENT_ID=
PAYU_PAYOUT_CLIENT_SECRET=
PAYU_PAYOUT_WEBHOOK_SECRET=

```

### Gateway IDs (for payout)

[](#gateway-ids-for-payout)

GatewayIDRazorpay1Cashfree2PayU3### Create a Beneficiary

[](#create-a-beneficiary)

Pre-register a beneficiary for repeated payouts:

```
use Susheelbhai\Larapay\Http\Controllers\PayoutController;

$payout = new PayoutController();

// Bank account beneficiary
$result = $payout->createBeneficiary([
    'name' => 'John Doe',
    'email' => 'john@example.com',
    'phone' => '9876543210',
    'account_type' => 'bank_account',
    'account_number' => '1234567890123',
    'ifsc' => 'HDFC0001234',
    'user_id' => $user->id,        // optional
    'user_type' => get_class($user), // optional
], $gateway_id);

// VPA beneficiary
$result = $payout->createBeneficiary([
    'name' => 'Jane Doe',
    'email' => 'jane@example.com',
    'phone' => '9876543211',
    'account_type' => 'vpa',
    'vpa' => 'jane@upi',
], $gateway_id);
```

### Initiate a Payout

[](#initiate-a-payout)

**Option A: Using a stored beneficiary**

```
$result = $payout->createPayout([
    'beneficiary_id' => $beneficiary_id,
    'amount' => 1500.00,
    'currency' => 'INR',
    'mode' => 'IMPS',      // IMPS, NEFT, UPI, RTGS
    'purpose' => 'cashback',
], $gateway_id);
```

**Option B: Inline (raw account details — beneficiary created automatically)**

```
$result = $payout->createPayout([
    'name' => 'John Doe',
    'email' => 'john@example.com',
    'phone' => '9876543210',
    'account_type' => 'bank_account',
    'account_number' => '1234567890123',
    'ifsc' => 'HDFC0001234',
    'amount' => 1500.00,
    'currency' => 'INR',
    'mode' => 'IMPS',
    'purpose' => 'commission',
], $gateway_id);
```

### Fetch Payout Status (Manual Sync)

[](#fetch-payout-status-manual-sync)

```
$result = $payout->fetchPayoutStatus($payout_record_id);
```

### Payout Webhook Setup

[](#payout-webhook-setup)

GatewayWebhook URLRazorpay`Rooturl/payout/webhook/1`Cashfree`Rooturl/payout/webhook/2`PayU`Rooturl/payout/webhook/3`Add the payout webhook to CSRF exceptions in `bootstrap/app.php`:

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->validateCsrfTokens(except: [
        'callback_url',
        'payout/webhook/*',
    ]);
})
```

### Payout Hook Methods

[](#payout-hook-methods)

After publishing, override these methods in `app/Http/Controllers/LarapayPayoutController.php` to add your business logic:

MethodWhen it's called`prePayoutMethod($data, $gateway)`Before sending payout to gateway`postPayoutMethod($data, $gatewayPayoutId, $gateway)`After gateway confirms payout creation`payoutSuccessful($payoutRecord)`When payout status becomes "processed"`payoutFailed($payoutRecord, $reason)`When payout status becomes "failed"`payoutReversed($payoutRecord, $reason)`When payout status becomes "reversed"### Payout Statuses

[](#payout-statuses)

StatusMeaning`pending`Payout created locally, not yet sent to gateway`processing`Sent to gateway, awaiting confirmation`processed`Money transferred successfully`failed`Transfer failed (see `failure_reason`)`reversed`Transfer was reversed by bank (see `reversal_reason`)### License

[](#license)

This Multi Auth Package is developed by susheelbhai for personal use software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance79

Regular maintenance activity

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Recently: every ~112 days

Total

32

Last Release

4d ago

Major Versions

v1.5.4 → v2.0.02024-12-31

v2.2.2 → v3.0.02025-06-24

v3.1.1 → v4.0.02026-06-30

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/64020920?v=4)[Susheel Kumar Singh](/maintainers/susheelbhai)[@susheelbhai](https://github.com/susheelbhai)

---

Top Contributors

[![susheelbhai](https://avatars.githubusercontent.com/u/64020920?v=4)](https://github.com/susheelbhai "susheelbhai (39 commits)")

### Embed Badge

![Health badge](/badges/susheelbhai-larapay/health.svg)

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

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

27.6k172.1k9](/packages/bagisto-bagisto)[spatie/laravel-stripe-webhooks

Handle stripe webhooks in a Laravel application

5253.5M9](/packages/spatie-laravel-stripe-webhooks)[duncanmcclean/statamic-cargo

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

3417.0k](/packages/duncanmcclean-statamic-cargo)[ph7software/ph7cms

pH7Builder. Social Dating Web App Site Builder

1.0k1.6k](/packages/ph7software-ph7cms)[verbb/formie

The most user-friendly forms plugin for Craft.

102393.6k70](/packages/verbb-formie)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k19](/packages/solspace-craft-freeform)

PHPackages © 2026

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