shopify回传订单

已解决
ljl
新成员
29 0 0

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

38 条回复38
ljl
新成员
29 0 0

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

ljl_0-1634722169736.png

 

Tim_Mak
探路者
99 11 12

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

ljl
新成员
29 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
新成员
29 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
新成员
29 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
探路者
99 11 12

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

接口(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
新成员
29 0 0

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

Tim_Mak
探路者
99 11 12

那就好

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

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

ljl
新成员
29 0 0

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

 

ljl
新成员
29 0 0

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

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

ljl_0-1635042929887.png

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

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

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