Shopify API接入

目录

  • Shopify API接入
    • OAuth 验证
      • shopify api接入方式有三种:
    • 商品
      • prouduct attributes
      • 方法:
      • 1、find()
    • 订单
      • order attributes
      • 方法:
      • 1、find()
      • 2、count()
      • 3、close()
      • 4、open()
      • 5、cancel()
      • unstable()
        • PUT
        • DELETE
        • DELETE

所有API的使用都是通过Shopify应用程序进行的,Shopify应用程序由店主为自己的商店创建,或者由Shopify合作伙伴创建,供其他店主使用:

  • 店主可以通过自己的管理员为自己创建应用程序:http://docs.shopify.com/api/tutorials/creating-a-private-app
  • Shopify合作伙伴通过其管理员创建应用程序:http://app.shopify.com/services/partners

有关该API的更多信息和详细文档,请访问 http://api.shopify.com

OAuth 验证

shopify api接入方式有三种:
  1. 通过公有应用接入,文档参考:通过 OAuth 对公共应用进行验证

    优缺点:

    ​ 一个公共的Shopify应用可以代表多个商店与Shopify API进行交互。要使用公共应用程序通过Shopify进行身份验证,您需要从合作伙伴信息中心生成凭据,然后使用它们来实现OAuth。但是公有应用必须通过shopify审核才可以使用。

    验证:

    import binascii
    import osimport requests
    import shopify
    #应用凭据
    API_KEY = '461d8f56304d964a8f038c0d4070e2c3'
    API_SECRET = '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'
    SHOP_NAME='weshop1234'
    API_VERSION = '2020-04'shopify.Session.setup(api_key=API_KEY, secret=API_SECRET)
    shop_url = "{SHOP_NAME}.myshopify.com".format(SHOP_NAME=SHOP_NAME)
    api_version = '2020-10'
    state = binascii.b2a_hex(os.urandom(15)).decode("utf-8")
    print(state)
    redirect_uri = "http://47.94.130.206:5536/shop/callback"
    scopes = ['read_products', 'read_orders'] #权限newSession = shopify.Session(shop_url, api_version)
    auth_url = newSession.create_permission_url(scopes, redirect_uri, state)
    print(auth_url)#回调函数
    @shop_blue.route('/callback',methods=['GET'])
    def shopify_callback():response = {'status': 0,'error': None,'data': None,'msg': 'suc'}# 拿到临时codecode = request.args.get('code', '')# 站名shop_name = request.args.get('shop', '')hmac = request.args.get('hmac', '')timestamp = request.args.get('timestamp', 0, type=int)params = {}params['code'] = codeparams['shop'] = shop_nameparams['hmac'] = hmacparams['timestamp'] = timestampshopify.Session.setup(api_key=API_KEY, secret=API_SECRET)session = shopify.Session(shop_name, version=SHOPIFY_API_VERSION)# 拿到tokentoken = session.request_token(params)return {"shop_name":shop_name,"token":token}

    通过前端重定向或者浏览器访问auth_url地址,需要输入用户名密码,点击“授权”,会将临时code站名shophmacstate通过回调接口返回,然后便可获取永久授权码Token。类似于目前QQ、微信的授权页

    注意:

    ​ 回调函数的完整地址必须先加入到应用允许回调地址处。

    ​ [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-emRxPhJr-1604280661947)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20201027114102250.png)]

  2. 通过自定义应用接入,文档参考:通过 OAuth 对自定义应用进行验证

    优缺点:

    ​ 自定义Shopify应用程序可以代表单个商店与Shopify API交互。要使用自定义应用程序向Shopify进行身份验证,您需要从合作伙伴信息中心生成安装链接。商家使用该链接来进行OAuth流程并将其安装在他们的商店中。自定义应用不需要通过shopify审核。

    验证:

    ​ 同公共应用接入方式

  3. 通过专有应用接入,文档参考:通过 Shopify 后台对专有应用进行验证

    优缺点:

    ​ 专有Shopify应用可以代表一个商店与Shopify API交互。要使用专有应用程序向Shopify进行身份验证,您需要从Shopify管理员生成凭据,并在向Shopify的请求中提供这些凭据。专有应用也不需要通过shopify审核。

    验证:

import shopify# Replace the following with your shop URL
shop_url = "https://{API_KEY}:{PASSWORD}@{SHOP_NAME}.myshopify.com/admin"
shopify.ShopifyResource.set_site(shop_url)

商品

#通过验证后
products = shopify.Product.find()
for prouduct in products:print(prouduct.attributes)for i in prouduct.variants:print(i.attributes)

prouduct attributes

{'id': 5932984696983,   //商品ID'title': 'Burton Custom Freestyle 151', //商品标题'body_html': '更改描述', //商品描述'vendor': 'weshop1234', //商品供应商'product_type': 'Snowboard', //商品类型'status': "active",//状态'created_at': '2020-10-23T17:58:46+08:00', 'handle': 'burton-custom-freestyle-151','updated_at': '2020-10-27T09:17:07+08:00','published_at': '2020-10-23T17:58:46+08:00', //发布时间'template_suffix': '', //模板'published_scope': 'web', //发布方式 web在线商店  global在线商店和销售点'tags': '',  //标签'admin_graphql_api_id': 'gid://shopify/Product/5932984696983',  //api管理ID'variants': //[variant(37227313561751)], [{'id': 37227313561751,  'title': 'Default Title','price': '13.90', //价格'sku': '',//商店里的产品变种需要一个唯一标识符,这样才能完成服务'position': 1, //仓位'inventory_policy': 'deny', //当产品缺货时,是否允许客户下订单。有效值:deny 当前位置如果产品缺货,客户不得下订单,continue 当前位置如果产品缺货,客户可以下订单 'compare_at_price': '9.90', //原价 调价调整或出售前项目的原始价格'fulfillment_service': 'manual', //与产品变量相关的履行服务。有效值: 手册或履行服务的句柄。'inventory_management': 'shopify',//跟踪产品变量库存项目数量的履行服务 :shopify您正在使用管理员自己跟踪库存,null 当前位置你没有跟踪变体的库存情况,'option1': 'Default Title','option2': None,'option3': None,'created_at': '2020-10-23T17:58:46+08:00','updated_at': '2020-10-27T09:17:07+08:00','taxable': True, //是否收税'barcode': '',//产品的条形码、 UPC 或 ISBN 号'grams': 0, //产品变量的重量,以克为单位。'image_id': None,'weight': 0.0, //重量'weight_unit': 'kg',//重量单位'inventory_item_id': 39320107647127, //库存ID'inventory_quantity': 5, //库存'old_inventory_quantity': 5, // 旧存货数量'requires_shipping': True, //需要运输'admin_graphql_api_id': 'gid://shopify/ProductVariant/37227313561751' //api管理ID},],'options': //[option(7523204006039)],[{'id': 7523204006039,'product_id': 5932984696983,'name': 'Title','position': 1,'values': ['Default Title']},],'images': [image(21951771607191)],'image': image(21951771607191)
}

