首页
开发手册
应用中心
工具
用户中心
FoundPHP WeChat Pay
English
中文简体
English
上一篇
下一篇
#FoundPHP WeChat Pay ### FoundPHP Introduction to WeChat Pay WeChat Pay is used for mobile payment. WeChat provides a convenient payment platform that can be bound to bank cards and credit cards. Calling WeChat Pay is equivalent to using bank cards and credit cards to pay. ------------ #### 1.Configuration parameter ```php //Configuration information $config['pay']['type'] = 'wechat';//WeChat Pay $config['pay']['id'] = '';//official account APPID $config['pay']['key'] = '';//business number $config['pay']['mch_key'] = '';//Merchant key $config['pay']['sslcert'] = 'apiclient_cert.pem';//certificate $config['pay']['sslkey'] = 'apiclient_key.pem';//certificate key $config['pay']['log_file'] = $RAND_DIR."pay_logs/".dates(time(),"Y-m-d").".txt";//log file //instantiated class $FoundPHP_pay = load('class/pay/pay','FoundPHP_pay',$config['pay']); ``` #### 1.Unified order ```php //build incoming parameters $set = array( 'openid' => 'WeChat user openid', 'oid' => 'order number', 'body' => 'order title', 'attach' => 'order description', 'goods_tag' => 'product label', 'moneys' => '1', 'notify_url' => 'http://foundphp.com/pay_callback.php', 'return_url' => 'http://foundphp.com/?m=pay_demo&t=alipay', ); //create payment order $create_pay = $FoundPHP_pay->create_pay($set);//incoming array ``` ```js ``` #### 3.Order refund ```php //build incoming parameters $set = array( 'oid' => '20200529',//order number 'moneys' => '1',//order amount 'refund_moneys' => 'refund amount', 'operate_id' => 1,//operator 'notify_url' => 'asynchronous callback' //refund order $refund_pay = $FoundPHP_pay->refund_pay($set);//execute refund ```