Download the PHP package aminkt/yii2-payment-module without Composer

On this page you can find all versions of the php package aminkt/yii2-payment-module. 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 yii2-payment-module

Contribute on this project

If you want i will happy to use your help to improve this project. For contributing please refer to this link.

Contributing guide lines

How to install this module:

Step1: Add flowing line to require part of composer.json :

Or run bellow command :

Step2: Add flowing lines in your application config:

All time please add Mellat Bank gate in down of gates list because it may make issue in automatic gate selector. Mellat gate throw an exception when it's not available that system can not catch it so the processes may become failed. If you can fix this please contribute.

Step3: Create your own order model and implement aminkt\yii2\payment\interfaces\OrderInterface in your order model. Using order model in this module is required.

Note: Using a table as order model is an standard pattern to keep track of every thing you try to sale. refer this link to read more: http://www.databaseanswers.org/data_models/customers_and_orders/index.htm


Database Migrations

Before usage this extension, we'll also need to prepare the database.

Usage:

In your code when you want create a payment request use below code:

Use $orderModel to make a connection between your order table and payment data. by defining this you can access to your orders later from payment logs.

When users paid money, they will redirect in a page in you site that you defined. By default user will redirect to /payment/default/verify route.

For changing default call back page use below code:

Also you can set callback address globally in module configuration.

In your verify page use below code to verify payment:

$verify is false if verify action become failed and otherwise return an true.

Security

Module will check security issues and log them in yii2 log system. You can also define below attribute in payment component config to change default behavior of security system.

Attribute Default value Description
encryptKey Null Encrypt key should be safe and long to encrypt payment token and is required.
bankTimeout Null Time that system can validate bank response. Default is null. Set time in second that if user returned from bank then system accept the response. If user do not return from bank in defined time then response will not accept.
blockTime 86400 This value define if a user blocked how much should prevent action from that. If set null for ever considered. Value should be in second
allowedCredentialErrors 5 Max allowed times that a user can has credential errors

Gate configuration

Every gate has some configuration. In this module prepared some default gates that you can use.

If you want create your own gate please refer to Create gate class section.

You can contribute your gates to this report and help me to improve productivity.

List of gates:

Name Bank Contributor Configuration array
\aminkt\yii2\gates\Sep Saman Amin Keshavarz [email protected] Sep gate configuration
\aminkt\yii2\gates\MellatGate Mellat Amin Keshavarz [email protected] Mellat gate configuration
\aminkt\yii2\gates\Parsian Parsian Amin Keshavarz [email protected] Parsian gate configuration
\aminkt\yii2\gates\IranKish IranKish Amin Keshavarz [email protected] IraniKish gate configuration
\aminkt\yii2\gates\ZarinPal Zarinpal Amin Keshavarz [email protected] ZarinPal gate configuration

Create gate class

To create gate class you should create a new class in your application and extend it from \aminkt\yii2\payment\gates\AbstractGate.

Implement uncompleted methods and then use below rule to read identity data and configurations from module configuration:

As you know every gate has some configuration that user will prepare that as array. you can access this config from your gate by calling getIdentity methods.

For example if user use below configuration:

Then in CustomGate you can access below methods:

Implement your gate. see examples and if you like contribute it in this repo.

Gate configurations

Sep

MellatGate

Parsian

IranKish

ZarinPal

Reports:

In older versions you can use some routes to see some views in your backend panel for logs but in this current we improve our module to use in rest modules so you still have a route to read logs but as RESTAPI.

This part documents not complete yet.

Structure of tables and classes:


All versions of yii2-payment-module with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
yiisoft/yii2 Version ~2.0.11
ext-openssl Version *
ext-soap Version *
yiisoft/yii2-httpclient Version ~2.0.0
aminkt/exceptions Version v1.0.0.x-dev
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 aminkt/yii2-payment-module contains the following files

Loading the files please wait ....