FROM CACHE - zh-cn_header
已解决

shopify回传订单

ljl
新成员
31 0 0

通过该接口获取到shopify平台订单,如果我再次获取还会获取到相同的单子,如何回传订单状态,让已经获取到的单子无法获取到

1 个已接受解答

Tim_Mak
探路者
103 13 21
解决方案

你如果通过fulfillment接口完成了订单,如果再次获取订单可以筛选出已经完成的订单

https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json

fulfillment_status

在原帖中查看解决方案

48 条回复48

Tim_Mak
探路者
103 13 21
解决方案

你如果通过fulfillment接口完成了订单,如果再次获取订单可以筛选出已经完成的订单

https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json

fulfillment_status

ljl
新成员
31 0 0

你好,请问如何称呼你

我的需求是这样的,我想通过接口获取shopify平台店铺的订单,然后通过我们系统提交出库发货获取面单后回传订单的状态,请问调用接口的具体顺序是什么?

我的理解是这样的:

ljl_0-1633914356663.png

 

1、获取草稿订单

url:https://8f212ed52efaced7890be4100cef075f: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@2248023813.myshopify...

resp body

{
    "draft_orders": [
        {
            "id"988427682025,
            "note""shopify测试",
            "email""2248023813@qq.com",
            "taxes_included"false,
            "currency""USD",
            "invoice_sent_at"null,
            "created_at""2021-10-08T10:39:08+08:00",
            "updated_at""2021-10-08T10:39:08+08:00",
            "tax_exempt"true,
            "completed_at"null,
            "name""#D3",
            "status""open",
            "line_items": [
                {
                    "id"57711735996649,
                    "variant_id"39466176053481,
                    "product_id"6635917770985,
                    "title""SHIRT",
                    "variant_title""10",
                    "sku""SHIRT",
                    "vendor""2248023813",
                    "quantity"1,
                    "requires_shipping"true,
                    "taxable"true,
                    "gift_card"false,
                    "fulfillment_service""manual",
                    "grams"454,
                    "tax_lines": [],
                    "applied_discount"null,
                    "name""SHIRT - 10",
                    "properties": [],
                    "custom"false,
                    "price""0.00",
                    "admin_graphql_api_id""gid://shopify/DraftOrderLineItem/57711735996649"
                }
            ],
            "shipping_address": {
                "first_name""hat",
                "address1""32801 Ecorse Road",
                "phone""+11234567890",
                "city""Romulus",
                "zip""48174",
                "province""Michigan",
                "country""United States",
                "last_name""liu",
                "address2""",
                "company""hat",
                "latitude"42.2505224,
                "longitude"-83.3622427,
                "name""hat liu",
                "country_code""US",
                "province_code""MI"
            },
            "billing_address": {
                "first_name""hat",
                "address1""32801 Ecorse Road",
                "phone""+11234567890",
                "city""Romulus",
                "zip""48174",
                "province""Michigan",
                "country""United States",
                "last_name""liu",
                "address2""",
                "company""hat",
                "latitude"42.2505224,
                "longitude"-83.3622427,
                "name""hat liu",
                "country_code""US",
                "province_code""MI"
            },
            "applied_discount"null,
            "order_id"null,
            "shipping_line"null,
            "tax_lines": [],
            "tags""紧急",
            "note_attributes": [],
            "total_price""0.00",
            "subtotal_price""0.00",
            "total_tax""0.00",
            "admin_graphql_api_id""gid://shopify/DraftOrder/988427682025",
            "customer": {
                "id"5244566962409,
                "email""2248023813@qq.com",
                "accepts_marketing"true,
                "created_at""2021-09-28T09:07:44+08:00",
                "updated_at""2021-09-28T09:07:44+08:00",
                "first_name""hat",
                "last_name""liu",
                "orders_count"0,
                "state""disabled",
                "total_spent""0.00",
                "last_order_id"null,
                "note"null,
                "verified_email"true,
                "multipass_identifier"null,
                "tax_exempt"true,
                "phone"null,
                "tags""",
                "last_order_name"null,
                "currency""USD",
                "accepts_marketing_updated_at""2021-09-28T09:07:44+08:00",
                "marketing_opt_in_level""single_opt_in",
                "tax_exemptions": [],
                "admin_graphql_api_id""gid://shopify/Customer/5244566962409",
                "default_address": {
                    "id"6433503346921,
                    "customer_id"5244566962409,
                    "first_name""hat",
                    "last_name""liu",
                    "company""hat",
                    "address1""32801 Ecorse Road",
                    "address2""",
                    "city""Romulus",
                    "province""Michigan",
                    "country""United States",
                    "zip""48174",
                    "phone""+11234567890",
                    "name""hat liu",
                    "province_code""MI",
                    "country_code""US",
                    "country_name""United States",
                    "default"true
                }
            }
        }
    ]
}
2、回传订单状态 此接口未调通
resp body:
{
    "errors""Change your plan to allow customers to checkout and to create orders."
}
 
 针对我目前的需求,请问调用的接口是否正确?
希望得到您的答复,谢谢

 

 

Tim_Mak
探路者
103 13 21

