Download the PHP package xgrz/payu without Composer

On this page you can find all versions of the php package xgrz/payu. 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 payu

Laravel PayU plugin by xGrz

This package handles: Payments, Refunds and Payouts.

Requirements

This package requires queue, scheduler and cache configured in your Laravel project.

Installation

Install package via composer, publish config and run migrations:

Update your .env file with:

Please fill all values with your PayU account settings. You can leave it without values when you want to use PayU public sandbox (same functions are limited). If you want to use all functions you can use personal sandbox account.

Using personal sandbox for testing is recommended. See what features are limited in the table below.

Features Public sandbox Personal sandbox Production
Payments Available Available Available
Refunds Available Available Available
Payouts No* Available Available
Payment methods No* Available Available
Account balance No* Available Available
Select payment method while creating transaction No* Available Available

(*) All unavailable features are limited by PayU API, not by package.

If you are running in personal sandbox or production environment you should manually run:

This method will run automatically in Laravel scheduler (every day) for payment methods synchronizing with local database (performance reason).

Create payment

We provide a TransactionWizard facade for easier payment creation. There are some helpers too: Products, Product, Buyer, (Address|PostalBox). Wizard and helper object's can be created by new CLASS_NAME($args) or CLASS_NAME::make($args);

For example lets create Buyer:

Every transaction requires only Products and description to be sent to Api, however for better user experience we suggest to provide at least Buyer too.

Prepare transaction with TransactionWizard:

Optional you can add visible description (visible at PayU payment site):

Once your transaction wizard is completed you can send it to PayU:

If payment method fail PayUGeneralException will be thrown, otherwise Transaction model will be returned.

From transaction model you can get payment link ($transaction->link) to PayU payment site. If you are not redirecting user automatically to PayU and you want to give link for user please notice to display it in blade as unescaped data {!! $transaction->link !!}. Displaying link as escaped will broke link parameters and transaction will not work.

Transaction model stores current status in $transaction->status enum. It is updated in background when notification webhook is received from PayU system. Notifications are signed with secure keys. Any data manipulations are not allowed by webhook controller. Incoming notifications has middleware that checks is request ip is on whitelist too.

Handling payment

Payment status is updated by notification webhook. PayU allows you to get manual or auto-accept payments for each payment method individually. You can set it in PayU panel (sandbox panel too).

When automatic accept is turned on you should get COMPLETED or CANCELED status depends on user transaction status. In case of manual accepting you will get WAITING_FOR_CONFIRMATION status. In that case you can ACCEPT or REJECT payment.

$transaction is eloquent model returned from PayU::createPayment($transactionWizard); method.

Refunds

When transaction is completed you can make a refund to this transaction.

To start new refund you can write:

If you accidentally refunded wrong amount you have some time to cancel refund (see Config section). While refund has status INITIALIZED or SCHEDULED you can delete it by calling:

Refund status is automatically updated by notification webhook. Important! If someone defines refund in PayU panel it will appear on list when is completed.

Configuration

In installation section we have published config. You can find it in config directory (Laravel default path is /config) - please search payu.php.

Default configuration is given in this config file. In jobs section you can configure delays for sending/retrying refunds and payouts (values are in seconds). It is recommended to give at least 60 seconds delay on sending refunds/payouts. This time is given to admin in case of wrong amount given in form.

transaction_method_check is retrieving payment method of transaction (not available for public sandbox api).

As payouts are not notified by webhook our plugin will periodically check status od payouts. Fill free to set your on status check interval much longer then default.


All versions of payu with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^10.0|^11.0
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 xgrz/payu contains the following files

Loading the files please wait ....