https://opendocs.alipay.com/open/02np93
// Clientpublic function createAopClient(){$aop = new \AopClient();$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';$aop->appId = 'APPID';$aop->rsaPrivateKey = '私钥';$aop->alipayrsaPublicKey = '公钥';$aop->apiVersion = '1.0';$aop->signType = 'RSA2';$aop->postCharset = 'UTF-8';$aop->format = 'json';return $aop;}// 支付public function alipayTradeWapPayRequest(){$aop = $this->createAopClient();$request = new \AlipayTradeWapPayRequest();$info = ['body' => 'xxx','subject' => '标题',// 商户网站唯一订单号,自定义的订单号'out_trade_no' => time().rand(1111,9999),'total_amount' => 1];$info = json_encode($info, JSON_UNESCAPED_UNICODE);$request->setNotifyUrl('异步通知的URL');$request->setReturnUrl('同步返回URL');$request->setBizContent($info);//这里和普通的接口调用不同,使用的是sdkExecute$result = $aop->pageExecute($request);}// 回调验签public function checkSign($param = []){$app = new \AopClient();$app->alipayrsaPublicKey = '公钥';$res = $app->rsaCheckV1($param, '私钥', 'RSA2');return $res;}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号