支付宝Demo报错

来源:11-4 支付宝支付功能官方Demo调试实操1(知识点补充)

慕仙7100758

2020-07-06

七月 06, 2020 9:34:45 下午 com.alipay.demo.trade.config.Configs init
信息: 配置文件名: zfbinfo.properties
七月 06, 2020 9:34:45 下午 com.alipay.demo.trade.config.Configs init
信息: Configs{支付宝openapi网关: https://openapi.alipaydev.com/gateway.do
, 支付宝mcloudapi网关域名: http://mcloudmonitor.com/gateway.do
, pid: 2088102181130931
, appid: 2016102600763998
, 商户RSA私钥: MIIEvg******tPHsGp
, 商户RSA公钥: MIIBIj******IDAQAB
, 支付宝RSA公钥: MIIBIj******IDAQAB
, 签名类型: RSA2
, 查询重试次数: 5
, 查询间隔(毫秒): 5000
, 撤销尝试次数: 3
, 撤销重试间隔(毫秒): 2000
, 交易保障调度延迟(秒): 5
, 交易保障调度间隔(秒): 900
}
七月 06, 2020 9:34:45 下午 com.alipay.demo.trade.service.impl.AbsAlipayTradeService tradePrecreate
信息: trade.precreate bizContent:{“out_trade_no”:“tradeprecreate159404248508085093”,“seller_id”:"",“total_amount”:“0.01”,“undiscountable_amount”:“0”,“subject”:“xxx品牌xxx门店当面付扫码消费”,“body”:“购买商品3件共20.00元”,“goods_detail”:[{“goods_id”:“goods_id001”,“goods_name”:“xxx小面包”,“quantity”:1,“price”:“10”},{“goods_id”:“goods_id002”,“goods_name”:“xxx牙刷”,“quantity”:2,“price”:“5”}],“operator_id”:“test_operator_id”,“store_id”:“test_store_id”,“extend_params”:{“sys_service_provider_id”:“2088100200300400500”},“timeout_express”:“120m”}
七月 06, 2020 9:34:47 下午 com.alipay.api.internal.util.AlipayLogger logBizError
严重: 2020-07-06 21:34:47_{“alipay_trade_precreate_response”:{“code”:“40002”,“msg”:“Invalid Arguments”,“sub_code”:“isv.invalid-signature”,“sub_msg”:“验签出错,建议检查签名字符串或签名私钥与应用公钥是否匹配,网关生成的验签字符串为:alipay_sdk=alipay-sdk-java-3.3.0&app_id=2016102600763998&biz_content={“out_trade_no”:“tradeprecreate159404248508085093”,“seller_id”:”",“total_amount”:“0.01”,“undiscountable_amount”:“0”,“subject”:“xxx品牌xxx门店当面付扫码消费”,“body”:“购买商品3件共20.00元”,“goods_detail”:[{“goods_id”:“goods_id001”,“goods_name”:“xxx小面包”,“quantity”:1,“price”:“10”},{“goods_id”:“goods_id002”,“goods_name”:“xxx牙刷”,“quantity”:2,“price”:“5”}],“operator_id”:“test_operator_id”,“store_id”:“test_store_id”,“extend_params”:{“sys_service_provider_id”:“2088100200300400500”},“timeout_express”:“120m”}&charset=utf-8&format=json&method=alipay.trade.precreate&sign_type=RSA2&timestamp=2020-07-06 21:34:45&version=1.0"},“sign”:“DH5GgiHj4wg0oTkvQxhJCUeJTg8egSrxHVJIjINQP0B+UKF2IkLVTLaWUM0efiVuZVxSqCMm6gQNvN3Qmyg4EjHkTC9RSejTmb8z7PY0ZonqemZXkEfczYZUOjAdDnHpGnzCJtWF0m9VkCUHe6i5f2FL9ZZ32ReHSRHmJoiA7Yg1j2s0ygeGkOMmV/5q/LpvX2FLRbH49rXzkG4rTicAILSuHnLPDxT2e5Fo90LU8WY35g8UKfqF1j7XgN04Bu+AFNER5YLqTk0mhfCZ/c1eOTi9hXNAYpwPnvQZFeDLw5hjhuafyPN2KZa/I3AQnJsAabrgZ5ox1NykSS0kj5cx8Q==”}_941ms,741ms,nullms
com.alipay.api.AlipayApiException: com.alipay.api.AlipayApiException: sign check fail: check Sign and Data Fail!
at com.alipay.api.AbstractAlipayClient._execute(AbstractAlipayClient.java:412)
at com.alipay.api.AbstractAlipayClient.execute(AbstractAlipayClient.java:103)
at com.alipay.api.AbstractAlipayClient.execute(AbstractAlipayClient.java:90)
at com.alipay.api.AbstractAlipayClient.execute(AbstractAlipayClient.java:84)
at com.alipay.demo.trade.service.impl.AbsAlipayService.getResponse(AbsAlipayService.java:32)
at com.alipay.demo.trade.service.impl.AbsAlipayTradeService.tradePrecreate(AbsAlipayTradeService.java:102)
at com.alipay.demo.trade.service.impl.AlipayTradeServiceImpl.tradePrecreate(AlipayTradeServiceImpl.java:1)
at com.alipay.demo.trade.Main.test_trade_precreate(Main.java:426)
at com.alipay.demo.trade.Main.main(Main.java:101)
Caused by: com.alipay.api.AlipayApiException: sign check fail: check Sign and Data Fail!
at com.alipay.api.AbstractAlipayClient.checkResponseSign(AbstractAlipayClient.java:517)
at com.alipay.api.AbstractAlipayClient._execute(AbstractAlipayClient.java:400)
… 8 more
七月 06, 2020 9:34:47 下午 com.alipay.demo.trade.Main test_trade_precreate
严重: 系统异常,预下单状态未知!!!

写回答

1回答

geelylucky

2020-07-07

同学,报错显示验签失败,仔细看一下支付宝稳定,注意验签的细节,这一块很容易犯错误:https://opendocs.alipay.com/apis


0
0

从0开始 独立完成企业级Java电商网站服务端开发

前后端分离,数据库接口设计,架构设计,功能开发,上线运维

9476 学习 · 8804 问题

查看课程