作者 魏强

支付回掉

... ... @@ -16,6 +16,9 @@ class IndexController extends HomeBaseController
protected $abc;
public function index()
{
echo cache('test');
var_dump(cache('message'));
var_dump(cache('reqInfo'));
return $this->fetch(':index');
}
}
... ...
... ... @@ -125,9 +125,9 @@ class PayController extends HomeBaseController
$app = new Application($this->options);
$payment = $app->payment;
//使用商户订单号退款 PS.其他形式参考文档
$orderNo = "2018080210097519";//商户系统内部的订单号(out_trade_no)
$orderNo = "2018080397100101";//商户系统内部的订单号(out_trade_no)
$refundNo = cmf_get_order_sn();//退款单号
$result = $payment->refund($orderNo, $refundNo, 100, 80); // 总金额 100, 退款 80,refundFee可选(为空时全额退款)
$result = $payment->refund($orderNo, $refundNo, 1, 1); // 总金额 100, 退款 80,refundFee可选(为空时全额退款)
var_dump($result);
}
... ... @@ -146,11 +146,11 @@ class PayController extends HomeBaseController
* 退款结果回调
*/
public function refundNotify() {
cache('test',123123);
$app = new Application($this->options);
$response = $app->payment->handleRefundNotify(function ($message, $reqInfo, $fail) {
$response = $app->payment->handleRefundNotify(function ($message, $reqInfo) {
cache('message',$message);
cache('reqInfo',$reqInfo);
cache('fail',$fail);
// 其中 $message['req_info'] 获取到的是加密信息
// $reqInfo 为 message['req_info'] 解密后的信息
// 你的业务逻辑...
... ...