1. 你看的这块API是处理draft order,也就是定制订单,是商家自己创建的订单,不是客户下单的

2. 用的接口没有错,但因为是测试店铺,不是付费店铺,所以会出现这个错误

 

ljl
新成员
31 0 0

听起来你对这块业务很了解,感谢你的回复!

我还有个问题,请问这两个接口有何区别。针对我的业务需求,我应该调哪一个接口,谢谢

特别感谢

https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json

 

https://3ae227a45e2e8f939fac5e52c1a49eb0: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@3092237819.myshopify...

Tim_Mak
探路者
103 13 21

看到你们在另一个帖子的需求,你们应该用第一个接口:

https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json

你们有两个途径可以走:

第一个:

1. 获取订单:https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json 

2. 内部处理完订单去关闭所处理的订单:https://shopify.dev/api/admin-rest/2021-10/resources/order#[post]/admin/api/2021-10/orders/{order_id... 

3. 再次获取订单的时候已关闭的订单默认不会被拉取到

第二个:

1. 获取订单:https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json 

2. 去发货,给订单添加物流信息:https://shopify.dev/api/admin-rest/2021-10/resources/fulfillment#[post]/admin/api/2021-10/fulfillmen... 

3. 再次获取订单的时候,要传去fulfillment_status=shipped

 

ljl
新成员
31 0 0

我认为您提供的第二种方案符合我们的业务需求

我再简单解释一下

我们先获取到shopify平台店铺已创建的草稿订单。获取完成之后,我们会提交出库发货,会获取到每个订单的追踪号和与之对应的面单。这时,我们需要把订单回传回传到shopify平台店铺,当再次获取时就获取不到已发货的单子,我想问下面这种方案是否满足我的业务需求?这样就不需要调Complete a fulfillment接口了?

 

1. 获取订单:https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json 

2. 去发货,给订单添加物流信息:https://shopify.dev/api/admin-rest/2021-10/resources/fulfillment#[post]/admin/api/2021-10/fulfillmen... 

3. 再次获取订单的时候,要传去fulfillment_status=shipped

Tim_Mak
探路者
103 13 21

是的,没错,不需要Complete a fulfillment接口了

ljl
新成员
31 0 0

周末愉快,有个问题想请教一下您

API文档中提供的header体是不是非必要的:因为我不需要此header体同样也可以调通接口

H "X-Shopify-Access-Token: {access_token}"

1.png

ljl
新成员
31 0 0

你好,现在又遇到了一个新问题

Creates a fulfillment for one or many fulfillment orders   该接口返回:"errors""Not Found"

请问是这两个参数传的问题吗?

fulfillment_order_id,id   如果是,我该如何传才正确
下面示例截图中说明了我怎么传的
请帮我看一下,谢谢
 
 

 

下面展示的事请求示例

1、Retrieves a list of draft orders

https://3ae227a45e2e8f939fac5e52c1a49eb0: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@3092237819.myshopify...

1.png

2、Creates a fulfillment for one or many fulfillment orders

https://3ae227a45e2e8f939fac5e52c1a49eb0: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@3092237819.myshopify...

{

    "fulfillment":{
        "message":"The package was shipped this morning.",
        "notify_customer":false,
        "tracking_info":{
            "number":993913503987,
            "url":"https:\/\/www.my-shipping-company.com",
            "company":"my-shipping-company"
        },
        "line_items_by_fulfillment_order":[
            {
                "fulfillment_order_id":993913503987,
                "fulfillment_order_line_items":[
                    {
                        "id":57717325005043,
                        "quantity":1
                    }
                ]
            }
        ]
    }
}

2.png

 

Tim_Mak
探路者
103 13 21

你不能给draft order创建fulfillment,要用普通order

你如果要创建测试订单,好像只能用前台手动下单:

https://help.shopify.com/en/manual/checkout-settings/test-orders

ljl
新成员
31 0 0

你看我理解的是否正确,

1、你所说的前台手动手动下单是指通过按钮在shopify官网实现fulfillment接口的功能。

但是有点说不通,shopify官方对于草稿订单是提供fulfillment接口的

2、但问题来了,如果需要调普通order的接口,是不是意味着要购买套餐

 

注:我再次描述一下我的需求,客户在shopify创建订单,在我的理解里,创建的应该是草稿订单,也就是没有产生运单号和面单的订单,然后我们第三方海外仓系统获取到shopify平台中的订单,提交发货出库后,获取到面单以及运单号,然后回传到shopify平台,当我们再次拉取时,就拉取不到之前的单子

 

 

 

ljl_0-1634519003756.png

 

Tim_Mak
探路者
103 13 21

你的理解不太正确

1. 草稿订单是商家创建的订单,一般用于商家创建定制订单,有单独折扣或者是特意派送要求等。一般shopify店铺很少用到草稿订单。

2. 我说的到前台下单是指到店铺前台去购买商品,模拟客户正常操作下的单

3.不需要购买套餐,可以下测试订单,请看我上面提供的链接: https://help.shopify.com/en/manual/checkout-settings/test-orders

你们可以完全忽略DraftOrder接口,如果我理解对了你们的需求你们用不到它

 

