文档中心 > API类目 > pos交易api

alibaba.pos.item.get (商品扫码获取商品接口)

pos线下交易商品扫码接口

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
shop_id Number 必须 1000847028 门店id
code_reader_req CodeReaderRequest 必须 扫码请求
  • └ source
  • String
  • 必须
  • hema
  • 请求来源
  • └ shop_id
  • String
  • 必须
  • 1000847028
  • 门店id
  • └ code_value
  • String
  • 必须
  • 010100213193
  • 码值
  • └ machine_id
  • String
  • 必须
  • 1234
  • pos机id
  • └ business_type
  • String
  • 必须
  • 1
  • 业务类型
  • └ code_type
  • String
  • 必须
  • DISCOUNT
  • 码类型
  • └ merchant_code
  • String
  • 必须
  • ISV01
  • 商家编码
  • └ buyer_id
  • Number
  • 可选
  • 3726022084
  • 买家id
  • └ code_extra
  • String
  • 可选
  • {"DISCOUNT":[{"type":"1","codeValue":"YH01010021319380","discount":80}]}
  • 扩展信息

响应参数

名称 类型 示例值 描述
result PosResult result
  • model
  • CodeReaderRespDto
  • model
  • asset
  • AssetDto
  • 资产信息
  • └ extra
  • String
  • {}
  • 额外属性
  • └ status
  • String
  • 1
  • 状态
  • └ title
  • String
  • 提货券
  • 名称
  • └ code
  • String
  • TH6579766967839
  • 码值
  • └ type
  • String
  • VOUCHER
  • 资产类型:提货券等
  • buy_item
  • BuyItemDto
  • 商品信息
  • └ title
  • String
  • 测试商品
  • 全称
  • └ short_name
  • String
  • 测试商品
  • 简称
  • └ pic_url
  • String
  • 主图
  • └ price
  • Number
  • 10
  • 原价
  • └ promotion_price
  • Number
  • 8
  • 优惠价
  • └ total_fee
  • Number
  • 总价
  • └ item_weight
  • String
  • 单品重量
  • └ inv_unit
  • String
  • 库存单位
  • └ sale_unit
  • String
  • 销售单位
  • └ weight
  • Boolean
  • 是否称重
  • └ shop_id
  • String
  • 门店Id
  • └ bar_code
  • String
  • 商品条码
  • └ out_sku_id
  • String
  • 商品编码
  • └ extra
  • String
  • 扩展属性
  • └ inv_quantity
  • String
  • 库存单位数量
  • └ buy_quantity
  • Number
  • 销售单位数量
  • └ sku_id
  • Number
  • skuId
  • └ item_id
  • Number
  • itemId
  • └ is_weight
  • Boolean
  • false
  • 是否是称重商品
  • └ msg_code
  • String
  • msgCode
  • └ msg_info
  • String
  • msgInfo
  • └ is_success
  • Boolean
  • true
  • success

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaPosItemGetRequest req = new AlibabaPosItemGetRequest();
req.setShopId(1000847028L);
AlibabaPosItemGetRequest.CodeReaderRequest obj1 = new AlibabaPosItemGetRequest.CodeReaderRequest();
obj1.setSource("hema");
obj1.setShopId("1000847028");
obj1.setCodeValue("010100213193");
obj1.setMachineId("1234");
obj1.setBusinessType("1");
obj1.setCodeType("DISCOUNT");
obj1.setMerchantCode("ISV01");
obj1.setBuyerId(3726022084L);
obj1.setCodeExtra("{\"DISCOUNT\":[{\"type\":\"1\",\"codeValue\":\"YH01010021319380\",\"discount\":80}]}");
req.setCodeReaderReq(obj1);
AlibabaPosItemGetResponse rsp = client.execute(req);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<alibaba_pos_item_get_response>
    <result>
        <model>
            <asset>
                <extra>{}</extra>
                <status>1</status>
                <title>提货券</title>
                <code>TH6579766967839</code>
                <type>VOUCHER</type>
            </asset>
            <buy_item>
                <title>测试商品</title>
                <short_name>测试商品</short_name>
                <pic_url></pic_url>
                <price>10</price>
                <promotion_price>8</promotion_price>
                <total_fee></total_fee>
                <item_weight></item_weight>
                <inv_unit></inv_unit>
                <sale_unit></sale_unit>
                <weight></weight>
                <shop_id></shop_id>
                <bar_code></bar_code>
                <out_sku_id></out_sku_id>
                <extra></extra>
                <inv_quantity></inv_quantity>
                <buy_quantity></buy_quantity>
                <sku_id></sku_id>
                <item_id></item_id>
                <is_weight>false</is_weight>
            </buy_item>
        </model>
        <msg_code></msg_code>
        <msg_info></msg_info>
        <is_success>true</is_success>
    </result>
</alibaba_pos_item_get_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部