PHP code example of ifeiwu / mbdpay-php

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

    

ifeiwu / mbdpay-php example snippets




$client = new Pagepan\MbdPayClient(MBDPAY_APP_ID, MBDPAY_APP_KEY);

// 完整的例子:example/wxjs.php

$openid = $_GET['openid'];

if ( ! $openid )
{
    $openid_url = $client->openid('http://192.168.31.2/mbdpay-php/example/wxjs.php');

    echo '<script>location.href="' . $openid_url. '";</script>';
}
else
{
    // ......
}

// 完整的例子:example/wxjs.php

$res = $client->wxjs($openid, 1, '产品说明', 'http://192.168.31.2/mbdpay-php/callback_url.php');

// 完整的例子:example/wxh5.php
 
$res = $client->wxh5(1, '产品说明');

// 完整的例子:example/alipay.php
  
echo $client->alipay('http://192.168.31.2/mbdpay-php/callback_url.php', 1, '产品说明', );

// 完整的例子:example/refund.php

$res = $client->refund('xxxxxxxxxxxxxxxxxxx');

// 完整的例子:example/order.php

$res = $client->order('xxxxxxxxxxxxxxxxxxx');

composer