Understanding Auto Order Webhooks
Introduction
The purpose of this document is to explain how auto order webhooks operate. First let’s re-cap what an auto order is. An auto order is an object that handles repeat processing of items in a sequence. An auto order is created when a customer first purchases an item configured with an auto order schedule. That means there is a 1:1 relationship between an auto order and the original order that the customer purchased. Within the REST API this is referred to as the reference_order_id.
Webhook Overview
Next let’s cover the webhooks associated with auto orders and provide a brief description. The table below is going to show them in the order in which they can occur instead of alphabetized.
| Webhook | Description |
|---|---|
| auto_order_create | The create webhook is fired after the payment on the original order is processed successfully. At this point the auto order is activated. |
| auto_order_update | The update webhook is fired whenever an update to the auto order record is performed within the UltraCart system. This can be caused by other REST API calls or users performing changes to the auto order. |
| auto_order_rebill | The rebill webhook is fired whenever an auto order is successfully processed and generates a new order. |
| Sequence | Webhooks Fired |
|---|---|
| Order #1 <– Start subscription with an auto order | auto_order_create |
| Order #2 (auto order) | auto_order_rebill + auto_order_update |
| Order #3 (auto order) | auto_order_rebill + auto_order_update |
| Order #4 (auto order) | auto_order_rebill + auto_order_update |
| Attempt to charge for Order #5 failed. | auto_order_decline |
| Order #5 (auto order) | auto_order_rebill + auto_order_update |
| Customer contacts customer service. Customer service makes an adjustment to either the price or date of the next shipment | auto_order_update |
| Order #6 (auto order) | auto_order_rebill + auto_order_update |
| <Cancels subscription after Order #6> | auto_order_cancel |
You’ll notice that auto_order_update will fire in conjunction with other operations. This webhook is fired whenever the database record is updated. If you’re storing a copy of the auto order record off in your own database then listening to the auto_order_update operation is a good idea.
Related Documentation
https://www.ultracart.com/api/#resource_auto_order.html
Questions
If you have further questions about auto order webhooks and implementing your custom business logic using them, please contact support@ultracart.com and we will be glad to expand upon this documentation.