2017 © Pedro Peláez
 

library pay

image

fk/pay

  • Wednesday, July 18, 2018
  • by yelfive
  • Repository
  • 1 Watchers
  • 3 Stars
  • 83 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 31 Versions
  • 6 % Grown

The README.md

FK Pay

Integration of all Third Part Payment(TPP), (*1)

Configuration

# main-local.php
<?php
return [
    // other config
    'components' => [
        'pay' => [
            'class' => 'fk\pay\Component',
            'channel' => 'WeChat', // Here is default channel
            // As for different platforms, the actual notify_url will need a prefix of platform name
            // end with .php
            // e.g.
            // For WeChat, it will be `https://api.alijian.net/notify/we-chat.php`
            // The `we-chat.php` come from `WeChat`.
            // You should rewrite the server route, to fit the filename rule.
            'notifyPath' => 'https://api-test.alijian.net/notify/',
            'platforms' => [
                'WeChat' => [
                    'web' => [ // Web, a.k.a JS, a.k.a H5 payment
                        'app_id' => 'wx71xxx',
                        'app_secret' => 'xxx',
                        'mch_id' => 1234567890,
                        'key' => 'QqDAWHMgDpskKmsdjYH', // to sign
                        'ssl_cert_path' => '@common/data/cache/apiclient_cert.pem', // to refund
                        'ssl_key_path' => '@common/data/cache/apiclient_key.pem',
                    ],
                    'app' => [ // App(iOS, Android) payment
                        'app_id' => 'wxxxxx',
                        'mch_id' => 1234567890,
                        'app_secret' => '6exxx',
                        'key' => 'QqDAWHMgDpskKmsdjYH', // to sign
                        'ssl_cert_path' => '@common/data/cache/apiclient_cert.pem', // to refund
                        'ssl_key_path' => '@common/data/cache/apiclient_key.pem',
                    ]
                ],
                'AliPay' => [ // under construction
                    'name' => 'haha',
                ],
            ]
        ]
    ]
];

Pay

Transfer money from user's TPP account to your platform, (*2)

<?php
$orderSn = '2014124582620133'; // 20 bytes recommended
$amount = 1000; // Money with unit Fen(CNY), 10 Yuan
$name = 'Apple';
$description = 'Sweet Apple';
$extra = [
    'trade_type' => 'JSAPI',
    'openid' => 'o-28js7h4kd01kldfg7ag29zk3'
];
Yii::$app->pay
    ->with('WeChat') // Default defined in config file
    ->pay($orderSn, $amount, $name, $description, $extra);
Parameter Description
$orderSn Order Serial Number on your platform
$amount Money of the goods
$name Name of the goods
$description Description for the goods
$extra Extra information for the order, differs with TPP

$extra for Wechat

  • trade_type: required APP, JSAPI, NATIVE
  • openid: required when trade_type=JSAPI
  • ...: other optional params for WeChat API, see JSAPI Docs and APP Docs

$extra for AliPay

The Versions

18/07 2018

dev-dev

dev-dev

  Sources   Download

The Requires

 

18/07 2018

v3.0.16

3.0.16.0

  Sources   Download

The Requires

 

09/07 2018

v3.0.15

3.0.15.0

  Sources   Download

The Requires

 

04/07 2018

v3.0.14

3.0.14.0

  Sources   Download

The Requires

 

29/05 2018

v3.0.13

3.0.13.0

  Sources   Download

The Requires

 

29/05 2018

v3.0.12

3.0.12.0

  Sources   Download

The Requires

 

14/05 2018

v3.0.11

3.0.11.0

  Sources   Download

The Requires

 

23/04 2018

v3.0.10

3.0.10.0

  Sources   Download

The Requires

 

23/04 2018

v3.0.9

3.0.9.0

  Sources   Download

The Requires

 

20/04 2018

v3.0.8

3.0.8.0

  Sources   Download

The Requires

 

20/04 2018

v3.0.7

3.0.7.0

  Sources   Download

The Requires

 

20/04 2018

v3.0.6

3.0.6.0

  Sources   Download

The Requires

 

20/04 2018

v3.0.5

3.0.5.0

  Sources   Download

The Requires

 

18/04 2018

v3.0.4

3.0.4.0

  Sources   Download

The Requires

 

01/04 2018

v3.0.3

3.0.3.0

  Sources   Download

The Requires

 

31/03 2018

v3.0.2

3.0.2.0

  Sources   Download

The Requires

 

28/03 2018

v3.0.1

3.0.1.0

  Sources   Download

The Requires

 

28/03 2018

v3.0.0

3.0.0.0

  Sources   Download

The Requires

  • php >=5.4
  • fk/fluent *

 

31/01 2018

v2.0.11

2.0.11.0

  Sources   Download

The Requires

  • php >=5.4

 

08/01 2018

v2.0.10

2.0.10.0

  Sources   Download

The Requires

  • php >=5.4

 

28/12 2017

v2.0.9

2.0.9.0

  Sources   Download

The Requires

  • php >=5.4

 

27/12 2017

v2.0.8

2.0.8.0

  Sources   Download

The Requires

  • php >=5.4

 

20/12 2017

v2.0.7

2.0.7.0

  Sources   Download

The Requires

  • php >=5.4

 

14/12 2017

v2.0.6

2.0.6.0

  Sources   Download

The Requires

  • php >=5.4

 

14/12 2017

v2.0.5

2.0.5.0

  Sources   Download

The Requires

  • php >=5.4

 

13/12 2017

v2.0.4

2.0.4.0

  Sources   Download

The Requires

  • php >=5.4

 

12/12 2017

v2.0.3

2.0.3.0

  Sources   Download

The Requires

  • php >=5.4

 

10/12 2017

v2.0.2

2.0.2.0

  Sources   Download

The Requires

  • php >=5.4

 

10/12 2017

v2.0.1

2.0.1.0

  Sources   Download

The Requires

  • php >=5.4

 

29/11 2017

dev-master

9999999-dev

  Sources   Download

The Requires

  • php >=5.4

 

24/11 2017

v2.0.0

2.0.0.0

  Sources   Download

The Requires

  • php >=5.4