PHP code example of skrleo / easyphiz

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

    

skrleo / easyphiz example snippets



use PhizPay\Factory;

$config = array(
    'appid' => '6490171c3b17b00001f52197',
    'mchid' => '1900009191',
    'serial_no' => '5157F09EFDC096DE15EBE81A47057A7232F1B8E1',

    'is_debug' => true,                // 是否开启调试模式,开启的话会走测试环境
    'cert_path' => 'path/to/xxx.pem',  // XXX: 绝对路径!!!!
);

$response = Factory::Order($config)->unify(array(
    'trade_type' => 'jsapi', # jsapi| native | micropay
    'out_trade_no' => date('Ymd') . Str::random_int(13),
    'description' => 'mch_10_store_17',
    'amount' => array(
        'total' => '0.01',
        'currency' => 'BRL'
    ),
    'detail' => array(
        'goods_detail' => array(
            array(
                'merchant_goods_id' => '243',
                'quantity' => 1,
                'unit_price' => '0.01',
                'goods_name' => 'NongFuSpring'
            )
        )
    ),
    'payer' => array(
        'openid' => '589e37b9a9ca67b5e269701d3e50a2493719149c',
    ),
    'attach' => array(
        'path' => 'pages/order/detail?order_no=202405092658004622',
        'appletsId' => '6490171c3b17b00001f52197'
    )
));