发布日期:2024-09-25 04:26 点击次数:179
要在您的欺骗中使用支付宝灵通产物的接口才略,您需要先去蚂蚁金服灵通平台(open.alipay.com),在责罚中心中创建登记您的欺骗先锋影音bt,并提交审核,审核通事后会为您生成欺骗惟一标志(APPID),而且不错请求灵通灵通产物使用权限,通过APPID您的欺骗才智调用灵通产物的接口才略。需要详备了解灵通平台创建欺骗步调请参考《灵通平台欺骗创建指南》。
第二步:成立密钥建筑者调用接口前需要先生成RSA密钥,RSA密钥包含欺骗私钥(APP_PRIVATE_KEY)、欺骗公钥(APP_PUBLIC_KEY)。生成密钥后在灵通平台责罚中心进行密钥成立,成立完成后不错获取支付宝公钥(ALIPAY_PUBLIC_KEY)。驯服请参考《成立欺骗环境》。
第三步:搭建和成立建筑环境1. 下载干事端SDK
为了匡助建筑者调用灵通接口,咱们提供了灵通平台干事端SDK,包含JAVA、PHP和.NET三个话语版块,封装了签名&验签、HTTP接口请求等基础功能。请先下载对应话语版块的SDK并引入您的建筑工程。
各话语版块干事端SDK详备使用诠释,请参考《干事端SDK诠释》。
2. 接口调用成立
在SDK调用前需要进行启动化,来吧综合以Java代码为示举例下:
AlipayClient alipayClient = new DefaultAlipayClient(URL, APP_ID, APP_PRIVATE_KEY, FORMAT, CHARSET, ALIPAY_PUBLIC_KEY, SIGN_TYPE);
重要参数诠释:
成立参数 示例值讲授 获取阵势/示例值 URL 支付宝网关(固定) https://openapi.alipay.com/gateway.do APPID APPID 即创建欺骗青年景 获取见上头创建欺骗并获取APPID APP_PRIVATE_KEY 建筑者私钥,由建筑者我方生成 获取详见上头成立密钥 FORMAT 参数复返样式,只复旧json json(固定) CHARSET 编码集,复旧GBK/UTF-8 建筑者字据推行工程编码成立 ALIPAY_PUBLIC_KEY 支付宝公钥,由支付宝生成 获取详见上头成立密钥 SIGN_TYPE 商户生成签名字符串所使用的签名算法类型,当今复旧RSA2和RSA,推选使用RSA2 RSA2 第四步:调用接口 1、本领东谈主责罚 接口调用历程 SDK调用示例1)口碑业务授权查询接口(koubei.member.data.oauth.query )先锋影音bt
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiMemberDataOauthQueryRequest request = new KoubeiMemberDataOauthQueryRequest(); request.setBizContent("{" + " \"auth_type\":\"pay_member\"," + " \"code\":\"4b203fe6c11548bcabd8da5bb087a83b\"," + " \"ext_info\":\"{\\\"key\\\":\\\"value\\\"}\"" + " }"); KoubeiMemberDataOauthQueryResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
2)图片上传接口(alipay.offline.material.image.upload)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); AlipayOfflineMaterialImageUploadRequest request = new AlipayOfflineMaterialImageUploadRequest(); request.setImageType("jpg或mp4"); request.setImageName("海底捞"); FileItem ImageContent = new FileItem(C:/Downloads/ooopic_963991_7eea1f5426105f9e6069/16365_1271139700.jpg); request.setImageContent(ImageContent); request.setImagePid("2088021822217233"); AlipayOfflineMaterialImageUploadResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
3)创建本领东谈主接口(koubei.craftsman.data.provider.create)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiCraftsmanDataProviderCreateRequest request = new KoubeiCraftsmanDataProviderCreateRequest(); request.setBizContent("{" + " \"out_craftsman_id\":\"208801020306\"," + " \"name\":\"张三\"," + " \"account\":\"zhangsan\"," + " \"nick_name\":\"阿诺,KK.\"," + " \"avatar\":\"TxFyuus3RUW8wAeYfubM7gAAACMAAQED\"," + " \"careers\":[" + " \"发型师\"" + " ]," + " \"title\":\"资深发型总监\"," + " \"tel_num\":\"18018801880\"," + " \"career_begin\":\"2016-01-01\"," + " \"specialities\":[" + " \"烫发\",\"瑜伽\",\"有氧\"" + " ]," + " \"introduction\":\"中国好声息御用造型师,2010年获取沙宣好意思发大赛一等奖,得过沙宣好意思发学校的文凭。\"," + " \"shop_relations\":[{" + " \"shop_id\":\"2016102100077000000003441154\"," + " \"recommend_weight\":0" + " }]," + " \"auth_code\":\"6a8713a414da4a2dafdb7c24e597TX80\"" + " }"); KoubeiCraftsmanDataProviderCreateResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
4)修改本领东谈主信息接口(koubei.craftsman.data.provider.modify)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiCraftsmanDataProviderModifyRequest request = new KoubeiCraftsmanDataProviderModifyRequest(); request.setBizContent("{" + " \"craftsman_id\":\"886038\"," + " \"out_craftsman_id\":\"12345\"," + " \"nick_name\":\"阿诺,KK.\"," + " \"avatar\":\"TxFyuus3RUW8wAeYfubM7gAAACMAAQED\"," + " \"careers\":[" + " \"发型师\"" + " ]," + " \"title\":\"资深发型总监\"," + " \"tel_num\":\"18018801880\"," + " \"career_begin\":\"2016-01-01\"," + " \"specialities\":[" + " \"瑜伽\",\"有氧\"" + " ]," + " \"introduction\":\"中国好声息御用造型师,2010年获取沙宣好意思发大赛一等奖,得过沙宣好意思发学校的文凭。\"," + " \"shop_relations\":[{" + " \"shop_id\":\"2016102100077000000003441154\"," + " \"recommend_weight\":0" + " }]," + " \"auth_code\":\"6a8713a414da4a2dafdb7c24e597TX80\"" + " }"); KoubeiCraftsmanDataProviderModifyResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
5)门店纲目信息批量查询接口(alipay.offline.market.shop.summary.batchquery)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); AlipayOfflineMarketShopSummaryBatchqueryRequest request = new AlipayOfflineMarketShopSummaryBatchqueryRequest(); request.setBizContent("{" + " \"op_role\":\"ISV、PROVIDER\"," + " \"query_type\":\"BRAND_RELATION\"," + " \"related_partner_id\":\"2088001969784501\"," + " \"shop_id\":\"2015062100077000000000120773\"," + " \"shop_status\":\"PAUSED\"," + " \"page_no\":1," + " \"page_size\":20" + " }"); AlipayOfflineMarketShopSummaryBatchqueryResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
6)批量查询本领东谈主信息接口(koubei.craftsman.data.provider.batchquery)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiCraftsmanDataProviderBatchqueryRequest request = new KoubeiCraftsmanDataProviderBatchqueryRequest(); request.setBizContent("{" + " \"craftsman_ids\":[" + " \"210937\"" + " ]," + " \"out_craftsman_ids\":[" + " \"20161227\"" + " ]," + " \"shop_id\":\"2015123000077000000002414370\"," + " \"recommend\":true," + " \"page_no\":\"1\"," + " \"page_size\":\"20\"," + " \"qr_code_shop_id\":\"2016102100077000000003441154\"," + " \"auth_code\":\"6a8713a414da4a2dafdb7c24e597TX80\"" + " }"); KoubeiCraftsmanDataProviderBatchqueryResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }2、本领东谈主作品责罚 接口调用历程 SDK调用示例
7)创建本领东谈主作品接口(koubei.craftsman.data.work.create )
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiCraftsmanDataWorkCreateRequest request = new KoubeiCraftsmanDataWorkCreateRequest(); request.setBizContent("{" + " \"craftsman_id\":\"886038\"," + " \"shop_ids\":[" + " \"2016102100077000000003441154\",\"2016102100077000000003441152\"" + " ]," + " \"works\":[{" + " \"out_work_id\":\"12345\"," + " \"title\":\"长鬈发\"," + " \"media_type\":\"PICTURE\"," + " \"media_id\":\"Qt5XB8R7SMizIC2CZ_qLXAAAACMAAQED|XXwcvckbS_WcT5-mYXtY1QAAACMAAQED\"," + " \"duration\":150" + " }]," + " \"auth_code\":\"6a8713a414da4a2dafdb7c24e597TX80\"" + " }"); KoubeiCraftsmanDataWorkCreateResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
8)修改本领东谈主作品接口(koubei.craftsman.data.work.modify)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiCraftsmanDataWorkModifyRequest request = new KoubeiCraftsmanDataWorkModifyRequest(); request.setBizContent("{" + " \"work_id\":\"2016122603545559\"," + " \"title\":\"波波头造型\"," + " \"auth_code\":\"6a8713a414da4a2dafdb7c24e597TX80\"" + " }"); KoubeiCraftsmanDataWorkModifyResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
9)删除本领东谈主作品信息接口(koubei.craftsman.data.work.delete)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiCraftsmanDataWorkDeleteRequest request = new KoubeiCraftsmanDataWorkDeleteRequest(); request.setBizContent("{" + " \"craftsman_id\":\"886038\"," + " \"work_ids\":[" + " \"2016122603545559\"" + " ]," + " \"auth_code\":\"6a8713a414da4a2dafdb7c24e597TX80\"" + " }"); KoubeiCraftsmanDataWorkDeleteResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
10)批量查询本领东谈主作品接口(koubei.craftsman.data.work.batchquery)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiCraftsmanDataWorkBatchqueryRequest request = new KoubeiCraftsmanDataWorkBatchqueryRequest(); request.setBizContent("{" + " \"work_ids\":[" + " \"2016100703485664\"" + " ]," + " \"craftsman_id\":\"210937\"," + " \"page_no\":\"1\"," + " \"page_size\":\"100\"," + " \"auth_code\":\"6a8713a414da4a2dafdb7c24e597TX80\"" + " }"); KoubeiCraftsmanDataWorkBatchqueryResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }3、本领东谈主评价责罚 接口调用历程 SDK调用示例
11)批量查询评价接口(koubei.content.comment.data.batchquery)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiContentCommentDataBatchqueryRequest request = new KoubeiContentCommentDataBatchqueryRequest(); request.setBizContent("{" + " \"comment_id\":\"a8f963a718aa40f43291675706010000\"," + " \"shop_id\":\"2015123000077000000002414370\"," + " \"craftsman_id\":\"210937\"," + " \"last_comment_id\":\"a8f963a718aa40f43291675706010000\"," + " \"page_size\":20" + " }"); KoubeiContentCommentDataBatchqueryResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
12)评价回应接口(koubei.content.comment.reply.create)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiContentCommentReplyCreateRequest request = new KoubeiContentCommentReplyCreateRequest(); request.setBizContent("{" + " \"comment_id\":\"1be9a6e1e11c42ca8855049006010000\"," + " \"content\":\"感谢一直以来对我的复旧!\"," + " \"auth_code\":\"6a8713a414da4a2dafdb7c24e597TX80\"" + " }"); KoubeiContentCommentReplyCreateResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }4、用户预约历程 接口调用历程 cos足交 SDK调用示例
13)一键营销商家中心PUSH音书接口(koubei.marketing.data.message.deliver)
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); KoubeiMarketingDataMessageDeliverRequest request = new KoubeiMarketingDataMessageDeliverRequest(); request.setBizContent("{" + " \"msg_type\":\"PROMO_RECOMMEND\"," + " \"content\":\"{\\\"KEY1\\\":\\\"val1\\\",\\\"KEY2\\\":\\\"val2\\\",\\\"KEY3\\\":\\\"val3\\\"}\"," + " \"ext_info\":\"{\\\"REDIRECT_URL\\\":\\\"https://e.alipay.com\\\",\\\"CHANNEL\\\":\\\"MSGBOX\\\"}\"" + " }"); KoubeiMarketingDataMessageDeliverResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }
14)isv回传的用户操作步履信息调用接口(alipay.offline.provider.useraction.record)
该接口若何调用请参见上传用户泛行业订单API详备诠释先锋影音bt。
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2"); AlipayOfflineProviderUseractionRecordRequest request = new AlipayOfflineProviderUseractionRecordRequest(); request.setBizContent("{" + " \"action_type\":\"order_dishes\"," + " \"mobile\":\"15657153919\"," + " \"platform_user_id\":\"2014323100009\"," + " \"source\":\"koubei.com\"," + " \"industry\":\"REPAST\"," + " \"user_id\":\"2088502948051150\"," + " \"date_time\":\"2015-12-03 12:34:23\"," + " \"alipay_app_id\":\"dish-order-app-plug\"," + " \"action_detail\":\"{\\\"outer_dish_id\\\":\\\"20\\\",\\\"name\\\":\\\"红烧猪蹄\\\",\\\"price\\\":4500,\\\"quantity\\\":222}\"," + " \"outer_shop_do\":{" + " \"shop_id\":\"2016062900077000000016003316\"," + " \"outer_id\":\"2323445656fe234abc33\"," + " \"type\":\"_2dFire\"" + " }," + " \"entity\":\"user\"," + " \"action_outer_id\":\"gade3331b\"" + " }"); AlipayOfflineProviderUseractionRecordResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用得胜"); } else { System.out.println("调用失败"); }FAQ 对于此文档暂时还莫得FAQ