ljl
新成员
31 0 0

请问这样设置就可以了吗?请看我如图所示,但是我在创建正常订单时也需要购买套餐

3.png

 

1.png

 

 

 

Tim_Mak
探路者
103 13 21

请问有没有看我上面的链接?

不要通过api去创建订单,去店铺前台(xxx.myshopify.com)手动下单

ljl
新成员
31 0 0

 

我看到这个链接了,但是我不会设置 https://help.shopify.com/en/manual/checkout-settings/test-orders

我没有通过api去创建订单,我是通过图形化界面去下单的,但是需要选择套餐。

您讲的手动下单是不是要有某种设置,就如你上述文档中提的这样。

如果你能帮我设置一下,我将不胜感谢

 

1、现在创建不了正常订单就没办法调接口获取和回传状态,你帮我看一下如何把设置才能正常图形化界面创建

账号:3092237819@qq.com

密码:jiale654321

官方是这样描述的,请看如下文档

Tim_Mak
探路者
103 13 21

给你们添加了虚拟网关,但前台还是不让我结账。查看了下英文帖子,有可能现在shopify做了些限制,建议联系shopify客户打开结账功能

Tim_Mak_0-1634648979387.png

 

ljl
新成员
31 0 0

再次感谢您对我的提问做出来建设性的回答

以下是shopify官方客户为我做出的解答,那请问我的需求属于开发商店吗?我觉得应该不是

对于客户人员的这句话我不是很理解"除非,您是使用开发商店"

那现在我只有两种方案了

其一:购买套餐

其二:使用开发商店

你认为我能用第二种方案吗?

请问您对于第二种方案有了解吗,方便告诉我吗?

 

ljl_1-1634720600150.png

 

 

ljl_0-1634720593175.png

 

ljl
新成员
31 0 0

那就是必须要使用开发商店了,你对此有操作过吗,如果操作之后还能通过接口调用吗?你对这些有了解吗?谢谢

ljl_0-1634722169736.png

 

Tim_Mak
探路者
103 13 21

请在https://partners.shopify.com/ 创建合作伙伴账号,然后再创建一个开发店铺

ljl
新成员
31 0 0

您好,有个问题需要请教您,请问现在方便吗?

littleTree
Shopify Partner
4 0 0

可以的,你说

ljl
新成员
31 0 0

正如您描述的那样,我已经成功的通过开发商店创建到了正式订单,也通过API接口获取到订单集合

请看如下调用接口的示意图和示意代码

1、获取订单集合

ljl_0-1634809652140.png

https://8578cc2007111d6dff8ea7b92e6fd69f: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@redliuiot.myshopify....

