PHP code example of nahuomall / xrtpay

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

    

nahuomall / xrtpay example snippets


        // $obj = new \Xmo\Api\Wechat(); 
        // or 
        $obj = \Hyperf\Support\make(\Xmo\Api\Wechat::class)
        
        $obj->setMchId('你的商户ID');
        $obj->setAppsecret('你的秘钥');
        // 小程序
        $res =$obj->mini->createOrder([]);
        // app
        $res =$obj->app->createOrder([]);
        // 扫码
        $res =$obj->micropay->createOrder([]);
        // 网页
        $res =$obj->wap->createOrder([]);
        
        var_dump($res);