Download the PHP package krzysztof-gzocha/payu without Composer

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

PayU Integration

This library written in PHP will allow easily integration with PayU API v2.1.
Works with PHP version >=5.4 and HHVM.
Build Status

Installation by composer


To install this library simply add requirement to composer.
You can do this by

or simply add this to composer.json:

and run

Basic usage


1. Configuration

Default configuration's object is , but any object that implements will do the job. Most of the configuration parameters are already defined, you only have to set credentials (merchant ID and private key) taken from PayU. Test account credentials are already defined in , so if you just want to test the appllication you can use this class.

Configuration with test credentials:

Configuration with real credentials:

2. Create basic order object

Please remember that orders created by those examples are not configured enough. Some required parameters like OpenPayU-Signature, totalAmount, customerIp, etc are still missing. You can add them automatically, but it will be described in another chapter. Both examples are describing the most basic configuration. Order created by both examples are equal.

2.1 Using order object from library

Order object in this library is by default represented by , but anything that implements will work. This chapter is about creating this object, but if you are integrating this library with currently working application you can do this work automatically with annotations described in chapter below.

Example order with single product:

2.2 Using annotations

You don't need to create another order object if you already have one in your application. You will just have to put single annotation on methods that returns useful parameters. Lets say you have your own order class called and product class called . Annotation can be set on public, protected or private methods. You can add annotation in presented way:

All property names can be found at . It's worth to mention that one of the annotation is especially useful in complicated architecture. It's called annotation. If you have to collect required parameters from different, connected entities you can use this annotation. Result of this method will be passed through this transformer again.

Now to create order object you have to use UserOrderTransfomer, which will literally transform your's object for library purposes. To do so you can use this example:

3. Order parameters auto-completion

You are not left alone when it comes to fulfill other required parameters like signature. To do so you can use this code:

4. Inform PayU about new order

To inform PayU about our new order you have to send OrderCreateRequest with correctly build object, check HTTP status code of the response, deserialize the response to OrderCreateResponse object, check if request status is and redirect user to given URL. Here is an example how to use RequestProcess:

5. Retrieve order from PayU

Retrieving info is similar process to creating new order. You can use the same RequestProcess, but with different Request object. Example:

6. Order cancel request

You can send to PayU request that will say "cancel this order". To do so you can use RequestProcess described above. If you will pass to it and object of and initialize it with with parameter then you will cancel the order. In this case RequestProcess will return . You can see it's parameters in documentation. Please note that parameter is status of the request, not order!

7. Process notification about order

PayU can inform you about any changes in your order. To use this mechanism you simply need to define . PayU will send notification directly to this URL. In action defined in notify URL you have to parse JSON string of the notification and check for the order status. To do so you can use NotificationProcess.

Important

Please note that PayU will send notification in asynchronous way, so when you will receive notification about completing or cancelling order then you should ignore all later notifications.

Running tests

To run tests locally you have to install the library via composer with parameter. This will install Codeception framework which is helping with unit tests. Codeception is using helpers, but they are not in this library. You can build them by using - now you are all set. Now you can use to run unit tests or to generate code coverage report. This library was built using Phing so you can use or .

Actual code coverage report can be found at krzysztof-gzocha.github.io/payu/coverage.

Contributing

All pull requests are welcome and appreciated :)

License

License MIT available in license.txt.


All versions of payu with dependencies

PHP Build Version
Package Version
Requires doctrine/annotations Version >=v1.1
jms/serializer Version >=0.11.0
symfony/validator Version >=2.0.4
psr/log Version 1.0.*@dev
php Version >=5.4.0
ext-curl Version *
kriswallsmith/buzz Version 0.13
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 krzysztof-gzocha/payu contains the following files

Loading the files please wait ....