MongooseIM use case for a customisable communication solution for mobile payments.

payments app

The Company

NayaPay is a payment platform supporting peer-to-peer and peer-to-merchant payments in Pakistan. The platform offers mobile payments with a chat interface to seamlessly merge the social chat and transactional dynamics of sending and receiving money. Consumers have a chat profile, and merchants are represented by a chatbot that acts as a storefront. The company has aspirations to position itself as a lifestyle super app similar to WeChatPay.   The platform connects to various application stacks that handle different aspects of the business flow. The payment stack uses a relational database for strong consistency, the middleware stack a NoSQL database for performing various business logic, maintaining the customer profiles, and other relevant data.

The Challenge

Nayapay’s goal was to build a seamless experience for making payments to friends, family members and merchants on mobile including some social and chat experiences. As part of this, they needed to identify an easy to integrate and ready to use messaging system backend that would allow effective testing and deployment and get them to market quickly.

In addition, the solution needed to be ready to scale in line with them securing more funding and ensure that important financial transaction messages were not lost during network outages that are commonplace in the region.


They needed a suitable, reliable XMPP chat server to connect with the popular XMPP library, ChatSDK, that they had in place. The team tested some alternative XMPP chat servers before arriving at MongooseIM. They found it to be the best fit thanks to the security-related features, ease of adding new features and robust XMPP framework for real-time messaging and information exchange – essential for providing support and a rich user experience in the Fintech domain.

For this project, NayaPay required a production environment to be set up and stress testing for the pilot stage. This would be followed by performance tuning and adding features such as video and voice chat. They needed a trusted partner for secure, remote delivery with full remote access granted to build and load test the infrastructure.

Erlang Solutions were engaged to provide expert integration of the MongooseIM backend with the existing ChatSDK frontend, optimised for working with Android and iOS.

The Solution

We set up a dedicated remote team to work in close collaboration with the in-house iOS and Android team at NayaPay – recognising that effective teamwork and communication across time zones and tech functions would be critical to the project’s success.

Our team performed load testing and shared stats that met NayaPay’s user acquisition targets. The scalability potential of the server was then demonstrated by providing steps to add additional nodes and increase the overall capacity when required.

The backend was set up in a high availability cluster connected to MySQL, with all messaging replicated in real-time. The integration was done using Rest APIs for server administration. The NayaPay middleware server consumes these APIs to register and update users on the server. They are also used for server-side messages sending merchant bills and notifications to subscribed users. 

We delivered an on-premise deployment with the chat service hosted on private cloud to meet several stringent requirements in terms of workflow and security protocols in line with working on a project in a highly regulated industry such as financial services. Security hardening was also performed, making it more difficult to find an attack vector.

Other security requirements for handling sensitive financial data were met by:

– Client authentication with a public key

– Encrypted connections, both client-server and server-database and other backend components

– FIPS 140 standard support

The Results

The NayaPay chat platform is live, proving suitably robust for operation in the financial services space and ready to scale further in line with its ambitious roadmap and growth targets. MongooseIM is a critical component of the Nayapay model and strategy and will continue to enhance the platform’s capability to offer a growing suite of products to its users on the way to becoming a Pakistani super-app!

We provide an ongoing full support package to give assistance when there is any technical issue, identifying the root cause and prioritising knowledge sharing with the NayaPay team.

The NayaPay mobile app is publicly available on PlayStore, with around 175,000 users growing by three thousand users per day; they have targeted 5 million user acquisitions in the next five years. 

Following a high-profile funding round of $13 million at the start of 2022, NayaPay is ready to significantly scale and pursue its ambitious roadmap. You can read the TechCrunch story of the funding round here.

MongooseIM Key Benefits

  • Optimal levels of control of source code and hosting as necessary for working in financial services 
  • Minimal additional development requirements thanks to the extensive out of the box functionality
  • Faster and easier integration of chat features in numerous languages on various platforms, such as Objective-C, Java, Python, JavaScript and more
  • Mature and optimised XMPP native libraries
  • Free to deploy on any number of nodes, on cloud or on-premise
  • Horizontal linear cluster scalability as standard to scale according to traffic profiles and user base
  • Encrypted traffic both on the client-server level and on the client-client layer.
  • Government-grade algorithms and hardening

MongooseIM Overview

MongooseIM is a real-time, mobile messaging platform and scalable XMPP server that benefits from all the power of XMPP with the simplicity of REST API. This means MongooseIM is easy to integrate with both client sides and backends.

MongooseIM offers soft real-time communication, one-one messaging, group chat and social features for publishing and commenting on articles. It has a clean and modular design, a low rate of failure/downtime and an excellent end-user experience.

Extensible Messaging and Presence Protocol (XMPP) is a communications protocol for message-oriented middleware based on XML and has the advantages of lots of libraries, secure authentication and being decentralised, among other things. 

Our Expertise

Our team are world-leading experts with over a decade’s experience in messaging technologies, including XMPP, MQTT, EMQx, Erlang and Elixir. We can help you build scalable communication systems specific to your needs, so you can start small and grow to match your ambition and imagination.

We created MongooseIM to provide business and product owners with the reliability of a battle-tested messaging server that can scale to millions whilst still providing flexibility to customise and build your own solution without using black-box technologies or the need for the ongoing subscription costs of a software-as-a-service solution. 

Whether you have thousands of users or billions, we’ll ensure they get the message.

“I can confidently state that our work with the MongooseIM team at Erlang Solutions has been critical to our success at NayaPay. We cherish the relationship we have built with the MongooseIM team and foresee this partnership continuing long into the future.”

Danish Lakhani CEO at NayaPay