接入指南
简介

调用接口
服务市场发送订购通知
订购通知示例
https://www.merchant.com/receive_notify.htm?notify_type=servicemarket_order_notify¬ify_id=91722adff935e8cfa58b3aabf4dead6ibe¬ify_time=2017-02-16 21:46:15&sign_type=RSA2&sign=WcO+t3D8Kg71dTlKwN7r9PzUOXeaBJwp8/FOuSxcuSkXsoVYxBpsAidprySCjHCjmaglNcjoKJQLJ28/Asl93joTW39FX6i07lXhnbPknezAlwmvPdnQuI01HZsZF9V1i6ggZjBiAd5lG8bZtTxZOJ87ub2i9GuJ3Nr/NUc9VeY=&commodity_order_id=null&order_time=null&title=null&name=null&merchant_pid=null&contactor=null&phone=null&order_item_num=null&total_price=null&biz_type=null&item_code=AM011501000000079408&specifications=套餐一&package_count=1000&period_day=180&order_ticket=201603BB189131e708054fc589c9b2b5188cdD00&service_code=00000000&isv_ticket=0ba634751542795277522707125886&consumer_miniAppId=2018112160475050&merchant_shop_id=2019081500502000000025130577&miniapp_release_bundle=1032,1096&promoter_master_name=某某服务商名称&promoter_master_pid=2088xxxxx
通知中的参数说明
参数 | 是否必传 | 描述 | 示例值 |
---|---|---|---|
commodity_order_id | 是 | 订单编号。用于订单明细回查使用,回查接口 alipay.open.servicemarket.order.query(订购插件订单明细查询)。 | |
order_time | 是 | 订购时间。 | |
title | 是 | 服务名称。 | |
name | 是 | 商户名称。 | |
merchant_pid | 是 | 商户的 UID。 | 2088XXXXX |
contactor | 是 | 联系人。 | 张XX |
phone | 是 | 联系电话。 | 13550XXXXXX |
order_item_num | 是 | 门店数。 | |
total_price | 是 | 订单价格。 | |
biz_type | 是 | 所属业务分类(例如排队)。 | |
item_code | 否 | 服务 itemCode。 | AM011501000000079408 |
specifications | 否 | 规格名称。 | 套餐一 |
package_count | 否 | 套餐数量。 | 1000 |
period_day | 否 | 订购周期(天)。 | 180 |
order_ticket | 否 | 订单授权码。 | 201603BB189131e708054fc589c9b2b5188cdD00 |
service_code | 否 | 服务码。 | 00000000 |
isv_ticket | 否 | 服务商透传的商户标识,此处回传服务商在拼接线下推广授权链接时填入的 ticket 的值。 | 0ba634751542795277522707125886 |
consumer_miniAppId | 否 | 小程序的 APPID。 | 2019112100000050 |
merchant_shop_id | 否 | 商家门店 ID。 | 2019081500502000000025130577 |
miniapp_release_bundle | 否 | 小程序发布的端信息,支持多个端时使用英文逗号分隔。 1032=支付宝,1033=钉钉,1034=高德,1050=淘宝,1051=天猫精灵,1053=香港版支付宝,1055=mPaaS,1096=支付宝 IoT,3727=阿里车。 | 1032,1096 |
promoter_master_name | 否 | 订购关联推广商主账号名称。 | 某某服务商名称 |
promoter_master_pid | 否 | 订购关联推广商主账号 PID。 | 2088XXXXX |
服务市场订单状态变更消息通知
消息示例
ISV_GATEWAY_URL?charset=GBK&biz_content=
{
"order_no":"202211220000000008715778",
"order_line_no":"202211220000000008698650",
"item_code":"AM010101000000113908",
"order_time":"2022-11-22 15:07:47.531303",
"operate_time":"2022-11-22 15:08:14.970142",
"status":"MERCHANT_CANCELLED",
"cancel_memo":"未按时实施",
"cancel_operator_type":"MERCHANT",
"cancel_time":"2022-11-22 15:08:14.970142"
}
&msg_method=alipay.open.servicemarket.order.change.notify&utc_timestamp=1516797622752&version=1.1&sign_type=RSA2¬ify_id=d275fec564e62af6bedbcee73f3f05fi5x&app_id=2013121700999429&sign=I+Y/lvqYUEEc10EPdpntRhFIQ==
消息属性
参数中文名 | 参数英文名 | 类型 | 是否必选 | 最大长度 | 描述 | 示例值 |
---|---|---|---|---|---|---|
订单编号 | order_no | String | 必选 | 24 | 订单中主订单号。 | 202211220000000008715778 |
子订单编号 | order_line_no | String | 必选 | 24 | 子订单唯一编号。 | 202211220000000008698650 |
商品 code | item_code | String | 必选 | 20 | 订购商品 code。 | AM010101000000113908 |
下单时间 | order_time | String | 必选 | 32 | 订购时间。 | 2022-11-22 15:07:47.531303 |
订单状态变更时间 | operate_time | String | 必选 | 32 | 订单状态变更操作时间,例如取消订单,取消操作时间。 | 2022-11-22 15:08:14.970142 |
订单状态 | status | String | 必选 | 32 | MERCHANT_ORDED(待服务商接单),WAIT_FOR_PAYMENT(待支付),ISV_ACCEPTED(服务商已接单),MERCHANT_CHECKING(实施待确认),CONFIRMED(订单确认),WAIT_FOR_SUBMIT_CONFIRM(下单待确认),DONE(已完成),MERCHANT_CANCELLED(商家取消),ISV_REJECTED(服务商 回绝),ISV_CANCELLED(服务商取消)。 | MERCHANT_CANCELLED |
取消原因 | cancel_memo | String | 可选 | 256 | 订单被取消时,取消原因。 | 未按时实施 |
订单取消主体 | cancel_operator_type | String | 可选 | 10 | MERCHANT:商户ISV:服务商 | MERCHANT |
订单取消时间 | cancel_time | String | 必选 | 32 | 订单被取消时的操作时间。 | 2022-11-22 15:08:14.970142 |
查询订单详情
package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenServicemarketOrderApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenServicemarketOrderApiQuery {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenServicemarketOrderApi api = new AlipayOpenServicemarketOrderApi();
String commodityOrderId = "20160010200000000033400";
String startPage = "1";
try {
AlipayOpenServicemarketOrderQueryResponseModel response = api.query(commodityOrderId, startPage);
} catch (ApiException e) {
AlipayOpenServicemarketOrderQueryDefaultResponse errorObject = (AlipayOpenServicemarketOrderQueryDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}
服务商接单
示例代码
package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenServicemarketOrderApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenServicemarketOrderApiAccept {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenServicemarketOrderApi api = new AlipayOpenServicemarketOrderApi();
AlipayOpenServicemarketOrderAcceptModel data = new AlipayOpenServicemarketOrderAcceptModel();
data.setCommodityOrderId("201604060043410106");
try {
Object response = api.accept(data);
} catch (ApiException e) {
AlipayOpenServicemarketOrderAcceptDefaultResponse errorObject = (AlipayOpenServicemarketOrderAcceptDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}
服务商拒绝接单
示例代码
package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenServicemarketOrderApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenServicemarketOrderApiReject {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenServicemarketOrderApi api = new AlipayOpenServicemarketOrderApi();
AlipayOpenServicemarketOrderRejectModel data = new AlipayOpenServicemarketOrderRejectModel();
data.setRejectReason("暂不支持该地区服务");
data.setCommodityOrderId("20160010200000000033400");
try {
Object response = api.reject(data);
} catch (ApiException e) {
AlipayOpenServicemarketOrderRejectDefaultResponse errorObject = (AlipayOpenServicemarketOrderRejectDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}
服务商取消实施服务
示例代码
package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenServicemarketOrderItemApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenServicemarketOrderItemApiCancel {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenServicemarketOrderItemApi api = new AlipayOpenServicemarketOrderItemApi();
AlipayOpenServicemarketOrderItemCancelModel data = new AlipayOpenServicemarketOrderItemCancelModel();
data.setMiniAppId("2017121800945174");
data.setCancelReason("该门店暂无法实施完成");
data.setCommodityOrderId("20160010200000000033400");
data.setShopId("2015052000077000000000182140");
try {
Object response = api.cancel(data);
} catch (ApiException e) {
AlipayOpenServicemarketOrderItemCancelDefaultResponse errorObject = (AlipayOpenServicemarketOrderItemCancelDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}
服务商完成实施服务
示例代码
package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenServicemarketOrderItemApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenServicemarketOrderItemApiComplete {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenServicemarketOrderItemApi api = new AlipayOpenServicemarketOrderItemApi();
AlipayOpenServicemarketOrderItemCompleteModel data = new AlipayOpenServicemarketOrderItemCompleteModel();
data.setMiniAppId("2017121800945174");
data.setCommodityOrderId("20160010200000000033400");
data.setShopId("2015052000077000000000182140");
try {
Object response = api.complete(data);
} catch (ApiException e) {
AlipayOpenServicemarketOrderItemCompleteDefaultResponse errorObject = (AlipayOpenServicemarketOrderItemCompleteDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}
代商家确认完成实施
示例代码
package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenServicemarketOrderItemApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenServicemarketOrderItemApiConfirm {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenServicemarketOrderItemApi api = new AlipayOpenServicemarketOrderItemApi();
AlipayOpenServicemarketOrderItemConfirmModel data = new AlipayOpenServicemarketOrderItemConfirmModel();
data.setMiniAppId("2017121800945174");
data.setCommodityOrderId("20160010200000000033400");
data.setShopId("2015052000077000000000182140");
try {
Object response = api.confirm(data);
} catch (ApiException e) {
AlipayOpenServicemarketOrderItemConfirmDefaultResponse errorObject = (AlipayOpenServicemarketOrderItemConfirmDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}
上架门店插件(口碑服务市场)
示例代码
package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenServicemarketCommodityShopApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenServicemarketCommodityShopApiOnline {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenServicemarketCommodityShopApi api = new AlipayOpenServicemarketCommodityShopApi();
AlipayOpenServicemarketCommodityShopOnlineModel data = new AlipayOpenServicemarketCommodityShopOnlineModel();
try {
Object response = api.online(data);
} catch (ApiException e) {
AlipayOpenServicemarketCommodityShopOnlineDefaultResponse errorObject = (AlipayOpenServicemarketCommodityShopOnlineDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}
下架门店插件(口碑服务市场)
示例代码
package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenServicemarketCommodityShopApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenServicemarketCommodityShopApiOffline {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenServicemarketCommodityShopApi api = new AlipayOpenServicemarketCommodityShopApi();
AlipayOpenServicemarketCommodityShopOfflineModel data = new AlipayOpenServicemarketCommodityShopOfflineModel();
data.setCommodityId("20160010200000000033400");
data.setShopId("2015052000077000000000182140");
try {
Object response = api.offline(data);
} catch (ApiException e) {
AlipayOpenServicemarketCommodityShopOfflineDefaultResponse errorObject = (AlipayOpenServicemarketCommodityShopOfflineDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}
服务商查询推广关系
示例代码
package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenServicemarketPromotiontaskRelationApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenServicemarketPromotiontaskRelationApiQuery {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenServicemarketPromotiontaskRelationApi api = new AlipayOpenServicemarketPromotiontaskRelationApi();
String commodityId = "SS010101000000003954";
Integer pageSize = 10;
Integer pageNum = 1;
try {
AlipayOpenServicemarketPromotiontaskRelationQueryResponseModel response = api.query(commodityId, pageSize, pageNum);
} catch (ApiException e) {
AlipayOpenServicemarketPromotiontaskRelationQueryDefaultResponse errorObject = (AlipayOpenServicemarketPromotiontaskRelationQueryDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}
服务市场产品授权升级
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2");
AlipayOpenServicemarketOrderUpgradeRequest request = new AlipayOpenServicemarketOrderUpgradeRequest();
request.setBizContent("{" +
" \"commodity_order_id\":\"2018071900000015585789\"," +
" \"product_codes\":[" +
" \"I1080300001000041016\"," +
" \"I1080300001000041605\"" +
" ]" +
"}");
AlipayOpenServicemarketOrderUpgradeResponse response = alipayClient.execute(request);
if(response.isSuccess()){
System.out.println("调用成功");
} else {
System.out.println("调用失败");
}
续费订单主动通知接口
示例代码
ISV_GATEWAY_URL?charset=GBK&biz_content=
{
"wait_for_renew_order_count_30_day":"1234",
"wait_for_renew_merchant_count_30_day":"10"
}
&msg_method=alipay.open.servicemarket.orderrenew.notify&utc_timestamp=1516797622752&version=1.1&sign_type=RSA2¬ify_id=d275fec564e62af6bedbcee73f3f05fi5x&app_id=2013121700999429&sign=I+Y/lvqYUEEc10EPdpntRhFIQ==
修改于 2023-11-23 08:18:41