app支付服务端demo分享

来自    APP支付与登录 | 
作者:我是个导演  |  更新于:2017-09-08 17:11:11     
说明:
  这两个demo是APP支付服务端的测试demo,建议大家只配置账号和密钥生成签名进行请求测试即可
 声明:demo仅做参考测试使用

JAVA demo alipaytradeapppay.zip

PHP demo  APPPay-UTF-8.zip

 注意:如果PHP demo生成请求字符串中带有“&” 请将htmlspecialchars()这个函数去掉 一定要生成以“&”符号链接的请求字符串,否则会报错ali38173

正确请求字符串
alipay_sdk=alipay-sdk-php-20161101&app_id=2016072800109035&biz_content=%7B%22out_trade_no%22%3A%22201712290251256987%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&notify_url=https%3A%2F%2Fwww.alipay.com&sign_type=RSA2&timestamp=2017-12-29+02%3A51%3A25&version=1.0&sign=HaD12RXDt8rubSpyHaN4n3KeJh3oh1KwQyQSzVg3XJGrtyvA%2BcAZVtJhyJsYwxMj17%2FNwBmF9QGOYiOQt%2FY%2FWvnt%2FwTCJ7wYByLvcxkQjaQR3dThEN3LXLzp%2FZESRPgVCIywkn%2Bk0Os6or2xG8uWljPRZekDxHGaz0ADqug9hJqxnovV1s8R%2BVf5T16DiJf8YSC%2BnXd%2FJxkWB%2Bbm8oJT1UVs5QMdw5e3LoqiQQJNYIHZbwdbkkFc41v1URwaLsdtgjZ6dH11DOE0fJsFMfAo3FbYoOuyG%2F4ZM1zqVpwWkPP0D4SC7NjIIlyv5LpsObV70nceyASd7w7G9mgjo6J3pQ%3D%3D
nicky_chin | 2017-09-13 20:29:27
3q
ii | 2017-09-18 17:24:21
感谢感谢!!!
tn | 2017-10-09 16:28:07
你好,非常感谢提供的服务端demo,我仿照demo使用沙箱测试账号 写了app手机支付的功能,但是支付宝返回给前端 报错提示: 系统繁忙,请稍后再试, 并且没有跳转到手机上安装的沙箱版的支付宝APP。我检查了密钥,appid也是和沙箱账号一致的,密钥也是我重新按照官网的步骤用工具生成的。实在是不知道哪里的原因了,请大神帮忙看看!
我是个导演 | 2017-10-09 16:48:44
tn:你好,非常感谢提供的服务端demo,我仿照demo使用沙箱测试账号 写了app手机支付的功能,但是支付宝返回给前端 报错提示: 系统繁忙,请稍后再试, 并且没有跳转到手机上安装的沙箱版的支付宝APP。我检查了密钥,appid也是和沙箱账号一...回到原帖
这个首先和你确认一下你有使用纯客户端(官方客户端demo)进行测试请求吗? 另外你可以使用我的这一份请求参数返回给你的客户端,看看是否可以正常唤起支付

