kriss/yii2-bd-payment

Yii2 必答支付的组件

Installs: 100

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 0

Type:yii2-extension

v2.4 2020-04-30 01:52 UTC

This package is auto-updated.

Last update: 2024-10-29 04:25:43 UTC


README

Yii2 必答支付的组件,仅适用于必答支付

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

see OrderPayForm.php

Handle Notify

see PayNotifyController.php

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();