{"_id":"58112e72ded0340f0085d057","user":"55f2fd49b5b25021002b7dfd","__v":1,"project":"551e85be610f400d00837db7","category":{"_id":"58112e72ded0340f0085d033","project":"551e85be610f400d00837db7","version":"58112e71ded0340f0085d02a","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-25T13:57:54.835Z","from_sync":false,"order":8,"slug":"api-resources","title":"Merchant API Resources"},"parentDoc":null,"version":{"_id":"58112e71ded0340f0085d02a","project":"551e85be610f400d00837db7","__v":4,"createdAt":"2016-10-26T22:30:09.862Z","releaseDate":"2016-10-26T22:30:09.862Z","categories":["58112e72ded0340f0085d02b","58112e72ded0340f0085d02c","58112e72ded0340f0085d02d","58112e72ded0340f0085d02e","58112e72ded0340f0085d02f","58112e72ded0340f0085d030","58112e72ded0340f0085d031","58112e72ded0340f0085d032","58112e72ded0340f0085d033","58112e72ded0340f0085d034","581137cc604d3c230048b7e4","58dc367221742d0f00a73f98","590768e54669da0f00db5c0b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"new designer","version_clean":"2.0.0","version":"2.0"},"updates":["587e7274a9ad983100112985"],"next":{"pages":[],"description":""},"createdAt":"2015-09-18T19:04:40.651Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":13,"body":"[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  http://api.cratejoy.com/v1/hooks/\\n</div>\\n\\n<style>\\n.endpoint{\\n  font-family: Monaco, Menlo, Consolas, \\\"Courier New\\\", monospace;\\n  font-size: 14px;\\n  background-color: #f9f9f9;\\n  padding: 5px 15px;\\n</style>\"\n}\n[/block]\n## Hook Definition\n\n* `event` (string): name of a cratejoy event that will trigger this hook\n* `request_type` (string): either `POST` or `GET`, which http method cratejoy should use to talk to your endpoint\n  * When using a `POST`, cratejoy will post a json object with all data associated with the event to your endpoint\n  * When using a `GET`, since there are length limitations on querystrings you must specify the query and values you want cratejoy to send\n* `target` (string): the URI of your endpoint\n* `name` (string): For your own use in managing your hooks\n* `querystring` (string): Optional use for GET type targets\n\n## Payload\n\nWe currently deliver payloads as escaped JSON strings. Please be aware that this can confuse some parsers and cause errors if the parsers are only setup to accept valid JSON.\n\n## Available Events\n\nThese events fire near real time as their triggers occur on the platform.  They are one callback to one event, and the payloads are the models that are triggering the event.\n\n Event Name | Description | Available Payload\n------------|-------------|-------------------\n `checkout_failed` | One of your customers attempted to checkout but failed due to invalid input, or payment | `Customer` and `Order` Model\n `customer_new` | A new user has registered on your store.  This can happen as part of a checkout, or independently. | `Customer` model\n `address_updated` | A customer address has been updated | `Customer` indicating new sub models\n `billing_updated` | A customer billing record has been updated | `Customer` indicating new sub models\n `design_updated` | You or one of your team have updated a design entry on your store | {'theme_name': 'mytheme', 'file_changed': 'html/index.html' }\n `inventory_updated` | Inventory on a product was updated | `Inventory` and `Product` model\n `order_updated` | You cancelled or changed the status of an order | `Order` model\n `order_new` | An order has been successfully placed on your store. | `Order` model\n `shipment_cancelled` | You cancelled a shipment | `Shipment` model\n `shipment_shipped` | You marked a package as shipped | `Shipment` model\n `subscription_cancelled` | You or your customer cancelled a subscription | `Subscription` model\n `subscription_new` | A subscription has been created on your store. |  `Subscription` model\n `subscription_renew_failed` | A subscription did not successfully charge on its renewal date | `Subscription` model\n `subscription_renewed` | A subscription has successfully paid for a new cycle and generated new shipments | `Subscription` model\n `subscription_updated` | One of your customers updated their subscription variants, terms, or products for their next renewal | `Subscription` model indicating new subscription state\n `transaction_new` | A new transaction was created | `Transaction` and `Order` models","excerpt":"","slug":"hook","type":"basic","title":"Web Hook"}
[block:html] { "html": "<div class=\"endpoint\">\n http://api.cratejoy.com/v1/hooks/\n</div>\n\n<style>\n.endpoint{\n font-family: Monaco, Menlo, Consolas, \"Courier New\", monospace;\n font-size: 14px;\n background-color: #f9f9f9;\n padding: 5px 15px;\n</style>" } [/block] ## Hook Definition * `event` (string): name of a cratejoy event that will trigger this hook * `request_type` (string): either `POST` or `GET`, which http method cratejoy should use to talk to your endpoint * When using a `POST`, cratejoy will post a json object with all data associated with the event to your endpoint * When using a `GET`, since there are length limitations on querystrings you must specify the query and values you want cratejoy to send * `target` (string): the URI of your endpoint * `name` (string): For your own use in managing your hooks * `querystring` (string): Optional use for GET type targets ## Payload We currently deliver payloads as escaped JSON strings. Please be aware that this can confuse some parsers and cause errors if the parsers are only setup to accept valid JSON. ## Available Events These events fire near real time as their triggers occur on the platform. They are one callback to one event, and the payloads are the models that are triggering the event. Event Name | Description | Available Payload ------------|-------------|------------------- `checkout_failed` | One of your customers attempted to checkout but failed due to invalid input, or payment | `Customer` and `Order` Model `customer_new` | A new user has registered on your store. This can happen as part of a checkout, or independently. | `Customer` model `address_updated` | A customer address has been updated | `Customer` indicating new sub models `billing_updated` | A customer billing record has been updated | `Customer` indicating new sub models `design_updated` | You or one of your team have updated a design entry on your store | {'theme_name': 'mytheme', 'file_changed': 'html/index.html' } `inventory_updated` | Inventory on a product was updated | `Inventory` and `Product` model `order_updated` | You cancelled or changed the status of an order | `Order` model `order_new` | An order has been successfully placed on your store. | `Order` model `shipment_cancelled` | You cancelled a shipment | `Shipment` model `shipment_shipped` | You marked a package as shipped | `Shipment` model `subscription_cancelled` | You or your customer cancelled a subscription | `Subscription` model `subscription_new` | A subscription has been created on your store. | `Subscription` model `subscription_renew_failed` | A subscription did not successfully charge on its renewal date | `Subscription` model `subscription_renewed` | A subscription has successfully paid for a new cycle and generated new shipments | `Subscription` model `subscription_updated` | One of your customers updated their subscription variants, terms, or products for their next renewal | `Subscription` model indicating new subscription state `transaction_new` | A new transaction was created | `Transaction` and `Order` models