{
    "orders": [
        {
            "id"3897756385380,
            "admin_graphql_api_id""gid://shopify/Order/3897756385380",
            "app_id"1354745,
            "browser_ip"null,
            "buyer_accepts_marketing"false,
            "cancel_reason"null,
            "cancelled_at"null,
            "cart_token"null,
            "checkout_id"23122729205860,
            "checkout_token""755bd1f381202b00b53da1501a293cc4",
            "client_details": {
                "accept_language"null,
                "browser_height"null,
                "browser_ip"null,
                "browser_width"null,
                "session_hash"null,
                "user_agent"null
            },
            "closed_at"null,
            "confirmed"true,
            "contact_email"null,
            "created_at""2021-10-21T17:16:26+08:00",
            "currency""USD",
            "current_subtotal_price""100.00",
            "current_subtotal_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "current_total_discounts""0.00",
            "current_total_discounts_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "current_total_duties_set"null,
            "current_total_price""106.63",
            "current_total_price_set": {
                "shop_money": {
                    "amount""106.63",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""106.63",
                    "currency_code""USD"
                }
            },
            "current_total_tax""6.63",
            "current_total_tax_set": {
                "shop_money": {
                    "amount""6.63",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""6.63",
                    "currency_code""USD"
                }
            },
            "customer_locale"null,
            "device_id"null,
            "discount_codes": [],
            "email""",
            "estimated_taxes"false,
            "financial_status""paid",
            "fulfillment_status"null,
            "gateway""manual",
            "landing_site"null,
            "landing_site_ref"null,
            "location_id"61114024036,
            "name""#1002",
            "note"null,
            "note_attributes": [],
            "number"2,
            "order_number"1002,
            "original_total_duties_set"null,
            "payment_gateway_names": [
                "manual"
            ],
            "phone"null,
            "presentment_currency""USD",
            "processed_at""2021-10-21T17:16:26+08:00",
            "processing_method""manual",
            "reference"null,
            "referring_site"null,
            "source_identifier"null,
            "source_name""shopify_draft_order",
            "source_url"null,
            "subtotal_price""100.00",
            "subtotal_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "tags""",
            "tax_lines": [
                {
                    "price""6.63",
                    "rate"0.06625,
                    "title""New Jersey State Tax",
                    "price_set": {
                        "shop_money": {
                            "amount""6.63",
                            "currency_code""USD"
                        },
                        "presentment_money": {
                            "amount""6.63",
                            "currency_code""USD"
                        }
                    },
                    "channel_liable"false
                }
            ],
            "taxes_included"false,
            "test"false,
            "token""b928d9759b7f611d3f4b540ef8f93d4b",
            "total_discounts""0.00",
            "total_discounts_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "total_line_items_price""100.00",
            "total_line_items_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "total_outstanding""0.00",
            "total_price""106.63",
            "total_price_set": {
                "shop_money": {
                    "amount""106.63",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""106.63",
                    "currency_code""USD"
                }
            },
            "total_price_usd""106.63",
            "total_shipping_price_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "total_tax""6.63",
            "total_tax_set": {
                "shop_money": {
                    "amount""6.63",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""6.63",
                    "currency_code""USD"
                }
            },
            "total_tip_received""0.00",
            "total_weight"45359,
            "updated_at""2021-10-21T17:16:27+08:00",
            "user_id"71512817764,
            "discount_applications": [],
            "fulfillments": [],
            "line_items": [
                {
                    "id"10176485720164,
                    "admin_graphql_api_id""gid://shopify/LineItem/10176485720164",
                    "fulfillable_quantity"1,
                    "fulfillment_service""manual",
                    "fulfillment_status"null,
                    "gift_card"false,
                    "grams"45359,
                    "name""HAT - RED",
                    "origin_location": {
                        "id"2973975347300,
                        "country_code""US",
                        "province_code""NJ",
                        "name""601 RANDOLPH RD",
                        "address1""601 RANDOLPH RD",
                        "address2""",
                        "city""SOMERSET",
                        "zip""08873"
                    },
                    "price""100.00",
                    "price_set": {
                        "shop_money": {
                            "amount""100.00",
                            "currency_code""USD"
                        },
                        "presentment_money": {
                            "amount""100.00",
                            "currency_code""USD"
                        }
                    },
                    "product_exists"true,
                    "product_id"6608633462884,
                    "properties": [],
                    "quantity"1,
                    "requires_shipping"true,
                    "sku""HAT",
                    "taxable"true,
                    "title""HAT",
                    "total_discount""0.00",
                    "total_discount_set": {
                        "shop_money": {
                            "amount""0.00",
                            "currency_code""USD"
                        },
                        "presentment_money": {
                            "amount""0.00",
                            "currency_code""USD"
                        }
                    },
                    "variant_id"39453535535204,
                    "variant_inventory_management""shopify",
                    "variant_title""RED",
                    "vendor""redliuiot",
                    "tax_lines": [
                        {
                            "channel_liable"false,
                            "price""6.63",
                            "price_set": {
                                "shop_money": {
                                    "amount""6.63",
                                    "currency_code""USD"
                                },
                                "presentment_money": {
                                    "amount""6.63",
                                    "currency_code""USD"
                                }
                            },
                            "rate"0.06625,
                            "title""New Jersey State Tax"
                        }
                    ],
                    "duties": [],
                    "discount_allocations": []
                }
            ],
            "payment_terms"null,
            "refunds": [],
            "shipping_lines": []
        },
        {
            "id"3897754452068,
            "admin_graphql_api_id""gid://shopify/Order/3897754452068",
            "app_id"1354745,
            "browser_ip"null,
            "buyer_accepts_marketing"false,
            "cancel_reason"null,
            "cancelled_at"null,
            "cart_token"null,
            "checkout_id"23122704728164,
            "checkout_token""ee6bc35bc9b4214d4a0288c2232aa0fb",
            "client_details": {
                "accept_language"null,
                "browser_height"null,
                "browser_ip"null,
                "browser_width"null,
                "session_hash"null,
                "user_agent"null
            },
            "closed_at"null,
            "confirmed"true,
            "contact_email"null,
            "created_at""2021-10-21T17:12:36+08:00",
            "currency""USD",
            "current_subtotal_price""100.00",
            "current_subtotal_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "current_total_discounts""0.00",
            "current_total_discounts_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "current_total_duties_set"null,
            "current_total_price""106.63",
            "current_total_price_set": {
                "shop_money": {
                    "amount""106.63",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""106.63",
                    "currency_code""USD"
                }
            },
            "current_total_tax""6.63",
            "current_total_tax_set": {
                "shop_money": {
                    "amount""6.63",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""6.63",
                    "currency_code""USD"
                }
            },
            "customer_locale"null,
            "device_id"null,
            "discount_codes": [],
            "email""",
            "estimated_taxes"false,
            "financial_status""paid",
            "fulfillment_status"null,
            "gateway""manual",
            "landing_site"null,
            "landing_site_ref"null,
            "location_id"61114024036,
            "name""#1001",
            "note"null,
            "note_attributes": [],
            "number"1,
            "order_number"1001,
            "original_total_duties_set"null,
            "payment_gateway_names": [
                "manual"
            ],
            "phone"null,
            "presentment_currency""USD",
            "processed_at""2021-10-21T17:12:36+08:00",
            "processing_method""manual",
            "reference"null,
            "referring_site"null,
            "source_identifier"null,
            "source_name""shopify_draft_order",
            "source_url"null,
            "subtotal_price""100.00",
            "subtotal_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "tags""",
            "tax_lines": [
                {
                    "price""6.63",
                    "rate"0.06625,
                    "title""New Jersey State Tax",
                    "price_set": {
                        "shop_money": {
                            "amount""6.63",
                            "currency_code""USD"
                        },
                        "presentment_money": {
                            "amount""6.63",
                            "currency_code""USD"
                        }
                    },
                    "channel_liable"false
                }
            ],
            "taxes_included"false,
            "test"false,
            "token""ed04787c3fc13d8c39077abfd17b4b21",
            "total_discounts""0.00",
            "total_discounts_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "total_line_items_price""100.00",
            "total_line_items_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "total_outstanding""0.00",
            "total_price""106.63",
            "total_price_set": {
                "shop_money": {
                    "amount""106.63",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""106.63",
                    "currency_code""USD"
                }
            },
            "total_price_usd""106.63",
            "total_shipping_price_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "total_tax""6.63",
            "total_tax_set": {
                "shop_money": {
                    "amount""6.63",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""6.63",
                    "currency_code""USD"
                }
            },
            "total_tip_received""0.00",
            "total_weight"45359,
            "updated_at""2021-10-21T17:12:37+08:00",
            "user_id"71512817764,
            "discount_applications": [],
            "fulfillments": [],
            "line_items": [
                {
                    "id"10176482803812,
                    "admin_graphql_api_id""gid://shopify/LineItem/10176482803812",
                    "fulfillable_quantity"1,
                    "fulfillment_service""manual",
                    "fulfillment_status"null,
                    "gift_card"false,
                    "grams"45359,
                    "name""HAT - RED",
                    "origin_location": {
                        "id"2973975347300,
                        "country_code""US",
                        "province_code""NJ",
                        "name""601 RANDOLPH RD",
                        "address1""601 RANDOLPH RD",
                        "address2""",
                        "city""SOMERSET",
                        "zip""08873"
                    },
                    "price""100.00",
                    "price_set": {
                        "shop_money": {
                            "amount""100.00",
                            "currency_code""USD"
                        },
                        "presentment_money": {
                            "amount""100.00",
                            "currency_code""USD"
                        }
                    },
                    "product_exists"true,
                    "product_id"6608633462884,
                    "properties": [],
                    "quantity"1,
                    "requires_shipping"true,
                    "sku""HAT",
                    "taxable"true,
                    "title""HAT",
                    "total_discount""0.00",
                    "total_discount_set": {
                        "shop_money": {
                            "amount""0.00",
                            "currency_code""USD"
                        },
                        "presentment_money": {
                            "amount""0.00",
                            "currency_code""USD"
                        }
                    },
                    "variant_id"39453535535204,
                    "variant_inventory_management""shopify",
                    "variant_title""RED",
                    "vendor""redliuiot",
                    "tax_lines": [
                        {
                            "channel_liable"false,
                            "price""6.63",
                            "price_set": {
                                "shop_money": {
                                    "amount""6.63",
                                    "currency_code""USD"
                                },
                                "presentment_money": {
                                    "amount""6.63",
                                    "currency_code""USD"
                                }
                            },
                            "rate"0.06625,
                            "title""New Jersey State Tax"
                        }
                    ],
                    "duties": [],
                    "discount_allocations": []
                }
            ],
            "payment_terms"null,
            "refunds": [],
            "shipping_lines": []
        }
    ]
}
2、回传追踪号和面单
ljl_1-1634809786338.png

 