alipay_sdk=alipay-sdk-php-20161101&app_id=2016072800109035&biz_content=%7B%22out_trade_no%22%3A%22201710090844153072%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&notify_url=https%3A%2F%2Fwww.alipay.com&sign_type=RSA2&timestamp=2017-10-09+08%3A44%3A15&version=1.0&sign=J30r6WaTEYVCBEEhaky266%2BLBrWOCBSmIaE4OMeRdyKnYF0ph3gX3DJY%2BKQ9t7QpDzeW%2FpA3Hx7zl8XDpwKDG4Gxypfq4oi1ptFPzQBrotXN4%2FJpLriNEpwVnrn42s3JnqthfPFJNjY4h1EgiySNLWX4gFxHXwCGq8s3zFpJlbH6zhRuM4aQYUPZuFe%2BPYR8VVJjRsvQAIIkRVytG1iRcunxH2vFqEvusLB%2BIUm83Q85lwXzEwTHIjRHyRtIY2MkmZw0O0edyzFzuGQ56dO6lIxyV%2FWu2iPQ0vTSV3PGN04jF9%2F3vmmifs1roKO8wa%2BoATCcOhfTKDDD%2F3Ooyi1GIw%3D%3D
如果可以说明服务端代码生成有问题(也可能是你的账号和密钥不匹配),您可以直接使用我这边的服务端demo,配置你的账号和密钥进行请求看看是否可以。如果上面测试以后还在报错再追问
国涛 | 2017-10-10 12:28:10
我的请求参数一直返回ALI38173 :
"alipay_sdk=alipay-sdk-php-20161101&app_id=2017092208871526&biz_content=%7B%22body%22%3A%22%5Cu6dd8%5Cu96c6%5Cu96c6%5Cu6d4b%5Cu8bd5%5Cu5546%5Cu54c1%2C%5Cu5171%5Cu4ef62%5Cu5546%5Cu54c1%22%2C%22subject%22%3A%22%5Cu6dd8%5Cu96c6%5Cu96c6%5Cu6d4b%5Cu8bd5%5Cu5546%5Cu54c1%22%2C%22timeout_express%22%3A%2230m%22%2C%22out_trade_no%22%3A%2217092612563433586359%22%2C%22total_amount%22%3A109%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%7D&charset=utf-8&format=json&method=alipay.trade.app.pay&notify_url=http%3A%2F%2Fpay.shandjj.com%2Fapi.php%2FTjjPay%2FalipayNotify&sign_type=RSA2&timestamp=2017-10-10+12%3A20%3A13&version=1.0&sign=Mmt2bkZ1d6dmb0dKiGFHbMIVC6vOPnUkvuBzGNvXDxBldKEaB6fXWajokr97dCW6JgISxn6vJvKscH7E4SwnuhTzntUrmG%2Bx3YQv5sfxcDzwKqlTHAPuKBNEzAn3w3lwlEeYDFe64Us%2FpudtSEvINueWKpN1owepEjAoVF9vv183HnQkZ11LMXkIfncpjbJMuwgFvgK%2FC%2FoPi%2Bq8%2F0cOfNaxnCF3ik48NhEqrwWnbTtT0oJl%2F7uKi552QVOWIUIe6jJzTghPHKkGCqy9FH%2BVTWR7fkjfp5ZXeqVh3sk1KcEmf%2B9VvF0MOs2k68k%2BwjvPbm6qBZfmoOv1YcmHeJW%2FhQ%3D%3D"
看了下基本格式都一致
王兰玉 | 2017-10-10 13:50:37
国涛:我的请求参数一直返回ALI38173 :
"alipay_sdk=alipay-sdk-php-20161101&app_id=2017092208871526&biz_content=%7B%22body%22%3A%22...
回到原帖
这是在你是在自己集成的代码中进行测试的把,支付请求参数应该是alipay_sdk=alipay-sdk-php-20161101&app_id=2017092208871526&biz_content=%7B%22body%22%3A%22%5Cu6dd8%5Cu96c6%5Cu96c6%5Cu6d4b%5Cu8bd5%5Cu5546%5Cu54c1%2C%5Cu5171%5Cu4ef62%5Cu5546%5Cu54c1%22%2C%22subject%22%3A%22%5Cu6dd8%5Cu96c6%5Cu96c6%5Cu6d4b%5Cu8bd5%5Cu5546%5Cu54c1%22%2C%22timeout_express%22%3A%2230m%22%2C%22out_trade_no%22%3A%2217092612563433586359%22%2C%22total_amount%22%3A109%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%7D&charset=utf-8&format=json&method=alipay.trade.app.pay&notify_url=http%3A%2F%2Fpay.shandjj.com%2Fapi.php%2FTjjPay%2FalipayNotify&sign_type=RSA2&timestamp=2017-10-10+12%3A20%3A13&version=1.0&sign=Mmt2bkZ1d6dmb0dKiGFHbMIVC6vOPnUkvuBzGNvXDxBldKEaB6fXWajokr97dCW6JgISxn6vJvKscH7E4SwnuhTzntUrmG%2Bx3YQv5sfxcDzwKqlTHAPuKBNEzAn3w3lwlEeYDFe64Us%2FpudtSEvINueWKpN1owepEjAoVF9vv183HnQkZ11LMXkIfncpjbJMuwgFvgK%2FC%2FoPi%2Bq8%2F0cOfNaxnCF3ik48NhEqrwWnbTtT0oJl%2F7uKi552QVOWIUIe6jJzTghPHKkGCqy9FH%2BVTWR7fkjfp5ZXeqVh3sk1KcEmf%2B9VvF0MOs2k68k%2BwjvPbm6qBZfmoOv1YcmHeJW%2FhQ%3D%3D这样子的,你这边却全是&,你这边先使去掉&该符号去换成&进行拼接,然后测试,如果还是报错,建议下载demo进行测试,如果demo测试报错,更换密钥重新测试,测试成功之后在使用自己集成的代码进行测试;
demo下载:https://doc.open.alipay.com/doc2/detail.htm?treeId=54&articleId=104509&docType=1
密钥生成:https://openclub.alipay.com/read.php?tid=1833&fid=25
国涛 | 2017-10-10 14:02:34
王兰玉:这是在你是在自己集成的代码中进行测试的把,支付请求参数应该是alipay_sdk=alipay-sdk-php-20161101&app_id=2017092208871526&biz_content=%7B%22body%22%3A%22...回到原帖
你好,是这样的demo代码里面最后一步有个转化,htmlspecialchars转化后就是&amp如果不转化就是&
木易 | 2017-10-11 15:14:04
我的请求参数一直返回ALI38173
alipay_sdk=alipay-sdk-java-dynamicVersionNo&app_id=2016010601069506&biz_content=%7B%22body%22%3A%22%22%2C%22out_trade_no%22%3A%22OTN16011975520035123%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22subject%22%3A%22App%E6%94%AF%E4%BB%98%E6%B5%8B%E8%AF%95Java%22%2C%22timeout_express%22%3A%2230m%22%2C%22total_amount%22%3A%220.01%22%7D&charset=utf-8&format=json&method=alipay.trade.app.pay&notify_url=http%3A%2F%2F123.56.13.75%3A17008%2Fmecv-protocol%2Feppay%2Fnotify&sign=zjfQhsEyXCS04g5%2BO8%2FNel4aEpM7wCDjoJ9lUFnHHprp2gxOJQE6KR14NMBiFMtv4zFK3DlnMJ2OejSVjdDuMjcW6TdyEIotcfBBwMIMvtBE43XzADpI3stm52m0%2FkSe0ku8NnN9n%2FUcNBn1eX5K5q0mBRBGnh2Q4kQFUYxAnno%3D&sign_type=RSA&timestamp=2017-10-11+15%3A09%3A39&version=1.0
我是个导演 | 2017-10-11 15:48:44
木易:我的请求参数一直返回ALI38173
alipay_sdk=alipay-sdk-java-dynamicVersionNo&app_id=2016010601069506&biz_content=%7B%22body%22%3A%22%...
回到原帖
建议你先使用分享的demo只配置账号和密钥生成签名请求测试一下。看看是否报错
flyant | 2017-10-25 14:44:47
求教 下了新的app支付服务端demo 发现和你示例不一样,,是修改了么???com.alipay.api.test.PublicTest.java
里写的是验签 加签之类的 没有app支付调用的方法 。。还望指教谢谢
我是个导演 | 2017-10-25 15:01:12
flyant:求教 下了新的app支付服务端demo 发现和你示例不一样,,是修改了么???com.alipay.api.test.PublicTest.java
里写的是验签 加签之类的 没有app支付调用的方法 。。还望指教谢谢
回到原帖
首先服务端请使用我的demo作为测试接口也是我demo中的名称,您看的示例是哪里的我看你参考的链接
刘家茂 | 2017-10-25 15:21:42
感谢分享
winer632 | 2017-10-30 17:37:05
你好,返回的串是这样的,app好像无法解析啊?有没有对应的客户端解析这个订单信息的例子?
alipay_sdk=alipay-sdk-php-20161101&app_id=2017091608757216&biz_content=%7B%22out_trade_no%22%3A%22201710301733231127%22%2C%22total_amount%22%3A%22690%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%2C%22subject%22%3A%22app%E5%85%85%E5%80%BC%22%2C%22timeout_express%22%3A%2290m%22%2C%22body%22%3A%22app%E5%85%85%E5%80%BC690rmb%22%7D&charset=utf-8&format=json&method=alipay.trade.app.pay&notify_url=http%3A%2F%2F115.159.218.200%3A8080%2Falipay-sdk-PHP-20170829142653%2FAsynchronousVerification.php&sign_type=RSA2&timestamp=2017-10-30+17%3A33%3A23&version=1.0&sign=dciAGd%2FkddOZ557djcqd3iDzJIUmBwduE%2B9gX0Bm7TX%2FW3P%2BW4hfN%2BPhemeq9IAmLz7x464RPIKRwPOSKlLuv04omghu%2FSODxFa6gJPSvj%2BalL9dnWZxP8g4JuSRIBdjl5PoHe9RCofpEVQHb0ib3IPYv09EPeZMp9%2B4Q3UaH4zCKMRDujZ04vTGfpOPBEF82nk4QpZM51IICKmd6kRDTNlN8goMTBuY%2FmJRk%2FL%2BZF778FVGEDETG0vjULk8Q%2BjKYKEVP%2Fs%2Bz6UkYdyZW6ih59A1xJ3yclrAXLOoZ2Yo6UzhCy57zsZllBsnEB0BDiCwJrH03qFY5qW9YyiCl3uqiQ%3D%3D
我是个导演 | 2017-10-30 17:45:58
winer632:你好,返回的串是这样的,app好像无法解析啊?有没有对应的客户端解析这个订单信息的例子?
alipay_sdk=alipay-sdk-php-20161101&app_id=2017091608757216&biz_content=%7B%...
回到原帖
(安装为例)直接传给客户端的orderinfo就可以请求支付宝进行支付了
另外这个是encode过的字符串,解析没有示例需要你自己处理了
我的回复
回复数
  83
阅读数
  13919

返回顶部