I'm building a simple order validation microservice for my Shopify store. Basically, the microservice will validate new orders and automatically cancel them is there is some kind of validation error (compliance reasons). I'm looking at the Shopify orders API, but it's still not completely clear to me the proper way to use it.
https://shopify.dev/docs/admin-api/rest/reference/orders/order#cancel-2020-01
This microservice would be triggered by the "Order created" web hook, so there is no concern that the order is partially or completely fulfilled.
What I want to do is to cancel the order, refund the payment to the customer, add a note, and restock the items. How can I do this with the Shopify API?