Shopify 订单网络钩子 [英] Shopify order webhooks

查看:68
本文介绍了Shopify 订单网络钩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了不同顺序的 webhook,想知道它们何时被触发.这是我目前想到的:

I looked into the different order webhooks and was wondering when they are triggered. This is what I figured out so far:

  1. orders/updated 每当订单以任何方式更改时都会被触发,包括在创建订单时(甚至在订单被授权和 orders/create 被触发之前)、关闭或取消
  2. orders/create 在用户授权支付时触发
  3. orders/paid 在商家接受付款时触发
  4. orders/fulfilled 在商家履行订单时触发
  5. orders/cancelled 在订单取消时触发
  1. orders/updated is fired whenever an order is changed in any way, including when an order is created (even before it was authorized and orders/create is fired), closed or cancelled
  2. orders/create is fired when the user authorizes the payment
  3. orders/paid is fired when the merchant accepts the payment
  4. orders/fulfilled is fired when the merchant fulfills the order
  5. orders/cancelled is fired when the order is cancelled

因为 orders/updated 也会在其他钩子被触发时被触发,似乎添加一个更新网络钩子就足以保持本地数据存储与商店数据同步.但是,我想确认我对这些 webhooks 的理解是正确的,即每当订单以任何方式发生变化时总是会触发 orders/updated 是真的.并且其他 webhook 只是针对更具体的用例?

Since orders/updated is also fired whenever the other hooks are fired, it seems as if adding an update webhook would be good enough for keeping a local datastore synced to the shop data. However, I want to confirm that my understanding of those webhooks is correct, i.e. is it true that orders/updated is always fired whenever an order changes in any way. and that the other webhooks are just aimed at more specific use cases?

推荐答案

我想说的是为了让代码更容易理解,处理适当的 webhooks 只是为了让代码更容易理解符合你的最大利益.

I'd say for sake of keeping the code easier to understand it would be in your best interest to handle the appropriate webhooks just to keep the code easier to understand.

如果您所做的只是跟踪非常一般的东西,那可能没问题.

If all you're doing is tracking really general stuff, it's probably fine.

此外,在订单的所有状态更改时,都会触发 orders/updated 网络钩子.

Also, on all state changes of an order the orders/updated webhook is fired.

这篇关于Shopify 订单网络钩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