PHP code example of musnow / payjs

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

$xslt

 [
    'MerchantID' => '',                      //商户号
    'MerchantKey' => '',                     //密钥
    'NotifyURL' => 'https://www.baidu.com/', 
    //notify地址 接收微信支付异步通知的回调地址。必须为可直接访问的URL,不能带参数、session验证、csrf验证。留空则不通知 需要保留最后的斜杠
];

$payjs = new \Musnow\Payjs\Pay($config);

$data = [
    'TotalFee' => 1,          //金额,单位 分
    'Body' => '测试订单',       //订单标题
    'Attach' => '测试订单',    //用户自定义数据,在notify时会原样返回
    'outTradeNo' => time(),   //商户订单号,需要保证唯一
];

$ret = $payjs->qrPay($data);  //扫码支付
print_r($ret);                //返回数据