Using background jobs for a fully automated e-commerce system


Posted on October 16, 2019 by Sherlon Gerard


As your e-commerce business grows, orders are coming in very frequently, you can start automating some tasks that you normally spent a few minutes doing when processing each order.
On the long run this can save you a significant amount of time so you can better focus on some other areas of your business.

Developing and installing a Scheduled Task (or scheduled background job) to run on an interval every 5 or 60 minutes is totally not expensive at all. If your e-commerce is running on a Serverless Environment like Azure, within no-time you can develop and deploy Azure functions or on AWS you have Lambda jobs. In case you are using a Shared Environment, you can use such a tool like Hangfire. In the next blog items I’ll be showing some real-world examples on how to use Hangfire. Which is my favorite framework to use for scheduling background jobs in .NET. In my next posts I’ll also elaborate more on Hangfire.

Here below some of the most basic Scheduled Tasks every e-commerce webshop should have:
Basic scheduled tasks for e-commerce webshop

Check payment status

In most cases (based on experience) you have this scenario: a customer selects a product to buy, gets redirected to the payment provider page, the customer pays for the product and then close the browser or/and never hit the ‘Complete’-button on the payment provider page.
So, you will not get a confirmation that the payment has been completed successfully. You need to manually check your payment provider to see the payment confirmation.
This task can be easily automated by a Scheduled Task. For instance, if you are using IDeal you have the code method called RequestTransactionStatus(transactionId) . Based on the response status you get back, you can determine whether the payment has been completed successfully or not.

Notification service

In cases where you want to notify your customers about their order status, there are API’s provided by the Shipping provider. Most these API’s can be used for free (so far, I know). They provide most of the time:

  • Functions to generate shipping address labels with unique barcode or QR-code
  • Order delivery status updates
  • Full integration of their services in your e-commerce system for an optimal logistics process
A Notification Service can also be used to inform the customer about when a certain product will be available again. Such a service is necessary to remove some workload out of your customer service department and to engage your customers with your webshop.

Update products inventory

Products can get lost, damaged or defected. The customer also has the right to return a product. In all these cases your inventory needs to be updated. This can be a very time-consuming job. In all these scenarios a Scheduled Task can update your products inventory. You don’t want to be selling products that are not available anymore.

Clean up database

The Happy flow is: the customer selected some items (s)he wants to buy, customer hit the checkout button and completed his/her payment without any problem. But most of the time this is not the case. Customer can decide, in the middle of the process of checking out, to quit without cleaning their cart. What then happens is that each step the customer took has been stored into the database in several tables. You can choose to leave these data and use it as a Lead by getting in touch with the customer and remind him/her about the unfinished order, or you can clean this data by deleting it or moving it to a Leads table or database. For both scenario’s you can rely on Scheduled Task to do the job.

For any reason you need help implementing these Scheduled Tasks using Uvendia, we can develop and deploy them for you. Please look at our Support Center for the prices.