PHP code example of evondu / wechat-php-sdk

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

    

evondu / wechat-php-sdk example snippets


//引入Composer自动加载(例如YII等PHP框架则不需要,因为框架本身已经引入)
�
$config = **",
    "merchant_id"   => "***************",
    "key"           => "***************",
]);
//调用接口
$result = $client->payment->payNative([
    "body"          => "test",
    "out_trade_no"  => time(),
    "total_fee"     => 1,
],Url::to("notify.php"));

$result = $client->payment->payNative([
    "body"          => "test",
    "out_trade_no"  => time(),
    "total_fee"     => 1,
], "notify_url");

$result = $client->payment->payMweb([
    "body"          => "test",
    "out_trade_no"  => time(),
    "total_fee"     => 1,
    "scene_info"    => json_encode([])
], "notify_url");

$result = $client->pappay->apply([
    "body"          => "test",
    "out_trade_no"  => time(),
    "total_fee"     => 1,
    "contract_id"   => "***********"
], "notify_url");

$result = $client->pappay->queryContract([
    "contract_id"   => "***********"
]);