ShopSDK详细接口集成文档
如果您选择仅集成我们的ShopSDK接口,那么请确保您的加入的SDK文件夹内至少包含以下库:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Required -MOBFoundation.framework – 基本依赖库,并提供ShopSDK所需要的基本的用户系统 ShopSDK -ShopSDK.framework – ShopSDK业务接口库 MOBPaySDK -MOBPaySDK.framework – 支付模块接口库 -Channels – 支付平台SDK |
上述三个模块可理解为基本用户模块,商城业务模块和支付模块。此三个模块共同组成了完成的商城业务,缺一不可。下面我们将逐一介绍
(一)基本用户模块
商城的业务需要用户系统支持,在此我们首先推荐您使用UMSSDK。
如果您已经有自己的用户系统,则需要使用MOBFoundation.framework 实现用户的标记和登陆。
使用方法:
在您自己的用户系统实现的登陆获取到您的用户对象后,通过以下方法设定User:
1)导入头文件:
1 2 3 |
#import <MOBFoundation/MobSDK.h> [MobSDK setUserWithUid:@"YourUserId" nickName:@"YourUserName" avatar:@"YourUserAvatar" userData:nil]; |
注:请确保在使用ShopSDK的业务接口前完成上述设置,否则部分需要用户身份的接口会无法使用(例如获取收货地址列表)。
(二) 支付模块
商城的业务需支付模块支持,支付模块请直接集成MOBPaySDK即可。
使用方法:
项目中包含有MOBPaySDK即可,无需添加任何代码。
温馨提示:请确认mob后台已经开启支付服务并配置相关支付信息。Xcode项目请配置对应平台URL Scheme及白名单
(三)商城业务模块
商城的业务模块完全依赖于ShopSDK.framework
以下列表将对ShopSDK.framework中各个具体的小模块及各接口进行说明
描述中若有*则代表此接口需要用户系统支持
全局配置 | |
接口 | 描述 |
[ShopSDK queryTransportCompanyResult:] | 物流公司查询 |
[ShopSDK getArea:] | 获取省市区详细信息 |
[ShopSDK getTransportStrategy: | 获取商品列表配送策略 |
[ShopSDK getLabelsWithNumb:result:] | 获取商品列表产品标签 |
[ShopSDK getOrderCustomField:] | 获取订单自定义字段 |
用户相关 | |
接口 | 描述 |
[ShopSDK createShippingAddress:result:] | 创建收货地址* |
[ShopSDK modifyShippingAddressWithId: address:result:] | 修改收货地址* |
[ShopSDK getShippingAddress:] | 查询收货地址* |
[ShopSDK deleteShippingAddress:result:] | 删除收货地址信息* |
商品相关 | |
接口 | 描述 |
[ShopSDK getProductsWithKeyword:
minPrice:maxPrice: transportStrategyId:labelIdList: timeSort:priceSort:salesSort:pageSize :pageIndex:result:] |
产品列表查询接口 |
[ShopSDK getProductDetailWithProductId:result:] | 产品详情查询接口 |
[ShopSDK getCommodityDetailsWithProduct:result:] | 商品详情查询接口 |
[ShopSDK addCommentWithOrder:comments:result:] | 添加商品评论* |
[ShopSDK getCommentsWithProductId:level:
commentStars: hasPicture:pageSize: pageIndex:result:] |
获取产品评论接口 |
商品相关(购物车) | |
接口 | 描述 |
[ShopSDK addIntoShoppingCartWithCommodityId:
count:result:] |
添加到购物车*(若未设定user仍可使用,以匿名用户身份;当设定user后会自动将匿名的购物车列表合并到设定的user当中) |
[ShopSDK getShoppingCartItems:] | 获取购物车列表*(若未设定user仍可使用,以匿名用户身份;当设定user后会自动将匿名的购物车列表合并到设定的user当中) |
[ShopSDK modifyShoppingCartItemAmount:result:] | 修改购物车商品数量*(若未设定user仍可使用,以匿名用户身份;当设定user后会自动将匿名的购物车列表合并到设定的user当中) |
[ShopSDK deleteFromShoppingCart:result:] | 购物车删除指定商品*(若未设定user仍可使用,以匿名用户身份;当设定user后会自动将匿名的购物车列表合并到设定的user当中) |
商品相关(辅助接口) | |
接口 | 描述 |
[ShopSDK commodityWithProperties:product:] | 商品筛选
一个产品下有多个规格(属性)组成了商品。本方法提供便捷功能,通过选中的商品属性以及产品,帮助筛选出唯一的商品 |
[ShopSDK filterProperties:propertyKey:product:] | 商品筛选 – 确认商品可选属性 |
订单相关 | |
接口 | 描述 |
[ShopSDK preOrderWithAddressId:
commodityList:couponList: enableCoupon:result:] |
预订单提交* |
[ShopSDK createOrderWithPreOrder:buyerRemark:result:] | 创建订单* |
[ShopSDK modifyOrderStatus:order:result:] | 修改订单状态(订单取消/删除/确认收货)* |
[ShopSDK getOrdersWithKeyWord:OrderStaus:
pageSize:pageIndex:result:] |
根据 订单状态/关键字 查询订单* |
[ShopSDK getOrdersStatisticInfo:] | 获取各订单状态统计数据* |
[ShopSDK getOrderDetailWithOrderId:result:] | 获取单个订单详情* |
[ShopSDK queryExpressWithTransportId:result:] | 查询物流信息* |
支付模块 | |
接口 | 描述 |
[ShopSDK payWithOrder:payType:result:] | 支付订单* |
[ShopSDK queryOrderTradingResultWithOrder:
clientPayStatus:result:] |
订单交易结果查询* |
退换货相关 | |
接口 | 描述 |
[ShopSDK refundPreviewWithOrderCommodityId: result:] | 预申请退款接口* |
[ShopSDK refundWithOrderCommodityId:result:] | 退款申请* |
[ShopSDK cancelRefundWithOrderCommodityId:result:] | 取消退款* |
[ShopSDK getRefundsWithKeyWord:pageSize:pageIndex:result:] | 查询退款商品列表* |
[ShopSDK getRefundDetailWithOrderCommodityId:result:] | 查看退款商品详情* |
[ShopSDK fillInExpressInfoWithOrderCommodityId:operationType:
transportId:expressCompanyId:result:] |
退款物流信息添加/修改操作* |
优惠券相关 | |
接口 | 描述 |
[ShopSDK getCouponsWithStatus:pageSize:pageIndex:result:] | 获取优惠券列表信息(已领取,已属于用户的优惠券) |
[ShopSDK receiveCoupon:result:] | 领取优惠券 |
[ShopSDK getReceivableCouponsWithPageSize:pageIndex:result:] | 获取可领取的优惠券列表 |
[ShopSDK getUsableCouponWithCommodityList:result:] | 根据订单商品列表查询可用的优惠券 |
注:详细的接口参数,请直接参考头文件<ShopSDK/ShopSDK.h>的注释说明