支付
This commit is contained in:
29
extends/wechatpay/Wxpay.php
Normal file
29
extends/wechatpay/Wxpay.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace extend\wechatpay;
|
||||
|
||||
require_once APP_PATH . "extend/wechatpay/lib/WxPay.Api.php";
|
||||
require_once APP_PATH . 'extend/wechatpay/example/WxPay.NativePay.php';
|
||||
class Wxpay
|
||||
{
|
||||
/**
|
||||
* @description:
|
||||
* @param {*} $param username,money,order_no
|
||||
* @return {*}
|
||||
*/
|
||||
public function pay($param) {
|
||||
$notify = new \NativePay();
|
||||
$input = new \WxPayUnifiedOrder();
|
||||
$input->SetBody("VPS充值-".$param['username']);
|
||||
$input->SetOut_trade_no($param['order_no']);
|
||||
$input->SetTotal_fee($param['money']);
|
||||
$input->SetTime_start(date("YmdHis"));
|
||||
$input->SetTime_expire(date("YmdHis", time() + 600));
|
||||
$input->SetNotify_url("http://vps-api.juip.com/common/wxpay/wxpayverify");
|
||||
$input->SetTrade_type("NATIVE");
|
||||
|
||||
$result = $notify->GetPayUrl($input);
|
||||
|
||||
$url2 = $result["code_url"];
|
||||
return $url2;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user