PHP code example of echosong / wxpayface

1. Go to this page and download the library: Download echosong/wxpayface 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/ */

    

echosong / wxpayface example snippets



use  Echosong\WxpayFace;
use Echosong\WxpayFace\Request;

$WxPayConfig = new WxpayFace\WxPayConfig();

/***************获取authinfo 具体参数参考官方文档****************/
$request = new Request\WxPayAuthInfo(App::payConfig());
$request->SetRawdata($rawdata);
$request->setName('测试');
$request->setStoreId('test');
$request->setDeviceId('test0002');
$result = WxpayFace\WxPayApi::authInfo($request, $WxPayConfig);
print_r($result) ;

/***************提交人脸支付 具体参数参考官方文档文档****************/
$request = new Request\WxPayFacePay(App::payConfig());
$request->SetDevice_info('***');
$request->SetBody("测试人脸支付一笔订单");
$request->SetDetail('测试支付商品');
$request->SetAttach('原样返回数据');
$request->SetOut_trade_no('112233'); //订单号
$request->SetTotal_fee(100); //单位分
$request->SetSpbill_create_ip('127.0.0.1');
$request->SetOpenId('***');
$request->SetFace_code('***');
try{
    $result = WxpayFace\WxPayApi::facepay(App::payConfig(),$request);
}catch (Exception $exception){
    var_dump($exception->getMessage());
}
var_dump($result);