davidjeddy/yii2-paypal

Yii2框架的PayPal扩展,基于Marcio Camello的原始工作分支。

安装: 928

依赖关系: 0

建议者: 0

安全: 0

星标: 4

关注者: 1

分支: 41

开放问题: 0

类型: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

Yii2的PayPal扩展

Yii 2.x的PayPal支付模块扩展

安装

通过composer将依赖添加到您的项目中(推荐)

  • composer require --prefer-dist davidjeddy/yii2-paypal "*" OR
  • "davidjeddy/yii2-paypal": "dev-master" 并运行 composer update

配置

'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,
    ]
],

使用

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;
    }
    ...
}