添加商品

new_product = shopify.Product()
new_product.title = "Burton Custom Freestyle 151"
new_product.product_type = "Snowboard"
new_product.product_type = "Snowboard"
new_product.save()

方法:

1、find()

GET /admin/api/2020-10/products.json

Retrieves a list of products. 检索产品列表Note: 注意: As of version 2019-07, this endpoint implements pagination by using links that are provided in the response header. Sending the 在2019-07版本中,该端点通过使用响应头中提供的链接来实现分页page parameter will return an error. To learn more, see 参数将返回一个错误。要了解更多信息,请参见Making requests to paginated REST Admin API endpoints 对已分页的 REST 管理 API 端点发出请求.

ids 身份证 Return only products specified by a comma-separated list of product IDs.只返回由逗号分隔的产品 id 列表指定的产品。
limit 限制 Return up to this many results per page.每页返回这么多结果。(default: (默认值:50, maximum: ,最多:250)
since_id 自从. Restrict results to after the specified ID.将结果限制在指定 ID 之后。
title 标题 Filter results by product title.按产品标题筛选结果。
vendor 厂商 Filter results by product vendor.产品供应商的过滤结果。
handle 处理 Filter results by product handle.按产品处理过滤结果。
product_type 产品 _ 类型 Filter results by product type.按产品类型分列的过滤结果。
status 地位 Return products by their status.按状态返回产品。(default: (默认值:active)active: Show only active products. 活跃的: 只显示活跃的产品archived: Show only archived products. 存档: 只显示存档产品draft: Show only draft products. 草稿: 只显示草稿产品
collection_id 集合 id Filter results by product collection ID.按产品集合 ID 筛选结果。
created_at_min 创建 at _ min Show products created after date. (format: 2014-04-25T16:15:47-04:00)显示日期后创建的产品。(格式: 2014-04-25T16:15:47-04:00)
created_at_max 创建最大 Show products created before date. (format: 2014-04-25T16:15:47-04:00)显示在日期前创建的产品。(格式: 2014-04-25T16:15:47-04:00)
updated_at_min 更新时间: 2012年10月12日 Show products last updated after date. (format: 2014-04-25T16:15:47-04:00)展示产品最后更新日期后。(格式: 2014-04-25T16:15:47-04:00)
updated_at_max 更新时间: 最高时间 Show products last updated before date. (format: 2014-04-25T16:15:47-04:00)展示产品最后更新日期前。(格式: 2014-04-25T16:15:47-04:00)
published_at_min 出版时间: 2012年10月15日 Show products published after date. (format: 2014-04-25T16:15:47-04:00)展示过期出版的产品(格式: 2014-04-25T16:15:47-04:00)
published_at_max 最大限度地发表 Show products published before date. (format: 2014-04-25T16:15:47-04:00)展示在日期前出版的产品。(格式: 2014-04-25T16:15:47-04:00)
published_status 发布状态 Return products by their published status按发布状态返回产品(default: (默认值:any)published: Show only published products. 只展示已出版的产品unpublished: Show only unpublished products. 未发布的: 只显示未发布的产品any: Show all products. 任何: 展示所有产品
fields 田野 Show only certain fields, specified by a comma-separated list of field names.只显示由以逗号分隔的字段名列表指定的某些字段。
presentment_currencies 货币 Return presentment prices in only certain currencies, specified by a comma-separated list of ISO 4217 currency codes.仅以某些货币提示价格,由以逗号分隔的 ISO 4217货币代码列表指定。

Shopify API 允许您对 Product 资源执行以下操作。这些一般行动的更详细的版本可以提供:

  • GET /admin/api/2020-10/products.json Retrieves a list of products 检索产品列表
  • GET /admin/api/2020-10/products/count.json Retrieves a count of products 检索产品计数
  • GET /admin/api/2020-10/products/{product_id}.json Retrieves a single product 检索单个产品
  • POST /admin/api/2020-10/products.json Creates a new product 创建一个新产品
  • PUT /admin/api/2020-10/products/{product_id}.json Updates a product 更新产品
  • DELETE /admin/api/2020-10/products/{product_id}.json Deletes a product 删除产品

订单

#参考文档https://shopify.dev/docs/admin-api/rest/reference/orders/order
#通过验证后
orders = shopify.Order.find()
for order in orders:print(order.attributes)for i in order.variants:print(i.attributes)

order attributes

{'id': 2900896612503,'email': '','closed_at': None,//关闭时间'created_at': '2020-10-27T14:34:01+08:00','updated_at': '2020-10-27T14:34:02+08:00','number': 1, 'note': '这里是备注','token': '3378ad6d7b57251ed0ab48f2bf556989','gateway': 'manual', //支付通道:人工'test': False,'total_price': '16.26', //总计'subtotal_price': '13.90', //小计  = 总价 - 折扣'total_weight': 0, //总重'total_tax': '2.36',//税费'taxes_included': False, //含税'currency': 'CNY', //币种'financial_status': 'pending', //pending待处理,authorized已授权,partially_paid 部分支付,paid已支付,partially_refunded已部分退款,refunded已退款,voided作废'confirmed': True, //是否确认'total_discounts': '0.00', //折扣'total_line_items_price': '13.90', //商品总价'cart_token': None, //与订单关联的购物车的ID'buyer_accepts_marketing': False, //买家接受营销'name': '#1001','referring_site': None, //参考网站'landing_site': None, //登录网址'cancelled_at': None,  //取消订单的日期和时间'cancel_reason': None, //取消原因  customer客户:客户取消了订单, fraud欺诈:订单是欺诈性的,inventory库存:订单中的商品库存不足,declined拒绝:付款被拒绝,other其他'total_price_usd': '2.43',//总美金'checkout_token': None, //检验token'reference': None, //引用'user_id': 65982202007,'location_id': 56822038679,'source_identifier': None, //源标识符'source_url': None, //来源地址'processed_at': '2020-10-27T14:34:01+08:00','device_id': None, //设备id'phone': None,//手机'customer_locale': None, //客户地区'app_id': 1354745,'browser_ip': None,'landing_site_ref': None,'order_number': 1001, //订单号'discount_applications': [],//折扣应用程序'discount_codes': [],//折扣代码'note_attributes': [],'payment_gateway_names': ['manual'],'processing_method': 'manual','checkout_id': None,'source_name': 'shopify_draft_order', //来源名字:shopify草稿订单'fulfillment_status': None, //fulfilled已完成,null未发货,partial部分发货,restocked缺货'tax_lines': [tax_line(None)], //税费对象数组'tags': '','contact_email': None,'order_status_url': 'https://weshop1234.myshopify.com/50213322903/orders/3378ad6d7b57251ed0ab48f2bf556989/authenticate?key=7ae88aece4fe483232fc021626c7b03f','presentment_currency': 'CNY','total_line_items_price_set': total_line_items_price_set(None), //总行项目价格设置'total_discounts_set': total_discounts_set(None), //总折扣设置'total_shipping_price_set': total_shipping_price_set(None), //总运费'subtotal_price_set': subtotal_price_set(None), //小计价格设置'total_price_set': total_price_set(None), //总价格设置'total_tax_set': total_tax_set(None), //总税费设置'line_items': //[line_item(6249679061143)],[{'id': 6249750626455,'variant_id': 37227313561751,'title': 'Burton Custom Freestyle 151','quantity': 1,//数量'sku': '','variant_title': None,'vendor': 'weshop1234','fulfillment_service': 'manual','product_id': 5932984696983,'requires_shipping': True,'taxable': True,'gift_card': False,'name': 'Burton Custom Freestyle 151','variant_inventory_management': 'shopify','properties': [],'product_exists': True,'fulfillable_quantity': 1,//发货数量'grams': 0,'price': '13.90','total_discount': '0.00','fulfillment_status': None,'price_set': price_set(None),'total_discount_set': total_discount_set(None),'discount_allocations': [discount_allocation(None)],'admin_graphql_api_id': 'gid://shopify/LineItem/6249750626455','tax_lines': [tax_line(None)]},],'fulfillments': [ //物流 保存物流记录{'id': 2720493699223,'status': 'cancelled','created_at': '2020-10-27T15:07:44+08:00','service': 'manual','updated_at': '2020-10-27T15:09:48+08:00','tracking_company': None,'shipment_status': None,'location_id': 56822038679,'line_items': [line_item(6249750626455)],'tracking_number': None,'tracking_numbers': [],'tracking_url': None,'tracking_urls': [],'receipt': receipt(None),'name': '#1003.1','admin_graphql_api_id': 'gid://shopify/Fulfillment/2720493699223'},],'refunds': [], //退款详情'total_tip_received': '0.0', //总收款'admin_graphql_api_id': 'gid://shopify/Order/2900896612503','shipping_lines': [  //配送相关信息{'id': 2343690797207,'title': '运费','price': '10.00','code': 'custom','source': 'shopify','phone': None,'requested_fulfillment_service_id': None,'delivery_category': None,'carrier_identifier': None,'discounted_price': '10.00','price_set': price_set(None),'discounted_price_set': discounted_price_set(None),'discount_allocations': [],'tax_lines': []},],//已付款则会出现以下信息'current_total_price': '32.52','current_total_price_set': current_total_price_set(None),'total_outstanding': '16.26','current_subtotal_price': '27.80','current_subtotal_price_set': current_subtotal_price_set(None),'current_total_tax': '4.72','current_total_tax_set': current_total_tax_set(None),'current_total_discounts': '0.00','current_total_discounts_set': current_total_discounts_set(None)
}

方法:

1、find()

Retrieves a list of orders. 检索订单列表Note: 注意: As of version 2019-10, this endpoint implements pagination by using links that are provided in the response header. Sending the 在2019-10版本中,该端点通过使用响应头中提供的链接来实现分页page parameter will return an error. To learn more, see 参数将返回一个错误。要了解更多信息,请参见Making requests to paginated REST Admin API endpoints 对已分页的 REST 管理 API 端点发出请求.

查询字段 描述
ids Retrieve only orders specified by a comma-separated list of order IDs.仅检索由以逗号分隔的顺序 id 列表指定的顺序。
limit 条数限制 The maximum number of results to show on a page.在页面上显示的最大结果数。(default: (默认值:50, maximum: ,最多:250)
since_id ID起始. Show orders after the specified ID.在指定 ID 后显示订单。
created_at_min 最小创建时间 Show orders created at or after date (format: 2014-04-25T16:15:47-04:00).显示在日期或之后创建的订单(格式: 2014-04-25T16:15:47-04:00)。
created_at_max 最大创建时间 Show orders created at or before date (format: 2014-04-25T16:15:47-04:00).显示在日期或之前生成的订单(格式: 2014-04-25T16:15:47-04:00)。
updated_at_min 最小更新时间 Show orders last updated at or after date (format: 2014-04-25T16:15:47-04:00).展示订单最后更新日期或之后(格式: 2014-04-25T16:15:47-04:00)。
updated_at_max 更新时间: 最大时间 Show orders last updated at or before date (format: 2014-04-25T16:15:47-04:00).最后更新日期(格式: 2014-04-25T16:15:47-04:00)。
processed_at_min 最小审核时间 Show orders imported at or after date (format: 2014-04-25T16:15:47-04:00).显示在日期或之后输入的订单(格式: 2014-04-25T16:15:47-04:00)。
processed_at_max 最大审核时间 Show orders imported at or before date (format: 2014-04-25T16:15:47-04:00).显示在日期或之前输入的订单(格式: 2014-04-25T16:15:47-04:00)。
attribution_app_id app id 归属 Show orders attributed to a certain app, specified by the app ID. Set as current to show orders for the app currently consuming the API.显示属于某个应用程序的订单,由应用程序 ID 指定。设置为 current 以显示当前使用 API 的应用程序的订单。
status 订单状态 Filter orders by their status.根据订单的状态过滤订单。(default: (默认值:open) open: Show only open orders. 打开: 只显示未结订单closed: Show only closed orders. 关闭: 只显示关闭的订单cancelled: Show only canceled orders. 取消: 只显示取消的订单any: Show orders of any status, including archived orders. 任何: 显示任何状态的订单,包括存档的订单
financial_status 付款状态 Filter orders by their financial status.根据订单的财务状况过滤订单。(default: (默认值:any) authorized: Show only authorized orders 授权: 只显示授权的命令pending: Show only pending orders 挂起: 只显示挂起的命令paid: Show only paid orders 付费: 只显示付费订单partially_paid: Show only partially paid orders 部分付费: 只显示部分付费订单refunded: Show only refunded orders 退款: 只显示退款订单voided: Show only voided orders 无效的: 只显示无效的命令partially_refunded: Show only partially refunded orders 部分退款: 只显示部分退款订单any: Show orders of any financial status. 任何: 显示任何财务状况的订单unpaid: Show authorized and partially paid orders. 未付款: 显示授权订单和部分付款订单
fulfillment_status 发货状态 Filter orders by their fulfillment status.根据订单的完成情况过滤订单。(default: (默认值:any)shipped: Show orders that have been shipped. Returns orders with fulfillment_status of fulfilled. 发货: 显示已经发货的订单。返回满足fulfilled状态的订单partial: Show partially shipped orders. 部分: 显示部分发货订单unshipped: Show orders that have not yet been shipped. Returns orders with fulfillment_status of null. 未发货: 显示尚未发货的订单。返回满足 _ 状态为 null 的订单any: Show orders of any fulfillment status. 任何: 显示任何完成状态的订单unfulfilled: Returns orders with fulfillment_status of null or partial. 返回 状态为 null 或partial的订单
fields 字段 Retrieve only certain fields, specified by a comma-separated list of fields names.只检索由逗号分隔的字段名列表指定的某些字段。
fields 字段:

Retrieve all orders 检索所有订单

GET /admin/api/unstable/orders.json?status=any
HTTP/1.1 200 OK
{"orders":[{"id":450789469,"email":"bob.norman@hostmail.com","closed_at":null,"created_at":"2008-01-10T11:00:00-05:00","updated_at":"2008-01-10T11:00:00-05:00","number":1,"note":null,"token":"b1946ac92492d2347c6235b4d2611184","gateway":"authorize_net","test":false,"total_price":"598.94","subtotal_price":"597.00","total_weight":0,"total_tax":"11.94","taxes_included":false,"currency":"USD","financial_status":"partially_refunded","confirmed":true,"total_discounts":"10.00","total_line_items_price":"597.00","cart_token":"68778783ad298f1c80c3bafcddeea02f","buyer_accepts_marketing":false,"name":"#1001","referring_site":"http://www.otherexample.com","landing_site":"http://www.example.com?source=abc","cancelled_at":null,"cancel_reason":null,"total_price_usd":"598.94","checkout_token":"bd5a8aa1ecd019dd3520ff791ee3a24c","reference":"fhwdgads","user_id":null,"location_id":null,"source_identifier":"fhwdgads","source_url":null,"processed_at":"2008-01-10T11:00:00-05:00","device_id":null,"phone":"+557734881234","customer_locale":null,"app_id":null,"browser_ip":"0.0.0.0","landing_site_ref":"abc","order_number":1001,"discount_applications":[Object{...}],"discount_codes":[Object{...}],"note_attributes":[Object{...},Object{...}],"payment_gateway_names":["bogus"],"processing_method":"direct","checkout_id":901414060,"source_name":"web","fulfillment_status":null,"tax_lines":[{"price":"11.94","rate":0.06,"title":"State Tax","price_set":{"shop_money":{"amount":"11.94","currency_code":"USD"},"presentment_money":{"amount":"11.94","currency_code":"USD"}}}],"tags":"","contact_email":"bob.norman@hostmail.com","order_status_url":"https://apple.myshopify.com/690933842/orders/b1946ac92492d2347c6235b4d2611184/authenticate?key=40e972daf10fcb0610e35c80aa07b4f6","presentment_currency":"USD","total_line_items_price_set":{"shop_money":{"amount":"597.00","currency_code":"USD"},"presentment_money":{"amount":"597.00","currency_code":"USD"}},"total_discounts_set":{"shop_money":{"amount":"10.00","currency_code":"USD"},"presentment_money":{"amount":"10.00","currency_code":"USD"}},"total_shipping_price_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"subtotal_price_set":{"shop_money":{"amount":"597.00","currency_code":"USD"},"presentment_money":{"amount":"597.00","currency_code":"USD"}},"total_price_set":{"shop_money":{"amount":"598.94","currency_code":"USD"},"presentment_money":{"amount":"598.94","currency_code":"USD"}},"total_tax_set":{"shop_money":{"amount":"11.94","currency_code":"USD"},"presentment_money":{"amount":"11.94","currency_code":"USD"}},"line_items":[{"id":466157049,"variant_id":39072856,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008GREEN","variant_title":"green","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - green","variant_inventory_management":"shopify","properties":[{"name":"Custom Engraving Front","value":"Happy Birthday"},{"name":"Custom Engraving Back","value":"Merry Christmas"}],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.34","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.34","currency_code":"USD"},"presentment_money":{"amount":"3.34","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/466157049","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]},{"id":518995019,"variant_id":49148385,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008RED","variant_title":"red","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - red","variant_inventory_management":"shopify","properties":[],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.33","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.33","currency_code":"USD"},"presentment_money":{"amount":"3.33","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/518995019","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]},{"id":703073504,"variant_id":457924702,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008BLACK","variant_title":"black","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - black","variant_inventory_management":"shopify","properties":[],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.33","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.33","currency_code":"USD"},"presentment_money":{"amount":"3.33","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/703073504","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]}],"fulfillments":[{"id":255858046,"order_id":450789469,"status":"failure","created_at":"2020-10-22T10:31:33-04:00","service":"manual","updated_at":"2020-10-22T10:31:33-04:00","tracking_company":"USPS","shipment_status":null,"location_id":905684977,"line_items":[{"id":466157049,"variant_id":39072856,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008GREEN","variant_title":"green","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - green","variant_inventory_management":"shopify","properties":[{"name":"Custom Engraving Front","value":"Happy Birthday"},{"name":"Custom Engraving Back","value":"Merry Christmas"}],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.34","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.34","currency_code":"USD"},"presentment_money":{"amount":"3.34","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/466157049","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]}],"tracking_number":"1Z2345","tracking_numbers":["1Z2345"],"tracking_url":"https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=1Z2345","tracking_urls":["https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=1Z2345"],"receipt":{"testcase":true,"authorization":"123456"},"name":"#1001.0","admin_graphql_api_id":"gid://shopify/Fulfillment/255858046"}],"refunds":[{"id":509562969,"order_id":450789469,"created_at":"2020-10-22T10:31:33-04:00","note":"it broke during shipping","user_id":799407056,"processed_at":"2020-10-22T10:31:33-04:00","restock":true,"duties":[],"total_duties_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"admin_graphql_api_id":"gid://shopify/Refund/509562969","refund_line_items":[{"id":104689539,"quantity":1,"line_item_id":703073504,"location_id":487838322,"restock_type":"legacy_restock","subtotal":195.67,"total_tax":3.98,"subtotal_set":{"shop_money":{"amount":"195.67","currency_code":"USD"},"presentment_money":{"amount":"195.67","currency_code":"USD"}},"total_tax_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}},"line_item":{"id":703073504,"variant_id":457924702,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008BLACK","variant_title":"black","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - black","variant_inventory_management":"shopify","properties":[],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.33","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.33","currency_code":"USD"},"presentment_money":{"amount":"3.33","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/703073504","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]}},{"id":709875399,"quantity":1,"line_item_id":466157049,"location_id":487838322,"restock_type":"legacy_restock","subtotal":195.66,"total_tax":3.98,"subtotal_set":{"shop_money":{"amount":"195.66","currency_code":"USD"},"presentment_money":{"amount":"195.66","currency_code":"USD"}},"total_tax_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}},"line_item":{"id":466157049,"variant_id":39072856,"title":"IPod Nano - 8gb","quantity":1,"sku":"IPOD2008GREEN","variant_title":"green","vendor":null,"fulfillment_service":"manual","product_id":632910392,"requires_shipping":true,"taxable":true,"gift_card":false,"name":"IPod Nano - 8gb - green","variant_inventory_management":"shopify","properties":[{"name":"Custom Engraving Front","value":"Happy Birthday"},{"name":"Custom Engraving Back","value":"Merry Christmas"}],"product_exists":true,"fulfillable_quantity":1,"grams":200,"price":"199.00","total_discount":"0.00","fulfillment_status":null,"price_set":{"shop_money":{"amount":"199.00","currency_code":"USD"},"presentment_money":{"amount":"199.00","currency_code":"USD"}},"total_discount_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[{"amount":"3.34","discount_application_index":0,"amount_set":{"shop_money":{"amount":"3.34","currency_code":"USD"},"presentment_money":{"amount":"3.34","currency_code":"USD"}}}],"duties":[],"admin_graphql_api_id":"gid://shopify/LineItem/466157049","tax_lines":[{"title":"State Tax","price":"3.98","rate":0.06,"price_set":{"shop_money":{"amount":"3.98","currency_code":"USD"},"presentment_money":{"amount":"3.98","currency_code":"USD"}}}]}}],"transactions":[{"id":179259969,"order_id":450789469,"kind":"refund","gateway":"bogus","status":"success","message":null,"created_at":"2005-08-05T12:59:12-04:00","test":false,"authorization":"authorization-key","location_id":null,"user_id":null,"parent_id":801038806,"processed_at":"2005-08-05T12:59:12-04:00","device_id":null,"receipt":{},"error_code":null,"source_name":"web","amount":"209.00","currency":"USD","admin_graphql_api_id":"gid://shopify/OrderTransaction/179259969"}],"order_adjustments":[]}],"total_tip_received":"0.0","original_total_duties_set":null,"current_total_duties_set":null,"admin_graphql_api_id":"gid://shopify/Order/450789469","shipping_lines":[{"id":369256396,"title":"Free Shipping","price":"0.00","code":"Free Shipping","source":"shopify","phone":null,"requested_fulfillment_service_id":null,"delivery_category":null,"carrier_identifier":null,"discounted_price":"0.00","price_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discounted_price_set":{"shop_money":{"amount":"0.00","currency_code":"USD"},"presentment_money":{"amount":"0.00","currency_code":"USD"}},"discount_allocations":[],"tax_lines":[]}],"billing_address":{"first_name":"Bob","address1":"Chestnut Street 92","phone":"555-625-1199","city":"Louisville","zip":"40202","province":"Kentucky","country":"United States","last_name":"Norman","address2":"","company":null,"latitude":45.41634,"longitude":-75.6868,"name":"Bob Norman","country_code":"US","province_code":"KY"},"shipping_address":{"first_name":"Bob","address1":"Chestnut Street 92","phone":"555-625-1199","city":"Louisville","zip":"40202","province":"Kentucky","country":"United States","last_name":"Norman","address2":"","company":null,"latitude":45.41634,"longitude":-75.6868,"name":"Bob Norman","country_code":"US","province_code":"KY"},"client_details":{"browser_ip":"0.0.0.0","accept_language":null,"user_agent":null,"session_hash":null,"browser_width":null,"browser_height":null},"payment_details":{"credit_card_bin":null,"avs_result_code":null,"cvv_result_code":null,"credit_card_number":"•••• •••• •••• 4242","credit_card_company":"Visa"},"customer":{"id":207119551,"email":"bob.norman@hostmail.com","accepts_marketing":false,"created_at":"2020-10-22T10:31:33-04:00","updated_at":"2020-10-22T10:31:33-04:00","first_name":"Bob","last_name":"Norman","orders_count":1,"state":"disabled","total_spent":"199.65","last_order_id":450789469,"note":null,"verified_email":true,"multipass_identifier":null,"tax_exempt":false,"phone":"+16136120707","tags":"","last_order_name":"#1001","currency":"USD","accepts_marketing_updated_at":"2005-06-12T11:57:11-04:00","marketing_opt_in_level":null,"tax_exemptions":[],"admin_graphql_api_id":"gid://shopify/Customer/207119551","default_address":{"id":207119551,"customer_id":207119551,"first_name":null,"last_name":null,"company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","country":"United States","zip":"40202","phone":"555-625-1199","name":"","province_code":"KY","country_code":"US","country_name":"United States","default":true}}}]
}

Retrieve specific orders 检索指定订单

GET /admin/api/unstable/orders.json?ids=1073459962

Retrieve orders that have authorized payments ready to be captured 检索已授权付款的订单

GET /admin/api/unstable/orders.json?financial_status=authorized

Retrieve orders last updated after 2005-07-31 15:57:11 in the EDT timezone 检索订单的最后更新时间为美国东部夏令时间(EDT)时区2005-07-31 15:57:11之后

GET /admin/api/unstable/orders.json?updated_at_min=2005-07-31T15:57:11-04:00

Retrieve all orders but show only certain properties 检索所有订单,但只显示某些属性

GET /admin/api/unstable/orders.json?fields=created_at,id,name,total-price

Retrieve all orders after the specified ID 检索指定 ID 之后的所有订单

GET /admin/api/unstable/orders.json?since_id=123

2、count()

GET  获取/admin/api/unstable/orders/count.json

Retrieves an order count 检索订单计数

字段 描述
created_at_min 创建 最小 Count orders created after date (format: 2014-04-25T16:15:47-04:00).日期后创建的计数顺序(格式: 2014-04-25T16:15:47-04:00)。
created_at_max 创建最大 Count orders created before date (format: 2014-04-25T16:15:47-04:00).在日期前创建的计数顺序(格式: 2014-04-25T16:15:47-04:00)。
updated_at_min 更新时间: 2012年10月12日 Count orders last updated after date (format: 2014-04-25T16:15:47-04:00).最后更新日期后(格式: 2014-04-25T16:15:47-04:00)。
updated_at_max 更新时间: 最高时间 Count orders last updated before date (format: 2014-04-25T16:15:47-04:00).最后更新日期前(格式: 2014-04-25T16:15:47-04:00)。
status 地位 Count orders of a given status.计算给定状态的订单数量。(default: (默认值:open)open: Count open orders. 公开: 数未结订单closed: Count closed orders. 关闭: 计数关闭的命令any: Count orders of any status. 任何: 计算任何状态的订单
financial_status 经济状况 Count orders of a given financial status.计算特定财务状况下的订单数量。(default: (默认值:any)authorized: Count authorized orders. 授权: 计数授权命令pending: Count pending orders. 挂起: 计算挂起的命令paid: Count paid orders. 付费: 计算付费订单refunded: Count refunded orders. 退款: 退款数额voided: Count voided orders. 作废: 作废的命令any: Count orders of any financial status. 任何: 清点任何财务状况的订单
fulfillment_status 实现状态 Filter orders by their fulfillment status.根据订单的完成情况过滤订单。(default: (默认值:any)shipped: Show orders that have been shipped. Returns orders with fulfillment_status of fulfilled. 发货: 显示已经发货的订单。返回满足 _ 状态的订单partial: Show partially shipped orders. 部分: 显示部分发货订单unshipped: Show orders that have not yet been shipped. Returns orders with fulfillment_status of null. 未发货: 显示尚未发货的订单。返回满足 _ 状态为 null 的订单any: Show orders of any fulfillment status. 任何: 显示任何完成状态的订单unfulfilled: Returns orders with fulfillment_status of null or partial. 未满足: 返回满足 _ 状态为 null 或部分的订单

Count all orders 清点所有的订单

GET /admin/api/unstable/orders/count.json

View Response 查看响应

Count orders that have authorized payments ready to be captured 计算已授权付款准备被捕获的订单

GET /admin/api/unstable/orders/count.json?financial_status=authorized

View Response 查看响应

3、close()

POST  /admin/api/unstable/orders/{order_id}/close.json

Closes an order 关闭一个订单

POST /admin/api/unstable/orders/450789469/close.json

View Response 查看响应

4、open()

POST /admin/api/unstable/orders/{order_id}/open.json

Re-opens a closed order 重新打开一个关闭的订单

POST /admin/api/unstable/orders/450789469/open.json

View Response 查看响应

5、cancel()

POST /admin/api/unstable/orders/{order_id}/cancel.json

Caution 注意

For multi-currency orders, the currency property is required whenever the amount property is provided. For more information, see Migrating to support multiple currencies.

对于多货币订单,只要提供了金额属性,就需要货币属性。有关详细信息,请参阅Migrating to support multiple currencies.。

Cancels an order. Orders that have a fulfillment object can’t be canceled. 取消订单。带有完成目标的订单不能取消

字段 描述
amount 金额 The amount to refund. If set, Shopify attempts to void or refund the payment, depending on its status. Shopify refunds through a manual gateway in cases where the original transaction was not made in Shopify. Refunds through a manual gateway are recorded as a refund on Shopify, but the customer is not refunded.退款金额。如果设置,Shopify 将根据其状态,尝试取消或退还付款。如果最初的交易不是在 Shopify 完成的,Shopify 可以通过手动网关退款。通过手动网关退款被记录为 Shopify 上的退款,但是客户不退款。
currency 货币 The currency of the refund that’s issued when the order is canceled. Required for multi-currency orders whenever the amount property is provided.取消订单时发出的退款货币。在提供金额属性时,多货币订单需要。
restock 补充库存 DEPRECATED 废弃 Whether to restock refunded items back to your store’s inventory.是否将退回的物品退回到商店的库存中。(default: (默认值:false)
reason 原因 The reason for the order cancellation. Valid values: customer, inventory, fraud, declined, and other.)取消订单的原因。有效值: 客户、库存、欺诈、拒绝和其他。)(default: (默认值:other)
email 电子邮件 Whether to send an email to the customer notifying them of the cancellation.是否向客户发送电子邮件通知取消。(default: (默认值:false)
refund 退款 The refund transactions to perform. Required for some more complex refund situations. For more information, see the Refund API.要执行的退款交易。需要一些更复杂的退款情况。有关更多信息,请参阅退款 API。

Cancel an order

取消订单

POST /admin/api/unstable/orders/450789469/cancel.json
{
}

View Response 查看响应

Cancel and refund an order using the amount property

使用金额属性取消和退还订单

POST /admin/api/unstable/orders/450789469/cancel.json
{"amount": "10.00","currency": "USD"
}

View Response 查看响应

When an order has multiple refundable transactions, refunding an amount less than its net payment without a refund property fails with an error

当一个订单有多个可退还的交易,退款金额低于其净付款额没有退款财产失败与一个错误

POST /admin/api/unstable/orders/450789469/cancel.json
{"amount": "109.00","currency": "USD"
}

View Response 查看响应

Cancel and refund an order using the refund property

使用退款属性取消和退还订单

POST /admin/api/unstable/orders/450789469/cancel.json
{"refund": {"note": "Customer made a mistake","shipping": {"full_refund": true},"refund_line_items": [{"line_item_id": 466157049,"quantity": 1,"restock_type": "cancel","location_id": 48752903}],"transactions": [{"parent_id": 1072844670,"amount": "10.00","kind": "refund","gateway": "bogus"},{"parent_id": 1072844671,"amount": "100.00","kind": "refund","gateway": "gift_card"}]}
}

View Response 查看响应

Canceling an order that has fulfillments fails with an error

取消已完成的订单是失败的,也是错误的

POST /admin/api/unstable/orders/450789469/cancel.json
{
}

View Response 查看响应

unstable()

POST /admin/api/unstable/orders.json

Creates an order. By default, product inventory is not claimed.

创建订单。默认情况下,产品库存不被认领。

When you create an order, you can include the following option parameters in the body of the request:

当你创建一个订单时,你可以在请求的正文中包含以下选项参数:

  • inventory_behaviour
    The behaviour to use when updating inventory. (default: bypass) 库存 _ 行为: 更新库存时使用的行为。(默认: 旁路)
    • bypass: Do not claim inventory. 旁路: 不索赔库存。
    • decrement_ignoring_policy: Ignore the product’s inventory policy and claim inventory. 减量忽略策略: 忽略产品的库存策略和索赔库存。
    • decrement_obeying_policy: Follow the product’s inventory policy and claim inventory, if possible. 遵守库存政策: 如果可能的话,遵守产品的库存政策和索赔库存
  • send_receipt: Whether to send an order confirmation to the customer. Send _ receipt: 是否向客户发送订单确认

Note 注意:

If you’re working on a private app and order confirmations are still being sent to the customer when send_receipt is set to false, then you need to disable the Storefront API from the private app’s page in the Shopify admin.

如果你正在开发一个私有应用程序,当发送收据设置为 false 时,订单确认信息仍然会发送给客户,那么你需要在 Shopify admin 的私有应用程序页面上禁用 Storefront API。

  • send_fulfillment_receipt: Whether to send a shipping confirmation to the customer. 发送 _ 履行 _ 收据: 是否向客户发送送货确认

Note 注意:

If you are including shipping_address or billing_address, make sure to pass both first_name and last_name. Otherwise both these addresses will be ignored.

如果您包含送货地址或者账单地址,请确保同时传递名字和姓氏。否则这两个地址都将被忽略。

If you’re using this endpoint with a trial or Partner development store, then you can create no more than 5 new orders per minute.

如果将此端点用于试用或合作伙伴开发存储,则每分钟不能创建超过5个新订单。

Create a simple order with only a product variant ID

创建一个只有产品变量 ID 的简单订单

POST /admin/api/unstable/orders.json
{"order": {"line_items": [{"variant_id": 447654529,"quantity": 1}]}
}

View Response 查看响应

Create a simple order, sending an order confirmation and a shipping confirmation to the customer

创建一个简单的订单,向客户发送订单确认和发货确认

POST /admin/api/unstable/orders.json
{"order": {"email": "foo@example.com","fulfillment_status": "fulfilled","send_receipt": true,"send_fulfillment_receipt": true,"line_items": [{"variant_id": 457924702,"quantity": 1}]}
}

View Response 查看响应

Create a simple order without sending an order receipt or a fulfillment receipt

创建一个简单的订单,而不发送订单收据或履行收据

POST /admin/api/unstable/orders.json
{"order": {"email": "foo@example.com","fulfillment_status": "fulfilled","line_items": [{"variant_id": 447654529,"quantity": 1}]}
}

View Response 查看响应

Create a simple order and fulfill it

创建一个简单的订单并完成它

POST /admin/api/unstable/orders.json
{"order": {"email": "foo@example.com","fulfillment_status": "fulfilled","fulfillments": [{"location_id": 48752903}],"line_items": [{"variant_id": 447654529,"quantity": 1}]}
}

View Response 查看响应

Create a comprehensive order

建立一个全面的订单

POST /admin/api/unstable/orders.json
{"order": {"line_items": [{"title": "Big Brown Bear Boots","price": 74.99,"grams": "1300","quantity": 3,"tax_lines": [{"price": 13.5,"rate": 0.06,"title": "State tax"}]}],"transactions": [{"kind": "sale","status": "success","amount": 238.47}],"total_tax": 13.5,"currency": "EUR"}
}

View Response 查看响应

Create an order with tax lines split across taxable line items

创建一个订单,在应税项目之间划分税线

POST /admin/api/unstable/orders.json
{"order": {"line_items": [{"title": "Red Leather Coat","price": 129.99,"grams": "1700","quantity": 1},{"title": "Blue Suede Shoes","price": 85.95,"grams": "750","quantity": 1,"taxable": false},{"title": "Raspberry Beret","price": 19.99,"grams": "320","quantity": 2}],"tax_lines": [{"price": 10.2,"rate": 0.06,"title": "State tax"},{"price": 4.25,"rate": 0.025,"title": "County tax"}],"total_tax": 14.45}
}

View Response 查看响应

Creating an order with tax lines both on line items and on the order fails and returns an error

在行项和订单上创建带有赋税行的订单失败并返回错误

POST /admin/api/unstable/orders.json
{"order": {"line_items": [{"title": "Clicky Keyboard","price": 99.99,"grams": "600","quantity": 1,"tax_lines": [{"price": 1.0,"rate": 0.01,"title": "Keyboard tax"}]}],"tax_lines": [{"price": 6.0,"rate": 0.06,"title": "State tax"}]}
}

View Response 查看响应

Create a pending order with an existing customer

使用现有客户创建挂起的订单

POST /admin/api/unstable/orders.json
{"order": {"line_items": [{"variant_id": 447654529,"quantity": 1}],"customer": {"id": 207119551},"financial_status": "pending"}
}

View Response 查看响应

Create a partially paid order with a new customer and addresses

创建一个新客户和地址的部分付费订单

POST /admin/api/unstable/orders.json
{"order": {"line_items": [{"variant_id": 447654529,"quantity": 1}],"customer": {"first_name": "Paul","last_name": "Norman","email": "paul.norman@example.com"},"billing_address": {"first_name": "John","last_name": "Smith","address1": "123 Fake Street","phone": "555-555-5555","city": "Fakecity","province": "Ontario","country": "Canada","zip": "K2P 1L4"},"shipping_address": {"first_name": "Jane","last_name": "Smith","address1": "123 Fake Street","phone": "777-777-7777","city": "Fakecity","province": "Ontario","country": "Canada","zip": "K2P 1L4"},"email": "jane@example.com","transactions": [{"kind": "authorization","status": "success","amount": 50.0}],"financial_status": "partially_paid"}
}

View Response 查看响应

Create an order and apply a discount

创建一个订单并申请折扣

POST /admin/api/unstable/orders.json
{"order": {"line_items": [{"variant_id": 447654529,"quantity": 1}],"email": "jane@example.com","phone": "18885551234","billing_address": {"first_name": "John","last_name": "Smith","address1": "123 Fake Street","phone": "555-555-5555","city": "Fakecity","province": "Ontario","country": "Canada","zip": "K2P 1L4"},"shipping_address": {"first_name": "Jane","last_name": "Smith","address1": "123 Fake Street","phone": "777-777-7777","city": "Fakecity","province": "Ontario","country": "Canada","zip": "K2P 1L4"},"transactions": [{"kind": "sale","status": "success","amount": 50.0}],"financial_status": "paid","discount_codes": [{"code": "FAKE30","amount": "9.00","type": "percentage"}]}
}

View Response 查看响应

PUT
PUT /admin/api/unstable/orders/{order_id}.jsonUpdates an order 更新订单

Add a note to order

给订单添加注释

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"note": "Customer contacted us about a custom engraving on this iPod"}
}

View Response 查看响应

Add note attributes to an order

向订单添加注释属性

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"note_attributes": [{"name": "colour","value": "red"}]}
}

View Response 查看响应

Change an order’s email address

更改订单的电子邮件地址

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"email": "a-different@email.com"}
}

View Response 查看响应

Change an order’s phone number

更改订单的电话号码

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"phone": "+15145556677"}
}

View Response 查看响应

Change whether the buyer accepts marketing

改变买方是否接受市场营销

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"buyer_accepts_marketing": true}
}

View Response 查看响应

Add a metafield to an order

向订单添加元字段

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"metafields": [{"key": "new","value": "newvalue","value_type": "string","namespace": "global"}]}
}

View Response 查看响应

Update the shipping address of an order

更新订单的送货地址

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"shipping_address": {"address1": "123 Ship Street","city": "Shipsville"}}
}