req body:
{    
    "fulfillment": {
        "message""The package was shipped this morning.",
        "notify_customer"false,
        "tracking_info": {
            "number"1562678,
            "url""https:\/\/www.my-shipping-company.com",
            "company""my-shipping-company"
        },
        "line_items_by_fulfillment_order": [{
            "fulfillment_order_id"3897756385380,
            "fulfillment_order_line_items": [{
                "id"10176485720164,
                "quantity"1
            }]
        }]
    }
}
resp body:
{
    "errors""Not Found"
}
 
一如既往,还是没找到
 ljl_2-1634810356172.png

您那边可否可以根据我的请求示例帮我调一下fulfillments接口,使他能够完成运单号和面单数据的回传

 
 

 

ljl
新成员
31 0 0

https://accounts.shopify.com/lookup?rid=2de5ccd0-3d54-4cdd-8fcd-a220c6ee454d

1、邮箱登录

继续访问 Shopify:1614516281@qq.com

密码:jiale654321

 

 

ljl_0-1634812072239.png

2、请选择此账户

ljl_1-1634812289548.png

3、成功进入此页面后就可以看到创建的正式订单

ljl_2-1634812342260.png

根据我的请求示例,请帮我看一下调用fulfillments接口为什么返回

Not Found错误信息
如下是两个接口的请求信息
{    
    "fulfillment": {
        "message""The package was shipped this morning.",
        "notify_customer"false,
        "tracking_info": {
            "number"1562678,
            "url""https:\/\/www.my-shipping-company.com",
            "company""my-shipping-company"
        },
        "line_items_by_fulfillment_order": [{
            "fulfillment_order_id"3897756385380,
            "fulfillment_order_line_items": [{
                "id"10176485720164,
                "quantity"1
            }]
        }]
    }
}
万分感谢
 
