支付宝扫码支付

有问题加我qq1374394031

 public function alipay()
  {
    Vendor('alipay.AopSdk');
	Vendor("alipay.aop.AopClient");
	vendor('alipay.aop.request.AlipayTradePagePayRequest');
	//构造参数  
	$aop = new \AopClient ();  
	$aop->gatewayUrl ='https://openapi.alipaydev.com/gateway.do'; //该地址为沙箱环境
	//'[https://openapi.alipay.com/gateway.do](https://openapi.alipay.com/gateway.do)'; 该地址为真实环境
	$aop->appId = '商户id';  
	$aop->rsaPrivateKey = '';
	$aop->alipayrsaPublicKey = "";
	$aop->apiVersion = '1.0';  
	$aop->signType = 'RSA2';  
	$aop->postCharset= 'utf-8';  
	$aop->format='json';  
	$request = new \AlipayTradePagePayRequest ();  
	$request->setReturnUrl('https://www.baidu.com'); 
	//$url="http://" . $_SERVER['HTTP_HOST'] ."/index/index/setNotify";
	//$request->setNotifyUrl($url);  
	$request->setBizContent('{"product_code":"FAST_INSTANT_TRADE_PAY","out_trade_no":"201503200101010048","subject":"Iphone6 16G","total_amount":"0.01","body":"Iphone6 16G"}');

	//请求  
	$result = $aop->pageExecute ($request);

	//输出  
	echo $result;
   
  }

猜你喜欢

转载自blog.csdn.net/qq_43632766/article/details/86526242