Download the PHP package susheelbhai/larapay without Composer

On this page you can find all versions of the php package susheelbhai/larapay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package larapay

��# Larapay | Multiple Payment Gateway for Laravel Application

## Installation

### 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

### Vendor Publish

Publish all the required files using the following command

`

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

`

### Add credientials in .env file

`

php artisan larapay:initial_settings

`

### Migrate database

Migrate databse tables and seed with the following commands

`

php artisan migrate

`

## Complete step in single action

`

composer require susheelbhai/larapay

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

php artisan larapay:initial_settings

php artisan migrate

`

## Uses

### Add a form inside your view file

`

<form action="{{ route('pay') }}" method="post">

@csrf

<input name="action_url" type="hidden" value="{{ route('dashboard') }}" />

<input name="redirect_url" type="hidden" value="" />

<input name="gateway" type="hidden" value="{{ config('payment.gateway_id') }}" />

<input name="amount" type="hidden" value="{{ 100*1.18 }}"/>

<input name="gstpercentage" type="hidden" value="{{ $gstpercentage ?? 18}}"/>

<input name="button" type="submit" title="Pay Now" />

</form>

`

## .env variables

ENABLEPAYMENTRESPONSE -> 0 or 1

0 it will wait for webhook to respond

1 it will directly respond if callback responce received

PAYMENT_TEMPLATE -> blade or react

bassed on the starter kit you are using

## Setting up webhook

#### Razorpay

Rooturl/webhook/2

#### Phonepe V1

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

#### Phonepe V2

Rooturl/webhook/6

#### Cashfree

Rooturl/webhook/7

#### PayU

Rooturl/webhook/8

## 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

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.

| variable | value | description |

|------------ |-------- |---------|

| $payment_id | int | this 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 refund |

## 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

`

# Default payout gateway

PAYOUT_GATEWAY=razorpay

# Razorpay X Payouts

RAZORPAYPAYOUTKEY_ID=

RAZORPAYPAYOUTKEY_SECRET=

RAZORPAYPAYOUTACCOUNT_NUMBER=

RAZORPAYPAYOUTWEBHOOK_SECRET=

# Cashfree Payouts

CASHFREEPAYOUTCLIENT_ID=

CASHFREEPAYOUTCLIENT_SECRET=

CASHFREEPAYOUTWEBHOOK_SECRET=

# PayU Payouts

PAYUPAYOUTMERCHANT_ID=

PAYUPAYOUTMERCHANT_SALT=

PAYUPAYOUTCLIENT_ID=

PAYUPAYOUTCLIENT_SECRET=

PAYUPAYOUTWEBHOOK_SECRET=

`

### Gateway IDs (for payout)

| Gateway | ID |

|-----------|-----|

| Razorpay | 1 |

| Cashfree | 2 |

| PayU | 3 |

### Create a Beneficiary

Pre-register a beneficiary for repeated payouts:

`php

use Susheelbhai\Larapay\Http\Controllers\PayoutController;

$payout = new PayoutController();

// Bank account beneficiary

$result = $payout->createBeneficiary([

'name' => 'John Doe',

'email' => 'john@example.com',

'phone' => '9876543210',

'accounttype' => 'bankaccount',

'account_number' => '1234567890123',

'ifsc' => 'HDFC0001234',

'user_id' => $user->id, // optional

'usertype' => getclass($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

Option A: Using a stored beneficiary

`php

$result = $payout->createPayout([

'beneficiaryid' => $beneficiaryid,

'amount' => 1500.00,

'currency' => 'INR',

'mode' => 'IMPS', // IMPS, NEFT, UPI, RTGS

'purpose' => 'cashback',

], $gateway_id);

`

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

`php

$result = $payout->createPayout([

'name' => 'John Doe',

'email' => 'john@example.com',

'phone' => '9876543210',

'accounttype' => 'bankaccount',

'account_number' => '1234567890123',

'ifsc' => 'HDFC0001234',

'amount' => 1500.00,

'currency' => 'INR',

'mode' => 'IMPS',

'purpose' => 'commission',

], $gateway_id);

`

### Fetch Payout Status (Manual Sync)

`php

$result = $payout->fetchPayoutStatus($payoutrecordid);

`

### Payout Webhook Setup

| Gateway | Webhook URL |

|-----------|-------------|

| Razorpay | 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:

`php

->withMiddleware(function (Middleware $middleware) {

$middleware->validateCsrfTokens(except: [

'callback_url',

'payout/webhook/*',

]);

})

`

### Payout Hook Methods

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

| Method | When 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

| Status | Meaning |

|--------|---------|

| 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

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


All versions of larapay with dependencies

PHP Build Version
Package Version
Requires razorpay/razorpay Version 2.*
stripe/stripe-php Version ^10.16
cashfree/cashfree-pg Version 4.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package susheelbhai/larapay contains the following files

Loading the files please wait ...