报错原因
1.请求appid应用未上线
2.签约权限问题
3.签名类型使用错误
4.请求参数问题
5.秘钥匹配问题
正确请求参数示例如下↓↓↓
alipay_sdk=alipay-sdk-php-1101&app_id=072800109035&biz_content=%7B%22out_trade_no%22%3A%2212290251256987%22%2C%22total_amount%22%3A0.01%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22subject%22%3A%22app%E6%B5%8B%E8%AF%95%22%7D&charset=utf-8&format=json&method=alipay.trade.app.pay¬ify_url=https%3A%2F%&sign_type=RSA2×tamp=-12-29+02%3A51%3A25&version=1.0&sign=HaD12RXDt8rubSpyHaN4n3KeJh3oh1KwQyQSzVg3XJGrtyvA%2BcAZVtJhyJsYwxMj17%2FNwBmF9QGOYiOQt%2FY%2FWvnt%2FwTCJ7wYByLvcxkQjaQR3dThEN3LXLzp%2FZESRPgVCIywkn%2Bk0Os6or2xG8uWljPRZekDxHGaz0ADqug9hJqxnovV1s8R%2BVf5T16DiJf8YSC%2BnXd%2FJxkWB%2Bbm8oJT1UVs5QMdw5e3LoqiQQJNYIHZbwdbkkFc41v1URwaLsdtgjZ6dH11DOE0fJsFMfAo3FbYoOuyG%2F4ZM1zqVpwWkPP0D4SC7NjIIlyv5LpsObV70nceyASd7w7G9mgjo6J3pQ%3D%3D
注:.net的SDK生成的请求支付串是没有alipay_sdk=这个头的 商户生成请求字符串直接使用就可以不要自己拼接上alipay_sdk= 否则会报错ALIN10146
最新推荐自查方案!!!
请各位开发者可以安装该帖中的apk进行测试一下看看是否可以唤起支付宝钱包支付:/read.php?tid=7695&fid=60
自查流程
1.appid 应用未上线,应用必须是“已上线”状态才可以调用
检查方法:登录这个地址【点击登录】查看我的应用》调用app支付接口的appid应用是否“已上线”(如下图)
2.权限自查
1)如何查询自己权限:/read.php?tid=2025&fid=72
2)查看是否已经添加app支付功能包:/read.php?tid=1671&fid=72
3.签约类型自查
1月5号 之后创建的应用签名类型请使用RSA2【详情查看公告】
请把配置sign_type=RSA2
4.请求参数请严格按照app支付请求参数进行请求。
如果您报错这个错误,建议只传必传参数进行测试或者使用官方客户端demo测试先保证账号和密钥没有问题
1).java和php app支付demo:/read.php?tid=2376&fid=60
2).官方客户端demo测试demo:https://docs./54/104509
5.秘钥匹配问题
建议参考这个帖子验证公钥的正确性: /read.php?tid=1486&fid=46
沙箱账号查看地址:/platform/appDaily.htm?tab=info
如下是沙箱测试用账号密钥,大家可以直接用我的沙箱账号进行测试,判断是否是因为密钥问题导致的报错,为了防止有些开发会直接拿我的密钥放到正式环境使用,造成安全隐患,我就不把公钥放出来给大家了:
//沙箱APPID
public static final String app_id = "101800718925";
//沙箱私钥
public static final String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDfDBUJhaw46ck8MHccIBXPt2USOvCRZ0dQNZZwC0EmZvcnL2+NUyoJMbgcV3U5o6wApajkpibf9UkrtYgI3/GZhOgzfzH0IJYAXmYCEniM+Cl5ipIWhY0W/s+uNRGNdXvNlketNNcVqAvkKZdcHz23N60BXsvjdR+BJ/np2CUmr9OCv0aqqwOO190rOuZvVaFCJD5LDmvDFdXPzrJHcOAyYjb2hhJIWt5n4o/b3LMYeuxfwWuQ4VlGx+s0wZJ1udUyAX8X8byqYcnevG8A1sQd/dRVNr8f1BxS8kjDIDljCzKPoYyoaoeJMhJIxrV8gL57oEIX7PbrlvFLplaC7g/XAgMBAAECggEAI4m/SFceC6tkPszSDY8nKoNj/TWa4u/7stH2+D8y0DWTp5CtS202w2RCm3Fr4hUr8KZ0dInso75nPCmeVRupWPaOMLZRdT5D6CciRa4/uuZHZXAouqHoywMqf+1AsLNJWIZbQUOsCW1PB7mAvlLT+H9Md21tOv6MWH3QGewwbytEcri0YkzroQDso3P08xdZDpXtrmg34tLnrNhw+gl8LOtpkbd0SOrGAsoTAE1vTbSLtTR2PAW7RQZkyKW1ansouzwduamFMhTc+DTc40ODJ5b5xlwTDrXn681E7UTX7JytYTPmjrKFHceX9hQ3vxSkm0fEQ7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LwKBgD/SoAnlZfrq7Unwvjlw2+YTT5dCOHamONb43TxQrGzPx68YeIFPVKnyGcZoPs/YIduQOUcXnK/UOInjl4eoLIrC7TtCJm0h61W0V2pOEh10o/vW7UOMgBcCPus5sy+21D7eElBltKBV3n8GtM6WQwwFmcc8QKjXj2j0iIADlArRAoGBAPM8kqdFHQUEDhCbk1CZR4H/hStI1DERFQYvQkIGyvIhf4Q5gN+AeM9CQpFhLBqI4kt0u9mSQV8a2fEaMCRqi7jWR1AA/nhM46AYWTiH59kdAaNlAGQHuqcBEc6jhBFS8gRMRFd/qpA8CHsMeJYIRQkKcITukjVo+KaUoF4e1wLL
//支付宝公钥
public static final String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnVuBUzhfo7kWUN/TS/kHmb4afsAlUVaTR3U5e74V0os1bzlfvh+cpwnwzaEIb36CR1OzeIIzXgARIW/zGAL1/PLG8dFEXQOIGkA0a8YXGVNX9KeWnFCnCQ5gQxrfJ3ryasXzWBxv5bex1VrVsQ2TZ1VdUD+S7dR4SWFHvyck8/xGt3Hz5peUqo/OIlfQpoTBXdqfnJNrTVAMqcQhrIWwgpSVgmUq+UhlZsDaiUvxWWFm9v9nY172jFfzup/DIET//OpIghL6AB2F+ywkCcHdZHiGklnpNoQKQ6XMVKaO/k2nlHU64Y4WGSgJnSG6B798ohZoi3pndrVPAH5+5BKEFQIDAQAB";
//沙箱网关地址
public static final String gatewayUrl = "/gateway.do";
注:如果大家用我的沙箱账号测试是成功的,但是用自己的账号密钥测试失败,要么是密钥问题,要么是没签约或者没添加功能包,针对这几点做检查即可。
如果还是报错,请提供测试环境(正式或沙箱)+开发语言+appid+请求时间+请求参数一份