支付宝退费接口参数无效怎么回事?

发布于 2022-09-06 02:21:36 字数 1545 浏览 28 评论 0

String appid = AlipayServiceEnvConstants.APP_ID;

    String privateKey = AlipayServiceEnvConstants.PRIVATE_KEY;
    String publicKey = AlipayServiceEnvConstants.ALIPAY_PUBLIC_KEY;
    AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",appid,privateKey,"json","UTF-8",publicKey,"RSA2");
//    AlipayClient alipayClient = AlipayAPIClientFactory.getAlipayClientRSA2();
    AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
    String bizContent = "{" +
            "\"out_trade_no\":"+outTradeNo+"," +
            "\"trade_no\":"+tradeNo+"," +
            "\"refund_amount\":"+money+"," +
            "\"refund_reason\":\"正常退款\"," +
            "\"out_request_no\":\"\"," +
            "\"operator_id\":\"\"," +
            "\"store_id\":\"\"," +
            "\"terminal_id\":\"\"}";
    request.setBizContent(bizContent);
    logger.info(bizContent);
    AlipayTradeRefundResponse response = null;
    try {
        response = alipayClient.execute(request);

}

总是报{"alipay_trade_refund_response":{"code":"40004","msg":"Business Failed","sub_code":"ACQ.INVALID_PARAMETER","sub_msg":"参数无效"},"sign":"M7bgiWLh6zdWKMZtsE/Y3rZUwoDu8DIyZtDOXEupGFQNOyIjhxpWMs6Kzh0rIcPVvII/3e1x5AhhJVMdMYwrZ+qpeaUTUxpvC4zxD3KOW0xlN1IWz+cJY7f5hmzdIFjmDOs5gAqE+3piEjVNnNAybDBquiGwXXoz0caRttH+l1WogNE6FjRK2wcvxB6G4fu9flopj6dv6L1Ss2corefXUyQtqvM8rPbQQHWvijFQClLZHEwf6W4plFf7ig5q5Rd6aibuoaLCPTi1GF925MTo/V5T6QEp4yAFrLSl5JO3Nzh9kgqQcU+4YBLliMXoRAC+hx+2GXrl17WZ2ePM26oqDA=="}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烟─花易冷 2022-09-13 02:21:36

钱都已经付了,哪儿有退的道理。

無心 2022-09-13 02:21:36

检查一下请求参数,肯定哪个请求字段赋值不正确。
蚂蚁金服的文档中,看能不能帮上你。https://doc.open.alipay.com/d...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文