Many popular neobanks (Revolutе, Monzo, N26, and others) have the function of sending money by phone number. We would like not only to tell you how this feature is applied but also to provide a ready-made solution (the implementation of which takes weeks not months). In other words, this article is written to share our experience and expertise and show the path we have taken to implement our p2p solution using the Visa Direct API. We offer to use our solution to launch and sell your product with Visa faster.
So, first, we have checked the portal for developers and analyzed the technical materials of Visa (videos, webinars, screenshots of Visa documentation, etc.) related to the implementation of Visa Direct API. This portal has all the necessary information to make a prototype application and test the business idea without outside help. However, when we started working on the Visa Direct API, we realized that theory is different from practice and the procedure itself is complex, resource-intensive, and time-consuming, as it involves the processes of research, development, integration, implementation, and support.
Therefore, after studying the documentation and gaining access to the test environment, we made test calls in Postman and used the CryptoJS libraries to call the API - to generate hashstrings and use it in the signature to requests. After successful Visa API test calls, we moved on to the main task – the description of the process of calling the API. See the diagram below, showing which APIs are used and in what sequence they should be called to get the result – p2p money transfer by phone number
Scheme and sequence of using the API for p2p transfers by phone number
We made several layers at once to show the implementation logic. In our case, we used Node-RED. For the final developer, the process in Node-RED is a regular API, which it is enough to call to get the final result.
After we started developing the process on Node-RED, we quickly realized that in order to facilitate and speed up the development of the process, we need to make our own nodes and a palette of Visa API calls for Node-RED. Such a palette with a set of nodes is like a ready-made SDK for mobile application developers. No need to spend a lot of time on the routine wrapping of API calls, ensuring security requirements when calling them, etc.
And so when we made the workflow, we realized that we needed to help other companies to simplify the processes, save time and put our work in the public domain:
- The ready-made palette in Node-RED with nodes based on Visa API (Visa Direct) access on npmjs.com
- Example of the process made using palette Visa API and available for downloading at NodeRed.org
In the following figure, you can see the ready-made flow in Node-RED
Ready-made flow in Node-RED.
In the process of creating of this flow and testing, we discovered that even the Visa test APIs have bugs. For example, if you try to create an alias by phone number to the card, this can be done only for cards starting with 9… And the test API debiting/crediting works only with test cards starting with 4… So, working on the development of financial solutions that define the success of the business and the security of financial transactions, it is important to entrust the work to professionals who have the necessary practical and theoretical experience with the Visa payment system and are its trusted partner.
Starting and testing the process
To test this flow, it is enough just to run it on own computer or server.
Here is the step by step instruction to run it (it is necessary to spend ~ 5 minutes):
For simplification, we have prepared the docker-container, thanks to which it is possible to run the processes with several commands:
- to clone from GitHub the settings of docker container https://github.com/Chatbots-Studio/visa-nodered-public-deploy
- to run Node-RED from docker container “sudo docker-compose up -d”
- All source files
- flow.json on NodeRed.org
- NPM package, it must be installed through the terminal “npm install @42flows/custom-node-visa-api@latest”
After running it, you can test the process:
Route
|
http://localhost:1880/sendMoney
|
Method
|
POST
|
Body of request (Example)
|
{
"senderPhone": "74958881111",
"receiverPhone": "74958881111",
"currency": "USD",
"amount": 100
}
|
Format of request
Titles of request
Authorization
string
|
obligatory
|
Authorization code
|
string
|
Parameters of Request
senderPhone
string
|
obligatory
|
phone of sender (for example, 7XXXXXXXXXX)
|
receiverPhone
string
|
obligatory
|
phone of the receiver (for example, 7XXXXXXXXXX)
|
currency
stirng
|
obligatory
|
currency of transfer
|
amount
int
|
obligatory
|
transfer amount
|
Format of the Response
Parameters of the response
description
string
|
obligatory
|
transaction status notification
|
Codes of Responses
200
|
Successful request
|
400
|
Incorrect format of data about the user
|
401
|
Incorrect authorization token
|
500
|
Internal server error
|
In case of a successful call, you will receive the following response:
Example of a successful response
Status code
|
obligatory
|
200
|
Response body
|
Obligatory
|
{
"description": "Funds transaction was successful"
}
|
Logging and scaling
We have many years of experience in using Node-RED in industrial systems and under load. To collect logs, we use the logagent and ELK stack to analyze them. We use the Stateless approach when developing Node-RED processes, so they are fairly easy to scale because it's a regular NodeJS application. Here is one of the options for scaling using AWS services is described officially on NodeRed.org.
We hope that our work will help you run the desired functionality for your users faster.
Conclusions
Already more than 10 banks in Eastern Europe (PrivatBank with 15 million customers, UkrGasbank with 2.1 million customers, and many others) use NodeRed to automate internal processes. The 42flows.tech team has helped many of these banks develop and implement solutions for loans, deposits, cards, and plans to share our experience and expertise with the community.
So, we offer you a ready-made, production-ready solution for p2p money transfer by phone number using the Visa Direct API, which can be used with minimal settings. If necessary, we can help you with the processes of:
- Research;
- Development;
- Integration;
- Implementation;
- Support.