davidjeddy/yii2-paypal

The PayPal extension for the Yii2 framework, forked from Marcio Camello's original work.

This package's canonical repository appears to be gone and the package has been frozen as a result.

Installs: 928

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 41

Open Issues: 0

Type:yii2-extension

0.4.0 2016-11-02 03:52 UTC

This package is auto-updated.

Last update: 2020-06-05 09:29:33 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads

SensioLabsInsight

PayPal extension for the Yii2

PayPal payment module extension for Yii 2.x

Installation

Add the dependancy to your project via composer (recommended)

  • composer require --prefer-dist davidjeddy/yii2-paypal "*" OR
  • "davidjeddy/yii2-paypal": "dev-master" and run composer update

Configuration

'paypal'=> [
    'class'        => 'davidjeddy\Paypal',
    'clientId'     => 'you_client_id',
    'clientSecret' => 'you_client_secret',
    'isProduction' => false,
    // These properties would be found in the Paypal sdk_config.ini
    'config'       => [
        'http.ConnectionTimeOut' => 30,
        'http.Retry'             => 1,
        'mode'                   => \davidjeddy\Paypal::MODE_SANDBOX, // development (sandbox) or production (live) mode
        'log.LogEnabled'         => YII_DEBUG ? 1 : 0,
        'log.FileName'           => '@runtime/logs/paypal.log',
        'log.LogLevel'           => \davidjeddy\Paypal::LOG_LEVEL_FINE,
    ]
],

Usage

Class Someclass
{
    ...
    /**
     * [pay description]
     * 
     * @param  array  $paramData [description]
     * @return [type]            [description]
     */
    private function pay(array $paramData) {
        $paypalComponent = new Paypal();

        try {
            return $paypalComponent->execTransaction($paramData);
        } catch (Exception $ex) {
            echo PaypalError($e);
        }

        return flase;
    }
    ...
}