ljl
新成员
31 0 0

https://accounts.shopify.com/lookup?rid=2de5ccd0-3d54-4cdd-8fcd-a220c6ee454d

1、邮箱登录

继续访问 Shopify:1614516281@qq.com

密码:jiale654321

 

 

ljl_0-1634812072239.png

2、请选择此账户

ljl_1-1634812289548.png

3、成功进入此页面后就可以看到创建的正式订单

ljl_2-1634812342260.png

根据我的请求示例,请帮我看一下调用fulfillments接口为什么返回

Not Found错误信息
如下是两个接口的请求信息
{    
    "fulfillment": {
        "message""The package was shipped this morning.",
        "notify_customer"false,
        "tracking_info": {
            "number"1562678,
            "url""https:\/\/www.my-shipping-company.com",
            "company""my-shipping-company"
        },
        "line_items_by_fulfillment_order": [{
            "fulfillment_order_id"3897756385380,
            "fulfillment_order_line_items": [{
                "id"10176485720164,
                "quantity"1
            }]
        }]
    }
}
万分感谢
 
Tim_Mak
探路者
103 13 21

要用另一个接口,刚才发了请求已完成发货

接口(POST):/orders/3897756385380/fulfillments.json

body:

{
    "fulfillment":{
        "location_id": 61114024036,
        "tracking_number":"1562678",
        "tracking_urls":["https:\/\/www.my-shipping-company.com"]
         }
}

(location_id 是设置》地点》链接尾部 来的)

 

然后现在如果get /2021-10/orders.json 就不会获取已发货的订单

ljl
新成员
31 0 0

我这边测试同样也成功了,谢谢您

Tim_Mak
探路者
103 13 21

那就好

订单发货之后也会把订单标记为关闭(closed)

如果要获取已关闭的订单,要加orders.json?status=any或status=closed(默认是open)

ljl
新成员
31 0 0

好的,明白了,现在只是根据需求调通了接口,后期可能会根据请求参数和请求体完成进行细致化的处理

 

ljl
新成员
31 0 0

1、目前接口已经调通了,应该不需要操作获取授权这一步吧

https://shopify.dev/apps/auth/oauth

2、在调获取订单接口时,shopify官方可以按照时间段来获取订单,API中提供的日期格式是这样的2005-07-31T15:57:11-04:00,我也转化成这样吗?重点是-04:00,你有转成这种时间格式的Java代码吗?

ljl_0-1635067220174.png

 

ljl
新成员
31 0 0

1、目前接口已经调通了,应该不需要操作获取授权这一步吧

https://shopify.dev/apps/auth/oauth

2、在调获取订单接口时,shopify官方可以按照时间段来获取订单,API中提供的日期格式是这样的2005-07-31T15:57:11-04:00,我也转化成这样吗?重点是-04:00,你有转成这种时间格式的Java代码吗?

ljl_0-1635067220174.png

 

ljl
新成员
31 0 0

您好,有个问题想问您一下,在创建正式订单的时候,可以指定渠道吗?

有们这边有一个需求,需要通过shopify平台店铺中订单的渠道,去匹配我们系统中指定的渠道,如果匹配上了,我就可以用这个渠道发货,请求shopifyf在建单时可以指定渠道吗?如果可以,方便告诉我在哪一步指定吗?

还有个问题2021-10-25T17:18:27+08:00,这是获取的中国时间,我用这个时间减掉8个小时才能获取到当下创建的订单,也就是说我如果在拉取shopify平台的订单,我在中国根据指定时间日期去拉取,拉的是8个小时以前的订单

 

ljl_0-1635152914162.png

 

https://8578cc2007111d6dff8ea7b92e6fd69f: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@redliuiot.myshopify....

