PHP code example of hedeqiang / payease

1. Go to this page and download the library: Download hedeqiang/payease library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hedeqiang / payease example snippets


$uri = 'serviceprovider/declaration/declare';

$params = [
    'requestId'           => time(),
    'operationType'       => 'CREATE',
    'notifyUrl'           => 'https://www.5upay.com/callback.action?test=test',
    'extendedParameters'  => 'autoReview:FALSE,sendActiveEmail:TRUE',
    'baseInfo'            => [
        'signedType'              => 'BY_SPLIT_BILL',
        'signedName'              => 'xxx',  //签约名
        'registerRole'            => 'NATURAL_PERSON',
        'signedShorthand'         => 'xxx',
        'businessAddressProvince' => '110000', //经营地址省
        'businessAddressCity'     => '110100', //经营地址市
        'businessAddressArea'     => '110106', // 经营地址区
        'businessAddress'         => '北京市', //经营地址
        'contactName'             => 'xxx', // 联系人姓名
        'contactEmail'            => '[email protected]', //联系人邮箱
        'contactPhone'            => 'xxx',// 联系人电话
        //'businessClassification'  => 'INTERNAL_TESTING_01', //业务分类
        'desireAuth'              => 'DESIRE_MOBILEINFO', //开户意愿核实类型

    ],
    'bankCardInfo'        => [
        'accountName'      => 'xxx', // 开户名称
        'bankCardNo'       => 'xxx',
        'provinceCode'     => '130000',
        'cityCode'         => '130100',
        'liquidationType'  => 'SETTLE', //清算方式
        'accountType'      => 'PRIVATE', //结算银行卡属性
        'withdrawRateType' => 'SINGLE',
    ],
    'desireAuthInfo'      => [
        'legalPersonName'    => 'xxx', //法人姓名
        'legalPersonIdNo'    => 'xxx', // 法人身份证号
        'legalPersonPhoneNo' => 'xxx', // 法人手机号
    ],
    'certificateInfo'     => [
        'legalPersonName'         => 'xxx',
        'profession'              => '1',// 法人职业
        'legalPersonIdType'       => 'IDCARD',
        'legalPersonIdNo'         => 'xxx',
        'legalIdCardProsPath'     => '/serviceprovider/TestData/111.jpg', //法人证件人像面路径
        'legalIdCardConsPath'     => '/serviceprovider/TestData/111.jpg', //法人证件国徽面路径
        'holdingIdCardPath'       => '/serviceprovider/TestData/111.jpg', //法人手持证件照
        'legalPersonBankCardPath' => '/serviceprovider/TestData/111.jpg', //法人银行卡图影印件路径
        'legalPersonPhone'        => 'xxx'
    ],
    'certificateContacts' => [
        [
            'name'   => 'xxx',
            'idType' => 'IDCARD',
            'idNo'   => 'xxx',
        ]
    ],
    'contractInfo'        => [
//                'receiverAddress' => 'c',
//                'receiverName'    => 'xxx',
//                'receiverPhone'   => 'xxx',
        'contractType'    => 'ELECTRON',
    ],
//            'paymentProfiles'    => [
//                [
//                    'paymentMode' => 'B2C',
//                    'feeType'     => 'SINGLE',
//                ]
//
//            ],
//

];

return $app->request($uri, $params);

php artisan vendor:publish --tag=payease
or 
php artisan vendor:publish --provider="Hedeqiang\PayEase\ServiceProvider"

public function index()
{
    return app('pay')->request($uri,$params);
}

use Hedeqiang\PayEase\Facades\Pay;

public function index()
{
   return Pay::pay()->request($uri,$params)
}

public function notify(Request $request)
{
   $result = Pay::pay()->handleNotify();
}

php bin/hyperf.php vendor:publish hedeqiang/payease

'components' => [
    // ...
    'pay' => [
        'class' => 'Hedeqiang\PayEase\YiiPay',
        'options' => [
            'privateKey' => '/private.pfx',
            'publicKey' => '//server.cer',
            'merchantId' => '890000593',
            'password' => '123456',
        ],
    ],
    // ...
]


Yii::$app->response->format = Response::FORMAT_JSON;

// 请求
$results = Yii::$app->pay->getPay()->request($uri,$params);
// 回调
$results = Yii::$app->pay->getPay()->handleNotify();
shell
Hedeqiang\PayEase\Pay;
$app = new Pay([
    'privateKey' => '/parth/client.pfx',
    'publicKey'  => 'path/test.cer',  // 注意: 此公钥为首信易的公钥、并非上传到商户后台的公钥!!!
    'merchantId' => '890000593',
    'password'   => '123456',
]);
shell
$uri = "onlinePay/query";
$params = [
    'merchantId' => '890000593',
    'requestId' => '1653659465'
];

$sreult = $app->request($uri,$params);