- 进入支付宝平台添加沙盒账号
- 获取沙盒账号的私钥和公钥
获取网页支付
public static String pay(String out_trade_no,double totalAmountl,String subject,String returnUrl,String notifyUrl) {
AlipayClient alipayClient =new DefaultAlipayClient(
Config.gateway,Config.appid,Config.privateKey,"json","UTF-8",Config.publicKey,Config.gnType);
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
request.setNotifyUrl(notifyUrl);
request.setReturnUrl(returnUrl);
String bizContent = "{" +
" \"out_trade_no\":\""+out_trade_no+"\"," +
" \"scene\":\"bar_code\"," +
" \"total_amount\":"+totalAmountl+"," +
" \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," +