1.文档链接:https://docs.open.alipay.com/api_3/alipay.offline.market.shop.batchquery 2.接口作用:调用创建门店信息接口创建门店成功之后,系统商通过该接口可以查询对应APPID下所有的门店编号(支付宝口碑门店编号shop_id) 3.请求参数配置:
package com.alipay.config;
/**
* 基本信息配置
* @author wb-wly251833
* 欢迎访问支付宝论坛:https://openclub.alipay.com/index.php
*/
public class AlipayConfig {
//沙箱APPID
public static final String app_id = "2016101800718925";
//沙箱私钥
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+DTc40ODJ5b5xlwTDrXn681E7UTX7JytYTPmjrKFHceX9hQ3vxSkm0fEQ7sXoF0pOBL+7AkOIQKBgQD00qCxCSVE8x2Xb/shayGBLCumqIzHtH5Eb42Wz8AOCH2/Ns9HahzXCJfKWhEzWPltYdD34xlu4T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I29oYSSFreZ+KP29yzGHrsX8FrkOFZRsfrNMGSdbnVMgF/F/G8qmHJ3rxvANbEHf3UVTa/H9QcUvJIwyA5Ywsyj6GMqGqHiTISSMa1fIC+e6BCF+z265bxS6ZWgu4P1wIDAQAB";
//沙箱支付宝公钥
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 = "https://openapi.alipaydev.com/gateway.do";
// 服务器异步通知页面路径 需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";
// 页面跳转同步通知页面路径 需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
// 签名方式
public static String sign_type = "RSA2";
// 字符编码格式
public static String charset = "utf-8";
//参数返回格式
public static String format = "json";
}
4.接口示例
package com.alipay.demo;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayOfflineMarketShopBatchqueryRequest;
import com.alipay.api.response.AlipayOfflineMarketShopBatchqueryResponse;
import com.alipay.config.AlipayConfig;
/**
* alipay.offline.market.shop.batchquery(查询商户的门店编号列表)
*/
public class AlipayOfflineMarketShopBatchquery {
public static void main(String[] args) throws AlipayApiException {
AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, AlipayConfig.format, AlipayConfig.charset, AlipayConfig.alipay_public_key, AlipayConfig.sign_type);
AlipayOfflineMarketShopBatchqueryRequest request = new AlipayOfflineMarketShopBatchqueryRequest();
request.setBizContent("{\\"page_no\\":\\"1\\"}");
AlipayOfflineMarketShopBatchqueryResponse response = alipayClient.execute(request);
if(response.isSuccess()){
System.out.println("调用成功");
} else {
System.out.println("调用失败");
}
System.out.println(response.getBody());
}
}
请求参数说明: page_no:页码,第一页传入"1",默认500个结果为一页。此参数必须是大于0的正整数,为0时将查询报错。 返回结果:
{"alipay_offline_market_shop_batchquery_response":{"code":"10000","msg":"Success","current_pageno":1,"total_pageno":1,"shop_ids":["2017090500077000000000123588","2017031700077000000000073266"]},"sign":"USvOHO6STRMF8Y6xJ9SWX7LsuhVHTHYATTgVsjtP3eHfafkU2sNbpme+mu5Xg6ot1MUy5WZLtt7pYdPUT7i4nWT9xpB1qqQhW0eI1nN5VmdIn+KYz1KCAkoVhkXoSr7gr5aYBALx+gYi3SC/C4p//MN13qyE5AKL2NDaYHfzMpBImhpiGl0Z4XPW7E9dPDhazfejY5Iov0kHTEp724wnn4XRLGfi73+qB6scYyTXFYw5L2ELbtBsqYjlfrAONhellUsf2V3ytZZoZIvqQBHtACq9moCrI7JQJ7TeTK50f85WE0Jy6UHzzYn6qmEVcetDxUCKgVpUcOajfZ0UCHb9mA=="}
1.shop_ids:门店列表ID,逗号分隔; 2.current_pageno:当前页码 3.total_pageno:总页码数目 a.获取到shop_id后,沙箱环境可使用沙箱工具中的口碑门店账号&二维码转换工具,如下图所示,点击进入
b.将查询返回shop_id复制到文本框中,点击生成二维码
c.使用安卓手机,下载沙箱钱包,通过沙箱钱包的扫一扫功能,进入商家详情页,查看门店效果;