{
    "orders": [
        {
            "id"3901351919716,
            "admin_graphql_api_id""gid://shopify/Order/3901351919716",
            "app_id"1354745,
            "browser_ip"null,
            "buyer_accepts_marketing"false,
            "cancel_reason"null,
            "cancelled_at"null,
            "cart_token"null,
            "checkout_id"23170614100068,
            "checkout_token""215f7af4c24162d06a55a631d712424b",
            "client_details": {
                "accept_language"null,
                "browser_height"null,
                "browser_ip"null,
                "browser_width"null,
                "session_hash"null,
                "user_agent"null
            },
            "closed_at"null,
            "confirmed"true,
            "contact_email""111111@qq.com",
            "created_at""2021-10-25T14:36:20+08:00",
            "currency""USD",
            "current_subtotal_price""100.00",
            "current_subtotal_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "current_total_discounts""0.00",
            "current_total_discounts_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "current_total_duties_set"null,
            "current_total_price""100.00",
            "current_total_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "current_total_tax""0.00",
            "current_total_tax_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "customer_locale""zh-CN",
            "device_id"null,
            "discount_codes": [],
            "email""111111@qq.com",
            "estimated_taxes"false,
            "financial_status""paid",
            "fulfillment_status"null,
            "gateway""manual",
            "landing_site"null,
            "landing_site_ref"null,
            "location_id"null,
            "name""#1018",
            "note""测试面单",
            "note_attributes": [],
            "number"18,
            "order_number"1018,
            "original_total_duties_set"null,
            "payment_gateway_names": [
                "manual"
            ],
            "phone"null,
            "presentment_currency""USD",
            "processed_at""2021-10-25T14:36:20+08:00",
            "processing_method""manual",
            "reference"null,
            "referring_site"null,
            "source_identifier"null,
            "source_name""shopify_draft_order",
            "source_url"null,
            "subtotal_price""100.00",
            "subtotal_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "tags""",
            "tax_lines": [],
            "taxes_included"false,
            "test"false,
            "token""3aa74d1e15221a7b6890377c4a7267c8",
            "total_discounts""0.00",
            "total_discounts_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "total_line_items_price""100.00",
            "total_line_items_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "total_outstanding""0.00",
            "total_price""100.00",
            "total_price_set": {
                "shop_money": {
                    "amount""100.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""100.00",
                    "currency_code""USD"
                }
            },
            "total_price_usd""100.00",
            "total_shipping_price_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "total_tax""0.00",
            "total_tax_set": {
                "shop_money": {
                    "amount""0.00",
                    "currency_code""USD"
                },
                "presentment_money": {
                    "amount""0.00",
                    "currency_code""USD"
                }
            },
            "total_tip_received""0.00",
            "total_weight"45359,
            "updated_at""2021-10-25T14:36:21+08:00",
            "user_id"71512817764,
            "billing_address": {
                "first_name""test",
                "address1""1200  Westport Rd",
                "phone""+11234567890",
                "city""Imperial",
                "zip""15126-1002",
                "province""Pennsylvania",
                "country""United States",
                "last_name""test",
                "address2""",
                "company""test",
                "latitude"40.4502542,
                "longitude"-80.3158926,
                "name""test test",
                "country_code""US",
                "province_code""PA"
            },
            "customer": {
                "id"5257612558436,
                "email""111111@qq.com",
                "accepts_marketing"false,
                "created_at""2021-10-22T09:27:57+08:00",
                "updated_at""2021-10-25T14:36:21+08:00",
                "first_name""test",
                "last_name""test",
                "orders_count"15,
                "state""disabled",
                "total_spent""1500.00",
                "last_order_id"3901351919716,
                "note"null,
                "verified_email"true,
                "multipass_identifier"null,
                "tax_exempt"false,
                "phone"null,
                "tags""",
                "last_order_name""#1018",
                "currency""USD",
                "accepts_marketing_updated_at""2021-10-22T09:27:57+08:00",
                "marketing_opt_in_level"null,
                "tax_exemptions": [],
                "sms_marketing_consent"null,
                "admin_graphql_api_id""gid://shopify/Customer/5257612558436",
                "default_address": {
                    "id"6454376005732,
                    "customer_id"5257612558436,
                    "first_name""test",
                    "last_name""test",
                    "company""test",
                    "address1""1200  Westport Rd",
                    "address2""",
                    "city""Imperial",
                    "province""Pennsylvania",
                    "country""United States",
                    "zip""15126-1002",
                    "phone""+11234567890",
                    "name""test test",
                    "province_code""PA",
                    "country_code""US",
                    "country_name""United States",
                    "default"true
                }
            },
            "discount_applications": [],
            "fulfillments": [],
            "line_items": [
                {
                    "id"10184054964324,
                    "admin_graphql_api_id""gid://shopify/LineItem/10184054964324",
                    "destination_location": {
                        "id"2975341346916,
                        "country_code""US",
                        "province_code""PA",
                        "name""testtest",
                        "address1""1200  Westport Rd",
                        "address2""",
                        "city""Imperial",
                        "zip""15126-1002"
                    },
                    "fulfillable_quantity"1,
                    "fulfillment_service""manual",
                    "fulfillment_status"null,
                    "gift_card"false,
                    "grams"45359,
                    "name""HAT - RED",
                    "origin_location": {
                        "id"2974544560228,
                        "country_code""US",
                        "province_code""NJ",
                        "name""redliuiot",
                        "address1""601 RANDOLPH RD",
                        "address2""",
                        "city""SOMERSET",
                        "zip""08873"
                    },
                    "price""100.00",
                    "price_set": {
                        "shop_money": {
                            "amount""100.00",
                            "currency_code""USD"
                        },
                        "presentment_money": {
                            "amount""100.00",
                            "currency_code""USD"
                        }
                    },
                    "product_exists"true,
                    "product_id"6608633462884,
                    "properties": [],
                    "quantity"1,
                    "requires_shipping"true,
                    "sku""HAT",
                    "taxable"true,
                    "title""HAT",
                    "total_discount""0.00",
                    "total_discount_set": {
                        "shop_money": {
                            "amount""0.00",
                            "currency_code""USD"
                        },
                        "presentment_money": {
                            "amount""0.00",
                            "currency_code""USD"
                        }
                    },
                    "variant_id"39453535535204,
                    "variant_inventory_management""shopify",
                    "variant_title""RED",
                    "vendor""redliuiot",
                    "tax_lines": [],
                    "duties": [],
                    "discount_allocations": []
                }
            ],
            "payment_terms"null,
            "refunds": [],
            "shipping_address": {
                "first_name""test",
                "address1""1200  Westport Rd",
                "phone""+11234567890",
                "city""Imperial",
                "zip""15126-1002",
                "province""Pennsylvania",
                "country""United States",
                "last_name""test",
                "address2""",
                "company""test",
                "latitude"40.4502542,
                "longitude"-80.3158926,
                "name""test test",
                "country_code""US",
                "province_code""PA"
            },
            "shipping_lines": []
        }
    ]
}
Tim_Mak
探路者
103 13 21

