PHP对APP支付宝支付异步回调的处理

1、接收支付宝异步通知参数

这里以 thinkphp5 为例

$params = $this->request->post();
2、验证签名是否正确
// 如果支付成功
if (!empty($params) && $params['trade_status'] == 'TRADE_SUCCESS') {
	// 验证签名
	$aop = new AopClient();
	$aop->alipayrsaPublicKey = ''; // 你的支付宝公钥
	// 此处反转义fund_bill_list参数中的字符,否则验签不通过
	$params['fund_bill_list'] = htmlspecialchars_decode($params['fund_bill_list']);
	$checkSign = $aop->rsaCheckV1($params, null, 'RSA2');
	if ($checkSign) {
		// 验证通过
		//……
		echo 'success'; // 必需返回且只能返回success
	}
}
发布了22 篇原创文章 · 获赞 16 · 访问量 1546

猜你喜欢

转载自blog.csdn.net/ZhangJiWei_2019/article/details/103717673