Reputation: 77
What is the difference between Order Creation and Order Payment in the webhooks API?
I need a webhook such that everytime an order is made using Cash On Delivery (COD) option, I need a notification to the provided callback URL. Which event should I use?
I guess, it is not possible to get the notification only for COD orders but instead we get one for every order. But then, how do I differentiate COD orders from others? Assuming, 'gateway' parameter provides that info, what does its value contain 'cod' or 'cash on delivery' or something else?
Upvotes: 0
Views: 1188
Reputation: 2756
There's no specific Shopify webhook for orders with gateway = COD
By default, Shopify names the Cash on Delivery gateway exactly: Cash on Delivery (COD)
As you can see in the dropdown, you can add as many "Manual Payments" as you want by clicking on "Custom payment method". You could also change or edit the previously mentioned to COD alone.
If you want to test your webhook, and either see a test notification with sample data or place an order yourself to see how the data looks like when an order is created at your Shopify store, go to RequestBin, and click on +Create a RequestBin, you'll get an URL which will look like
Copy that url. Go to your Shopify admin, click on Notifications and scroll down to the Webhooks section. Click on create a webhook and a popup will show where you'll be able to choose which event you want to be notified about (in this case choose order creation), the URL where you want the data to be sent to (in this case: http://requestb.in/o3oggto3), and the format of the data (either XML or JSON).
Once the webhook is created you can click on "send test notification" or place an order yourself at your store.
Go back to RequestBin, and refresh the same page which gave you the webhook URL or click on a green dot on the right upper side, and you'll get all the data as shown below.
Upvotes: 2