qq_37203372
qq_37203372
2017-08-31 08:49

支付宝退款退款成功返回信息后校验sign报错

  • 支付宝

发送给支付宝之后返回的信息是正确的,可是报com.alipay.api.AlipayApiException: com.alipay.api.AlipayApiException: sign check fail: check Sign and Data Fail!错误
try {
//实例化客户端
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", AlipayConfig.app_id, AlipayConfig.private_key_RSA2, "JSON", AlipayConfig.input_charset, AlipayConfig.public_key_RSA2, "RSA2");
//实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.open.public.template.message.industry.modify
AlipayTradeRefundRequest req = new AlipayTradeRefundRequest ();
Map map = new HashMap();
map.put("out_trade_no",order.getOrderId());
map.put("refund_amount",order.getBackMoney().doubleValue());
map.put("out_request_no",order.getBackId());
JSONObject jsonObject = JSONObject.fromObject(map);
//SDK已经封装掉了公共参数,这里只需要传入业务参数
//此次只是参数展示,未进行字符串转义,实际情况下请转义
req.setBizContent(jsonObject.toString());
AlipayTradeRefundResponse response = alipayClient.execute(req);
//调用成功,则处理业务逻辑
System.out.println("返回结果"+response.toString());
if(response.isSuccess()){
return true;
//.....
}

    }catch (Exception e){
        log.error("alipay backPayInfo",e);
    }
    return false;
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐

换一换