Managing unpaid orders, abandoned carts, or timed-out reservations manually is an impossible task as your business scales. When users initiate a checkout but fail to pay, those incomplete orders lock up valuable inventory and disrupt your operations.
In traditional development, fixing this requires writing backend cron jobs and managing server task queues—a major hurdle for non-technical founders. However, you can automate this entirely without writing a single line of code. By utilizing a Scheduled Actionflow in Momen, you can build a reliable, automated backend scheduler that periodically checks for and expires old orders, ensuring your platform runs smoothly in the background.
Order Expiry Scheduler's Use Cases
An Order Expiry Scheduler is a recurring, automated background process that runs at predefined intervals (such as every 15 minutes, or every night at midnight) to identify and update specific database records.
This workflow ensures data hygiene and inventory accuracy by automatically releasing stock from abandoned carts, freeing you from manual database interventions. Relying on scheduled backend operations ensures your data is processed with strict reliability, aligning with the core principles of robust architecture (read more about Why Your E-Commerce Platform Needs ACID Compliance).
Typical use cases for scheduled automated tasks:
- Canceling unpaid e-commerce orders after 24 hours.
- Releasing held tickets for events or reservations if checkout isn't completed within 15 minutes.
- Automatically updating user subscription statuses at the end of a billing cycle.
When NOT to use it: Do not use a scheduled task for actions that require instant, real-time execution based on a user's click (for example, updating a wallet balance immediately after a payment is confirmed). For real-time data changes, use standard Actionflows or Database Triggers instead.
How to Build an Order Expiry Scheduler
- Goal: Automatically change the status of an order from "Pending" to "Cancelled" if it remains unpaid for a specific duration.
- Applicable Scenario: Order timeouts, membership expiration, meeting room release, or event registration deadlines.
- Core Logic: Use a Scheduled Trigger to run a background Actionflow every minute, querying expired records and batch-updating their status.
Logic Configuration (Actionflow)
Navigate to the Actionflow tab to build the automation logic.
Scheduled Trigger Configuration
- Create a new Actionflow named Order Status Auto-Update.
- In the Trigger panel, add a Schedule trigger.
- Start at / End at: Define the effective time range for this automation.
- Trigger frequency: Set to EVERY_MINUTE (for testing purposes) or your desired business interval.
- At which second: Specify an exact second.
Quota Usage Note: Every time the scheduled Actionflow runs, it consumes 1 run from your balance. You can track this by checking the "Number of remaining automated actionFlow" indicator in the top right corner of the editor. Please monitor your balance closely when configuring high-frequency triggers like EVERY_MINUTE.
Querying Expired Orders
Add a Query Data node to identify orders that need to be cancelled.
- Table: Select order.
- Filter Logic: Configure the conditions using the "And" operator:
status Equal to Pending.
created_at Less than or equal to DELTA formula.
Formula Setting: Use the DELTA function to calculate the expiration threshold:
Original time: Current datetime.
- Operation: Decrease.
- Minute: 1 (This defines the 1-minute timeout).
Batch Updating Status
Use a loop to process the results from the query.
- Add Loop: Connect a Loop node to the Query node. Set the data source to the output of Query Unpaid Orders.
- Update Data: Inside the loop, add an Update Data node.
Table: order.
- Filter: id Equal to Actionflow data -> Loop -> item -> id.
- Parameters: Set status to a constant value: Cancelled.
Verification
To test the logic, go to the Data -> Database view and follow these steps to observe the time-sensitive behavior:
- Insert Test Data: Manually add two records.
Record A: status = Paid.
Record B: status = Pending. Note the exact created_at time (e.g., 12:33:10).
First Execution Cycle:
Wait for the first scheduled trigger (e.g., at 12:33:53).
Since the time elapsed since creation (43 seconds) is less than the 1-minute threshold defined in the DELTA formula, the status will remain unchanged as Pending.
Second Execution Cycle:
Wait for the next scheduled trigger (e.g., at 12:34:53).
Now that the elapsed time (1 minute and 43 seconds) exceeds the 1-minute threshold, the Actionflow will successfully query the record.
Final Result: Refresh the database view. Record B's status should now be updated to Cancelled, while Record A remains Paid.
Note: Because the trigger runs at a fixed interval (e.g., the 53rd second of every minute), a record might wait anywhere from 1 minute to 1 minute and 59 seconds before being processed, depending on exactly when it was created relative to the trigger cycle.
Try It Yourself and Expand Your Application
The best way to understand background automation is to build it yourself. We encourage you to clone a working template into your Momen workspace to see how these scheduled tasks operate in a live environment.
Once your basic expiry logic is running, you can easily expand the Actionflow to fit deeper business needs. For example, you can add nodes to trigger external API calls that send an "Order Cancelled" email to the user, or connect to third-party tools to automatically sync your restocked inventory. As your application runs, you can utilize the Log Service to monitor the successful execution of your background tasks and troubleshoot any issues.
Automate Your Backend with Confidence
Building an automated order expiry scheduler transforms a manual operational headache into a hands-off, reliable backend process. By setting up no-code automated workflows, you eliminate the risk of human error and ensure your platform's inventory remains accurate as you scale.
Momen provides the industrial-grade backend architecture required to run complex, scheduled operations safely and visually. You get the power of traditional server-side cron jobs while keeping full control over your business logic.
Clone the template today, set up your first scheduled trigger, and start automating your application's data management.





Top comments (0)