You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
999 B
PHP
35 lines
999 B
PHP
<?php
|
|
namespace Org\Kudian;
|
|
|
|
use Org\Kudian\Request\H5PayRequest;
|
|
use Org\Kudian\Request\Request;
|
|
|
|
class Api
|
|
{
|
|
private static $client;
|
|
|
|
private static function getClient() {
|
|
if (!self::$client) {
|
|
self::$client = new Client();
|
|
}
|
|
return self::$client;
|
|
}
|
|
|
|
public static function h5Pay($orderNumber, $amount, $notifyUrl, $backUrl, $payType, $body, $clientIp) {
|
|
$request = new H5payRequest(Config::get('mch_id'), Config::get('secret_key'));
|
|
$request->setContent([
|
|
'fee' => $amount,
|
|
'out_trade_no' => $orderNumber,
|
|
'body' => $body,
|
|
'client_ip' => $clientIp,
|
|
'notify_url' => $notifyUrl,
|
|
'payment' => $payType,
|
|
'sence_info' => [
|
|
'wap_url' => 'http://www.jianghuifa.cn',
|
|
'wap_name' => '聚游',
|
|
'return_url' => $backUrl,
|
|
],
|
|
]);
|
|
return self::getClient()->request($request);
|
|
}
|
|
} |