Woocommerce is a popular ecommerce plugin for WordPress with almost 4 million+ active installations. There are quite a few payment gateways available for online payments. We have built one of them providing the users, facility of online payment. This gateway’s development was a little different from other gateways as this supports only few currencies and countries.
WooCommerce Payment Gateway Plugin
20 Working Days
Issue: The plugin only supports five currencies at the moment. So, we had to compare the selected currency in woocommerce with the list of supported currencies. The client also wanted us to disable the plugin options if currencies would not match and display an error.
Solution: Firstly, we fetched the currency enable in woocommerce and compared that with the supported currencies of plugin. If selected currency is available in our list of currencies then setting page of plugin having some fields is displayed otherwise, there will be an error displayed that user’s enabled currency is supported by the plugin and the extension for Woocommerce will be automatically disabled.
Issue: Our payment Gateway supports some currencies in different regions only. We had to make sure that the selected currency is supported in a particular country. For example Euro is supported in Germany but not in Chile.
Solution: In order to solve the problem, we asked the user for country and saved this in database. First we validated the country code field. Then we compared this value to our criteria if that currency is supported in selected country.
Issue: For payment process user must go to the payment gateway portal. We faced multiple problem in order to get the data from woocommerce. We had to get all the metadata of an order i.e
order_id, merchantCustomerId, merchantOrderId and transaction details in an array. After that we had to redirect user to the payment gateway’s website with all this information.
Solution: The actual payment process is handled in website. We had to redirect the user to their website while passing all the information in a token using JSON format. Portal’s api returned the data maintaining the user sessions. During this process we also kept the error handling in mind with some important checks of Connection errors.
Issue: After the payment process, it is also necessary to ensure that order meta is updates according to payment results. It can be either successful or not successful.
Solution: We created two callback functions. Payment Gateway returns data in POST format which was difficult to process in WordPress and WooCommerce. For this we used PHP STREAM, in order to treat the data as a file. If the payment was made successfully then it will automatically update the order details in Woocommerce tab. Otherwise, user will know about the failure of payment. In either case, user will be redirected to a URL having a message of either the payment was successful or not.
Our Project Planning
● We collected and gathered information from the client through several meeting, calls and conversations.
● After that we brainstormed over the provided information.
● We suggested a few things to client.
● After some discussions, everything was finalized and we started the development.
● The project was divided into several milestones and every milestone was given a specific deadline.
● We devised teams and delegated the work to each one in accordance with their skill level.
● The created milestones of this project were divided in such a manner that they remained independent of each other, so one milestone can’t get affected by the other.
● We approached the project with agile methodology i.e. placing the work in sequence as sprints. Since the project was divided into milestones, the particular tasks assigned to these were also designed in such a way that the team members remained independent over the others.
● At the end of each day, we had a quick scrum of 10 minutes.
● At the end of each week, we had a longer scrum.