1. 可以,如果店铺有设置物流选项,他们会在订单的shipping_lines这一条显示

2. 你们指定时间是什么目的?有好几个不同的用法,created_at_max是指定时间以前的订单,created_at_min是指定时间以后的订单

ljl
新成员
31 0 0

我不是很清楚店铺物流选项在哪里设置,方便截图告诉我吗?

这是shopify平台告诉我的,他不建议我这样做

了解,Shopify的后台设计中,发货和选择物流商是同一个动作(因为一般来说要发货的话才会选择物流商)

因此建议您可以在确认物流商后,再选择发货并选择该物流商

请问以上说明是否有不清楚,或是其他能帮助您的部分呢?

这次对话给您的体验如何?期待您的反馈
/

Tim_Mak
探路者
103 13 21

我想了下,更好的方案应该是按location_id去区分

shopify店铺可以有多个发货地点,每个都有单独的location_id

这个location_id是可以获取订单的时候得知

ljl
新成员
31 0 0

我看了一下,此方案不可行,因为订单状态为未发货状态时,当调取获取订单接口时,是获取不到订单location_id,当调fulfillments回传运单号和面单信息才传location_id,还有别的可行方案吗?当我获取到未发货状态的订单时,就能使用使用某参数用于我来做一个渠道映射

ljl
新成员
31 0 0

此问题已得到解决,我们系统如果同步过来的订单如果没有指定渠道,是可以在我们系统选择的,谢谢

MrWang
观光客
4 0 1

您好 我现在也执行到这一步,遇到了和您一样的问题,前面的步骤和您一样也是调用/admin/api/2022-10/orders.json获取订单信息,然后调用/admin/api/2022-10/fulfillments.json这个接口进行发货,我有三个值,不知道传的对不对,tracking_info->number 这个不知道从哪里获取;

line_items_by_fulfillment_order->fulfillment_order_id,这个是订单信息接口里的订单id吗;
line_items_by_fulfillment_order->fulfillment_order_line_item->id 这是订单接口中line_item下的id吗
zsh
Shopify Partner
3 0 0

你发货成功了吗?

haotingfang
Shopify Partner
2 0 0

你好 我也有一样的疑问,请问解决了吗

littleTree
Shopify Partner
4 0 0

我也打算对接发货,也是遇到了问题,实际上应该是使用哪个发货回传接口:

1、/admin/api/2021-10/orders/450789469/fulfillments.json

2、/admin/api/2021-10/fulfillments.json

Tim_Mak
探路者
103 13 21

发货回传要用/admin/api/2021-10/fulfillments.json

Libby123
访客
2 0 0

你好,请问 你是用什么编辑器编辑的?

ljl
新成员
31 0 0

您好,现在在开发中又遇到一个问题

通过postman正常调接口是没有问题的

ljl_0-1635042929887.png

但是程序中调却出现了问题

{
       "errors": {
              "fulfillment": "Required parameter missing or invalid"
       }
}

我尝试着将程序中的url,请求体拿出来,通过postman利用它的post方式调该 接口,是完全没有问题的,你知道这是怎么产生的吗?

ljl
新成员
31 0 0

不好意思,周末还来打然您,不过看了一些博客,问题得到了解决

Snipaste_2021-10-24_10-52-17.png

ljl
新成员
31 0 0

非常感谢,我明白了

ljl
新成员
31 0 0

我的问题还没有问,方便回复我后面的疑问吗?

littleTree
Shopify Partner
4 0 0

shopify的token有效期是多久?

zsh
Shopify Partner
3 0 0

我现在用 /admin/api/2022-10/fulfillments.json  这个接口进行发货,这是我的代码

        $fulfillment = new \Shopify\Rest\Admin2022_10\Fulfillment($offlineSession);

$fulfillment->message = "The package was shipped this morning.";
$fulfillment->notify_customer = false;
$fulfillment->tracking_info = [
"number" => 9400111202565851502441,
"url" => "https://www.usps.com",
"company" => "USPS"
];
$fulfillment->line_items_by_fulfillment_order = [
[
"fulfillment_order_id" => $orderId,
// 'fulfillment_order_line_items' => [
// [
// 'id' => 13646186512706,
// 'quantity' => 1
// ]
// ]
]
];
$fulfillment->save(true);

但是调用返回错误

 REST request failed: "Not Found"

请教一下这是什么原因?

 

我是使用的测试帐号,还没有进行审核,商店是开发商店,订单是手动在商店创建的