davidjeddy/yii2-paypal The PayPal extension for the Yii2 framework, forked from Marcio Camello's original work.

Badges

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;
    }
    ...
}
0 0
1 follower
131 downloads
Yii Version: 2.0
License: BSD-3-Clause
Category: Others
Developed by: David J Eddy
Created on: Apr 10, 2018
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions