Yii2 必答支付的组件
Yii2 必答支付的组件,仅适用于必答支付
, (*1)
Installation
php composer.phar require --prefer-dist kriss/yii2-bd-payment -vvv
Basic Usage
Config
use kriss\bd\payment\Payment;
$config = [
'components' => [
Payment::COMPONENT_NAME => [
'class' => Payment::class,
'ak' => 'ak_20180110171926539048',
'sk' => 'sk_609706e2f87affb77eefe5abd799057x',
'logCategory' => 'bd-pay',
'isTest' => true,
'version' => '2.0',
]
]
]
Get Component
$payment = Payment::getInstance();
Start Pay
see PayController.php, (*2)
see OrderPayForm.php, (*3)
Handle Notify
see PayNotifyController.php, (*4)
Use More Than One Component
Create another class extend Payment
namespace common\components;
use kriss\bd\payment\Payment;
class AnotherPayment extends Payment
{
const COMPONENT_NAME = 'another-db-payment';
}
Config
use kriss\bd\payment\Payment;
$config = [
'components' => [
Payment::COMPONENT_NAME => [
'class' => Payment::class,
'ak' => 'ak_20180110171926539048',
'sk' => 'sk_609706e2f87affb77eefe5abd799057x',
'logCategory' => 'bd-pay',
'isTest' => true,
'version' => '2.0',
],
AnotherPayment::COMPONENT_NAME => [
'class' => AnotherPayment::class,
'ak' => 'ak_20180110171926539049',
'sk' => 'sk_609706e2f87affb77eefe5abd799057y',
'logCategory' => 'another-bd-pay',
'isTest' => true,
'version' => '2.0',
],
]
]
Get Component
$payment = Payment::getInstance();
$anotherPayment = AnotherPayment::getInstance();