2017 © Pedro Peláez
 

library zarinpal

transaction request system for zarinpal

image

zarinpal/zarinpal

transaction request system for zarinpal

  • Sunday, February 4, 2018
  • by RTLer
  • Repository
  • 4 Watchers
  • 19 Stars
  • 3,005 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 12 Forks
  • 3 Open issues
  • 18 Versions
  • 15 % Grown

The README.md

zarinpal-composer-library

Build Status StyleCI Coverage Status, (*1)

transaction request library for zarinpal, (*2)

usage

installation

composer require zarinpal/zarinpal, (*3)

request

use Zarinpal\Zarinpal;

$zarinpal = new Zarinpal('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
$zarinpal->enableSandbox(); // active sandbox mod for test env
// $zarinpal->isZarinGate(); // active zarinGate mode
$results = $zarinpal->request(
    "example.com/testVerify.php",          //required
    1000,                                  //required
    'testing',                             //required
    'me@example.com',                      //optional
    '09000000000',                         //optional
    [                          //optional
        "Wages" => [
            "zp.1.1"'=> [
                "Amount"'=> 120,
                "Description"'=> "part 1"
            ],
            "zp.2.5"'=> [
                "Amount"'=> 60,
                "Description"'=> "part 2"
            ]
        ]
    ]
);
echo json_encode($results);
if (isset($results['Authority'])) {
    file_put_contents('Authority', $results['Authority']);
    $zarinpal->redirect();
}
//it will redirect to zarinpal to do the transaction or fail and just echo the errors.
//$results['Authority'] must save somewhere to do the verification

verify

use Zarinpal\Zarinpal;

$zarinpal = new Zarinpal('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
$authority = file_get_contents('Authority');
echo json_encode($zarinpal->verify('OK', 1000, $authority));
//'Status'(index) going to be 'success', 'error' or 'canceled'

laravel ready

this package is going to work with all kinds of projects, but for laravel i add provider to make it as easy as possible. just add (if you are using laravel 5.5 or higher skip this one):, (*4)

'providers' => [
    ...
    Zarinpal\Laravel\ZarinpalServiceProvider::class
    ...
]

to providers list in "config/app.php". then add this to config/services.php, (*5)

'zarinpal' => [
    'merchantID' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
    'zarinGate' => false,
    'sandbox' => false,
],

and you are good to go (legacy config still works) now you can access the zarinpal lib like this:, (*6)

use Zarinpal\Laravel\Facade\Zarinpal;

$results = Zarinpal::request(
    "example.com/testVerify.php",          //required
    1000,                                  //required
    'testing',                             //required
    'me@example.com',                      //optional
    '09000000000',                         //optional
    [                          //optional
        "Wages" => [
            "zp.1.1" => [
                "Amount" => 120,
                "Description" => "part 1"
            ],
            "zp.2.5" => [
                "Amount" => 60,
                "Description" => "part 2"
            ]
        ]
    ]
);
// save $results['Authority'] for verifying step
Zarinpal::redirect(); // redirect user to zarinpal

// after that verify transaction by that $results['Authority']
Zarinpal::verify('OK',1000,$results['Authority']);

The Versions

04/02 2018

dev-master

9999999-dev

transaction request system for zarinpal

  Sources   Download

GPL2 GPL-2.0-only

The Requires

 

The Development Requires

by hooman naghiee

04/02 2018

dev-add-code-of-conduct-1

dev-add-code-of-conduct-1

transaction request system for zarinpal

  Sources   Download

GPL-2.0-only

The Requires

 

The Development Requires

by hooman naghiee

31/01 2018

v1.3.2

1.3.2.0

transaction request system for zarinpal

  Sources   Download

GPL-2.0-only

The Requires

 

The Development Requires

by hooman naghiee

31/01 2018

dev-analysis-qo6bpP

dev-analysis-qo6bpP

transaction request system for zarinpal

  Sources   Download

GPL-2.0-only

The Requires

 

The Development Requires

by hooman naghiee

31/01 2018

v1.3.0

1.3.0.0

transaction request system for zarinpal

  Sources   Download

GPL-2.0-only

The Requires

 

The Development Requires

by hooman naghiee

31/01 2018

v1.3.1

1.3.1.0

transaction request system for zarinpal

  Sources   Download

GPL-2.0-only

The Requires

 

The Development Requires

by hooman naghiee

17/01 2018

v1.2.4

1.2.4.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

19/11 2017

dev-analysis-Xa0E40

dev-analysis-Xa0E40

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

19/11 2017

v1.2.3

1.2.3.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

26/10 2017

v1.2.2

1.2.2.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

26/10 2017

v1.2.1

1.2.1.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

26/10 2017

v1.2.0

1.2.0.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

24/11 2016

v1.1.4

1.1.4.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

26/06 2016

v1.1.3

1.1.3.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

16/06 2016

v1.1.2

1.1.2.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

09/06 2016

v1.1.1

1.1.1.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

03/05 2016

v1.1.0

1.1.0.0

transaction request system for zarinpal

  Sources   Download

GPL2

The Requires

 

The Development Requires

by hooman naghiee

01/07 2015

v1.0.0

1.0.0.0

transaction request system for zarinpal

  Sources   Download

GPL2

by hooman naghiee