我做的是 PC端 即时支付功能 app支付也是验签失败
下面是log 公钥 跟支付宝的也对过了,没错 ,支付宝存在 常量里 是字符串
下载的是官方demo 文件名 create_direct_pay_by_user-JAVA-UTF-8
2017-03-31 17:48:55,918 -[oow] DEBUG [com.ccytsoft.print.controller.pc.PCPayController] - PC支付宝通知begin
2017-03-31 17:48:55,919 -[oow] WARN [com.ccytsoft.print.controller.pc.PCPayController] - PC支付宝返回的参数:{buyer_id=2088222418696224, trade_no=2017033121001004220257704126, body=3D打印产品订单支付, use_coupon=N, notify_time=2017-03-31 17:48:55, subject=3D社区打印, sign_type=RSA, is_total_fee_adjust=N, notify_type=trade_status_sync, out_trade_no=149095371184485, gmt_payment=2017-03-31 17:48:55, trade_status=TRADE_SUCCESS, discount=0.00, sign=Nw4QqZmEjt/9ckExEDGSsy+lile+KyOX37VTPsoWZ/9YXlg7i4i8hMeQgW1JuskwLdc9+COCkJYJZ4mJwHDfKAN650yrspT5hh5+hT8pBqKHdU7D6ja+Xc2cP/rSz7BDULMiMsOSPBzuPgByHR0eE+s5GwQeaBRj5Ic5Bi8o0L0=, buyer_email=13522750075, gmt_create=2017-03-31 17:48:42, price=0.01, total_fee=0.01, quantity=1, seller_id=2088521368967515, notify_id=f1ca74b30a68ee7c6e928ddd8f0587bhp6, seller_email=china3d.club@outlook.com, payment_type=1}
2017-03-31 17:48:55,921 -[oow] DEBUG [com.ccytsoft.utils.ali.AlipayNotify] - 校验签名begin
2017-03-31 17:48:55,921 -[oow] DEBUG [com.ccytsoft.utils.ali.AlipayNotify] - 拼接要验证的URL
2017-03-31 17:48:55,921 -[oow] DEBUG [com.ccytsoft.utils.ali.AlipayNotify] - 获取远程服务器ATN结果
2017-03-31 17:48:56,458 -[oow] DEBUG [com.ccytsoft.utils.ali.AlipayNotify] - 获取远程服务器ATN结果准备返回
2017-03-31 17:48:56,458 -[oow] WARN [com.ccytsoft.utils.ali.AlipayNotify] - 带校验的参数:body=3D打印产品订单支付&buyer_email=13522750075&buyer_id=2088222418696224&discount=0.00&gmt_create=2017-03-31 17:48:42&gmt_payment=2017-03-31 17:48:55&is_total_fee_adjust=N¬ify_id=f1ca74b30a68ee7c6e928ddd8f0587bhp6¬ify_time=2017-03-31 17:48:55¬ify_type=trade_status_sync&out_trade_no=149095371184485&payment_type=1&price=0.01&quantity=1&seller_email=china3d.club@outlook.com&seller_id=2088521368967515&subject=3D社区打印&total_fee=0.01&trade_no=2017033121001004220257704126&trade_status=TRADE_SUCCESS&use_coupon=N
2017-03-31 17:48:56,458 -[oow] DEBUG [com.ccytsoft.utils.ali.SignUtils] - 新签名生成开始begin
2017-03-31 17:48:56,459 -[oow] WARN [com.ccytsoft.utils.ali.AlipayNotify] - 校验签名的结果:false
2017-03-31 17:48:56,459 -[oow] DEBUG [com.ccytsoft.utils.ali.AlipayNotify] - 签名校验结果:false
2017-03-31 17:48:56,459 -[oow] DEBUG [com.ccytsoft.print.controller.pc.PCPayController] - PC准备插入数据库数据
我觉我太聪明了,原因是我用的支付宝公钥是自己账户中的支付宝公钥,网站上的支付宝公钥 跟支付宝 demo的支付宝公钥 不一样,然而用demo的公钥就可以验证成功。由此可知 每个人的支付宝的支付公钥应该是同一个。又有新发现 网站的支付宝公钥是app验签时用的,即时支付 用的是demo中的支付宝公钥