This section shows you the minimum steps to integrate and start experiencing your first transaction. In other words, it gives you the flow of creating your first purchase transaction.
Last updated
Before you begin
Easypay team needs to assigned a demo terminal for you using your phone number to be able to start this integration.
In addition, you need to have an android physical device that supports NFC to be able to test the integration and run the app on it.
2- Login by clicking demo button by entering your phone number and then follow the setup instruction.
3- on app home screen click to Connect and then click Start, after service starting save the IP Address for later use and than click Running on background
4- Create WebSocketwherever you need:
// Create WebSocket connection.const socket = new WebSocket("ws://localhost:5000"); // use "localhost" for connection on same device or use "IP address" for connection from external device.
// Connection openedsocket.onopen= () => {// connection opened – add action here});// Listen for messagessocket.onmessage= (event) => {// payload received and message can be fetched on event.data// parse JSON message here or add an action});// Listen for possible errorssocket.onerror= (event) => {// error can be determined on evt.message});// Connection openedsocket.onclose= () => {// connection closed});
5- Sending Socket function:
socket.send(JSON.stringify({"method":"PURCHASE","amount":100,// [Required] ammount you want to set . "customerReferenceNumber": "1234" // [optional] any number you want to add as a refrence Any string as a reference number.
}));