2017 © Pedro Peláez
 

yii2-extension yii2-payment

YII2 支付组件(支付宝支付、微信支付)

image

ixiaomu/yii2-payment

YII2 支付组件(支付宝支付、微信支付)

  • Tuesday, February 6, 2018
  • by ixiaomu
  • Repository
  • 0 Watchers
  • 3 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 25 % Grown

The README.md

支付组件

YII2 支付组件(支付宝支付、微信支付), (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist ixiaomu/yii2-payment "*"

or add, (*4)

"ixiaomu/yii2-payment": "*"

to the require section of your composer.json file., (*5)

Used || Example

//根据不同的支付方式及通道 传入不同的支付配置及支付数据, (*6)

<?= 
    use ixiaomu\payment\Pay;

    $payConfig = [ //换成自己的
        'app_id'        => 'wx69f7d561891b969d',  // 公众账号ID
        'mch_id'        => '1597082962',// 商户id
        'mch_key'           => '1n156wnp3qtihtht93y2xte7bxeoz2ub',// 秘钥
        'app_secret'    => '9e261fd174495ef81989daebfdcd9c05',
        'fee_type'      => 'CNY',// 货币类型  当前仅支持该字段
        'sslcert_path'  => Yii::getAlias('@common').'/lib/payment/wechat/cert/apiclient_cert.pem',
        'sslkey_path'   => Yii::getAlias('@common').'/lib/payment/wechat/cert/apiclient_key.pem',
        'notify_url'    => Yii::getAlias('@apiUrl').'/RestApi/v1/wechat-callback/wx-notify',
    ];

    $payData = [
         'out_trade_no'     => '12345678901', // 订单号
         'total_fee'        => '520000', // 订单金额,**单位:分**
         'body'             => '订单描述', // 订单描述
         'openid'           => 'o89PEv2vT_niCY9n5nNAsQWK4D_Q', // 支付人的 openID
    ];
    $pay = new Pay($payConfig);
    try{
        $redult = $pay->driver('wechat')->gateway('mp')->apply($payData);
        var_dump($redult);die;
    }catch (Exception $e){
        throw new Exception('支付失败:'.$e->getMessage());
    }

The Versions

06/02 2018

dev-master

9999999-dev

YII2 支付组件(支付宝支付、微信支付)

  Sources   Download

MIT

The Requires

 

by xiaomu

extension yii2

06/02 2018

V1.0.0

1.0.0.0

YII2 支付组件(支付宝支付、微信支付)

  Sources   Download

MIT

The Requires

 

by xiaomu

extension yii2

06/02 2018

v2.0.0

2.0.0.0

YII2 支付组件(支付宝支付、微信支付)

  Sources   Download

MIT

The Requires

 

by xiaomu

extension yii2

30/01 2018

V1.0.2

1.0.2.0

YII2 支付组件(支付宝支付、微信支付)

  Sources   Download

MIT

The Requires

 

by xiaomu

extension yii2

30/01 2018

V1.0.1

1.0.1.0

YII2 支付组件(支付宝支付、微信支付)

  Sources   Download

MIT

The Requires

 

by xiaomu

extension yii2

30/01 2018

V1.0

1.0.0.0

YII2 支付组件(支付宝支付、微信支付)

  Sources   Download

MIT

The Requires

 

by xiaomu

extension yii2