View Response 查看响应

Remove the customer from an order

从订单中删除客户

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"customer": null}
}

View Response 查看响应

Update an order’s tags

更新订单的标签

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"tags": "External, Inbound, Outbound"}
}
DELETE
DELETE /admin/api/unstable/orders/{order_id}.json

Deletes an order. Orders that interact with an online gateway can’t be deleted. 删除订单。与联机网关交互的订单无法删除

Delete an order

删除订单

DELETE /admin/api/unstable/orders/450789469.json

View Response 查看响应

Change an order’s phone number

更改订单的电话号码

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"phone": "+15145556677"}
}

View Response 查看响应

Change whether the buyer accepts marketing

改变买方是否接受市场营销

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"buyer_accepts_marketing": true}
}

View Response 查看响应

Add a metafield to an order

向订单添加元字段

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"metafields": [{"key": "new","value": "newvalue","value_type": "string","namespace": "global"}]}
}

View Response 查看响应

Update the shipping address of an order

更新订单的送货地址

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"shipping_address": {"address1": "123 Ship Street","city": "Shipsville"}}
}

View Response 查看响应

Remove the customer from an order

从订单中删除客户

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"customer": null}
}

View Response 查看响应

Update an order’s tags

更新订单的标签

PUT /admin/api/unstable/orders/450789469.json
{"order": {"id": 450789469,"tags": "External, Inbound, Outbound"}
}
DELETE
DELETE /admin/api/unstable/orders/{order_id}.json

