Payment Method

Custom Payment Method for Woocommerce

WooCommerce Payment Gateway Plugin

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. Ours’ is also 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.

Keep reading to know more about how we achieved this!

The Challenges

Currency Checks

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 using the woocommerces’ built in function 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 extension for Woocommerce will be automatically disabled.

Country Checks

Issue: The Plugin 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 .

Payment Process

Issue: For payment process user must go the plugin website. 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 plugin website with all this information.

Solution: The actual payment process is handled in the plugin’s website. We had to redirect the user to their website while passing all the information in a token using JSON format. Plugin’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.

Payment Response CallBacks

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. Website portal returns data in POST format which was difficult to process in WordPress/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

Client Needs

  • 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.

Delegation

  • 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.

Project Management

  • 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

PORTFOLIO

Featured Work

How to contact us?

Not sure what you need for your business? We are! Just send a message to discuss or book a call.