body = array( 'orderCode' => 'Y20181204170925675836', 'totalAmount' => '000000000101', //代表1.01元 'subject' => '1.01商品', 'body' => '1.01商品', 'payMode' => 'sand_alipay', 'payExtra' => array( 'subAppid' => 'wx86466ERH8461', 'userId' => 'oEl4G1XFFERHIHSXS63P-_09y', ), 'clientIp' => '127.0.0.1', 'notifyUrl' => 'http://192.168.22.171/sandpay-qr-phpdemo.bak', 'frontUrl' => 'http://192.168.22.171/sandpay-qr-phpdemo.bak', ); // 返回结果 $ret = $client->request('orderPay'); echo '
';
print_r($ret);
echo '';
}
// 订单查询
public function orderQuery()
{
$client = new AliLife;
// 参数, 每次需要重新赋值
$client->body = array(
'orderCode' => '2017091551423473', //订单号
'extend' => ''
);
// 返回结果
$ret = $client->request('orderQuery');
echo '';
print_r($ret);
echo '';
}
// 退款申请
public function orderRefund()
{
$client = new AliLife;
// 参数
$client->body = array(
'orderCode' => 'Y20181204170925675836', //新的订单号
'oriOrderCode' => '2017091551421977', //原订单号
'refundAmount' => '000000000012', //退款金额
'refundMarketAmount' => '000000000012', //退营销金额
'notifyUrl' => 'http://192.168.22.171/sandpay-qr-phpdemo.bak/test/dist/notifyUrl.php',
'refundReason' => 'test',
'extend' => ''
);
// 返回结果
$ret = $client->request('orderRefund');
echo '';
print_r($ret);
echo '';
}
// 异步通知通用接口
public function notify()
{
// 实例化客户端
$client = new AliLife;
$sign = $_POST['sign']; //签名
$data = stripslashes($_POST['data']); //支付数据
// 验签
try {
$verifyFlag = $client->verify($data, $sign);
if (!$verifyFlag) throw new Exception('签名失败');
} catch (\Exception $e) {
exit('签名失败');
}
// 回调数据
echo '';
print_r($data);
echo '';
}
// 对账单申请接口
public function clearfileDownload()
{
// 实例化客户端
$client = new AliLife;
// 参数
$client->body = array(
'clearDate' => '20200611', // 结算日期
'fileType' => '1', // 文件返回类型
'extend' => ''
);
// 返回值
$ret = $client->request('clearfileDownload');
echo '';
print_r($ret);
echo '';
}
}
$test = new Test();
// $test->orderPay();
// $test->orderQuery();
// $test->orderRefund();
// $test->clearfileDownload();