Deletes an order. Orders that interact with an online gateway can’t be deleted. 删除订单。与联机网关交互的订单无法删除

Delete an order

删除订单

DELETE /admin/api/unstable/orders/450789469.json

View Response 查看响应

Shopify API接入相关推荐

  1. 微信公众平台开发,API接入与推送事件(1)

    博客好久没有更新了,今天说说微信开发.微信开发的好多初学者都会又这样的迷惑,微信开发到底是什么?其实微信开发本质我和我们的网站开发没有太大的区别.我们常说的微信开发也就是公众号开,微信公众号分为三个类 ...

  2. Lambda钱包API接入教程

    钱包API接入文档说明 参考钱包版本: Wallet0.4.40 钱包账户信息文档文档: 钱包账户信息.签名.配置文件说明 主网的钱包服务地址: 39.107.247.86:13659 测试网的钱包服 ...

  3. 微信api接入验证的坑!!!

    最近在弄微信公众号开发,在微信api接入验证这块遇到了几个问题,记录一下踩坑之路. 一.这是官方文档的接入讲解 这儿前面第一步就不说了,配置自己的服务器,我这儿没有服务器,用的是ngrok内网穿透(问 ...

  4. 京东api接入的几个坑(宙斯) 转载

    ===== [ 京东api接入的几个坑(宙斯) 原创 2014年10月30日 17:43:51 8719 写这篇文章为了发下牢骚,鄙视下京东api上的不足, 怀念下下午的2个小时..... http: ...

  5. 转:彻底搞定期货穿透式CTP API接入

    中信期货看穿式监管认证操作指南(CTP系统) https://www.citicsf.com/static/download/soft/%E4%B8%AD%E4%BF%A1%E6%9C%9F%E8%B ...

  6. 【vn.py】期货穿透式CTP API接入

    文章目录 写在前面 一.申请穿透式接入 二.填表提交AppID 三.拿到AuthCode 四.仿真测试 五.期货公司校验 六.实盘接入 其他 REF 写在前面 由于6月14日当天,所有期货公司的柜台系 ...

  7. 恒生LIGHT云金融交易测试平台,支持股票、融资融券、股票期权、基金、期货等多市场,提供免费的实盘行情和便捷的API接入,满足多金融业务品种的高仿真实训环境,进行策略实盘回测!

    金融交易测试平台,是恒生LIGHT云为开发者提供的一套支持股票.融资融券.股票期权.基金.期货等多市场,多金融业务品种的高仿真实训环境. 开发者通过开放的接口接入金融交易测试平台,一方面可以验证自身产 ...

  8. ArcGIS Server Felx API接入E都市三维地图

    ArcGIS Server Felx API接入E都市三维地图 (本实例只是个人兴趣研究,如果想要应用到商业用途,请联系相关厂家) 通过HttpWatch工具查看E都市网站加载三维地图的方式及原理,能 ...

  9. ArcGIS Server Felx API接入E都市地图

    ArcGIS Server Felx API接入E都市地图 (本实例只是个人兴趣研究,如果想要应用到商业用途,请联系相关厂家) 通过HttpWatch工具查看E都市网站加载三维地图的方式及原理,能够观 ...

  10. 通知短信 API 接入全流程(超详细整理)

    随着移动互联网和智能手机的普及,短信成为了一种便捷.快速且有效的通信方式,尤其在向用户发送重要信息或提醒方面具有很大的优势. 本文将会深入探讨如何在程序中接入通知短信 API 实现短信通知功能,此外, ...

最新文章

  1. 电脑启动顺序(以Windows XP为例)
  2. rhel6下组建两台主机的HA集群
  3. css - Position定位属性与层级关系
  4. SAP CO模块权限控制
  5. 计算机内存比外存容量大吗,内存容量一般比外存容量大吗
  6. Python-复习-习题-13
  7. php调用ruby,ruby、javascript、php中的观察者模式实现代码
  8. 基于Bert-NER构建特定领域中文信息抽取框架
  9. PowerDesigner 表格导出为excel
  10. 批量修改已下载的图片格式
  11. Veeam Backup 9.5 恢复VMware虚拟机
  12. 为什么美国大城市里不修二环三环四环五环?
  13. 【08期】说说Object类下面有几种方法呢?
  14. 线上频繁GC怎么处理
  15. Uipath Studio流程设计器介绍
  16. R统计绘图-变量分组相关性网络图(igraph)
  17. 射频知识——基本概念和术语
  18. 三国杀的联想-前端页面进度条的生成
  19. Chrome 扩展教程之如何使用 React 构建 Chrome 扩展(教程含源码)
  20. 盒子div的阴影效果

热门文章

  1. Social Recommendation with Strong and Weak Ties 学习笔记
  2. 批处理中的删除命令:del
  3. 赖美云的认证照_火箭少女最新路透照出炉:吴宣仪赖美云魅力十足,张紫宁傅菁凭颜值圈粉...
  4. 如何通过linux的终端命令远程登陆windows主机
  5. 阿里巴巴分布式消息系统的实践之路
  6. 星巴克与阿里巴巴合作咖啡外卖
  7. 2019最新-全国等级保护测评机构推荐目录
  8. MySQL学习笔记(2)
  9. 种群竞争模型 --- (Lotka-Volterra模型) Logistic回归
  10. 网站检测-网站检测软件-免费网站安全检测工具