question

drboolean avatar image
drboolean asked drboolean commented

REST Order create...no webhook?

Hi!

I'm trying to test webhooks. I can see they are setup correctly as live data does come though. However, I cannot seem to get it to trigger a webhook when I create an order through the REST api.

Any help is much appreciated.

-Brian

Orders
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

voski avatar image voski commented ·

Can you verify your permission settings for that merchant? https://docs.clover.com/build/permissions/ Are you getting POST requests for other orders related activities? I won't be able to test this myself until next week.

0 Likes 0 ·
drboolean avatar image drboolean commented ·

Hi Voski! I've checked the permissions for the REST api and the webhook subscription. I see orders coming in when a live orders i created, but not when my test api one is made. Perhaps I'm missing a required field? My order looks something like {title: "webhooktest", state: "OPEN"}

0 Likes 0 ·
drboolean avatar image
drboolean answered

Hi Voski!

I've checked the permissions for the REST api and the webhook subscription.

I see orders coming in when a live orders i created, but not when my test api one is made. Perhaps I'm missing a required field?

My order looks something like {title: "webhooktest", state: "OPEN"}

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

voski avatar image
voski answered

You don't need to pass any data it will create an order for you.

I am assuming you have a merchant account that you are testing. Lets get an API token for that account. Login to your merchant then go to Setup > API Tokens. Fill out a name then click generate. Make sure to set orders permissions.

Now with the api token you can either navigate to https://www.clover.com/api_docs#!/ord... on the top right of this page you can set your API token and mId.

You can also run this on terminal with the token and merchantId if you prefer to do that. These should generate an order for you and you should see it in your webhook.

curl -X POST https://api.clover.com/v3/merchants/{mId}/orders --header "Authorization:Bearer {api token}" | python -mjson.tool

If you don't have python don't worry about piping it just makes the JSON easier to read.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

drboolean avatar image
drboolean answered

Hi Voski. I think there may be some confusion. I can definitely create orders via the REST api. They show up in the UI and things are good.

I ran the curl above and it came back with the new order json (id and everything), but I didn't see any webhook.

I reverified with a new token on our DEV server and tried again to no avail.

I set it up exactly the same for our live account and I see webhooks coming in when real orders/customers are made at the terminal.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community