PHP code example of musnow / alipayf2f

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

    

musnow / alipayf2f example snippets

$xslt

use \Musnow\AlipayF2F\Pay;

,    //应用appid
    'notifyUrl'     => 'https://www.baidu.com',                      //异步通知地址

    //应用私钥
    // !!!注意:如果是文件方式,文件中只保留字符串,不要留下 -----BEGIN RSA PRIVATE KEY----- 这种标记
    'rsaPrivateKey' => ''
];

$alipay = new Pay($config);

$data = [
    'outTradeNo' => uniqid(),     //商户订单号,需要保证唯一
    'totalFee' => 0.01,           //订单金额,单位 元
    'orderName' => '测试订单',      //订单标题
];

$ret = $alipay->qrPay($data);     //扫码支付

print_r($ret);                    //返回数据
$xslt
$config = [
    'ssl' => false
];